Click here to Skip to main content
15,887,304 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 = skiimage.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.

What I have tried:

How do I keep the same coordinate system as the initial raster (without transforming the output raster into local coordinates)?

I ask for help in solving this problem. Thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900