rio-rgbify icon indicating copy to clipboard operation
rio-rgbify copied to clipboard

Fix nodata values at source edges

Open systemed opened this issue 2 years ago • 0 comments

This is in case anyone else runs into the same issue, really.

I was having issues with artefacts at the edges of source images, caused by nodata values. Adding a call to numpy's nan_to_num in data_to_rgb (encoders.py) fixes it:

data /= interval
data = np.nan_to_num(data, True, 100000.0)
data = np.around(data / 2**round_digits) * 2**round_digits

(100000.0 is from the -b and -i values of my invocation and shouldn't be hardcoded, obviously.)

systemed avatar Jul 17 '22 20:07 systemed