I tried to make an algorithm in Python where I entered a georeferenced raster (known coordinate system), all its negative values were transformed to zero, and then a new image was saved with the georeference of the initial image.
import skimage.io
import pandas as pd
import numpy as np
pathhr = 'C:\\Users\\dataset\\S30W051.tif'
HR = skimage.io.imread(pathhr)
df1 = pd.DataFrame(HR)
HR_changed = df1[df1 < 0] = 0
#save function
savedata = df1.to_numpy()
skimage.io.imsave('C:\\Users\\dataset\\S30W051_TEST.tif', savedata)
But when I save my raster at the end of this script, I get a non-georeferenced TIFF raster.
How do I keep the same coordinate system as the initial raster (without transforming the output raster into local coordinates)?