Wrong behaviour of copy()
method with new_array
from np.ndarray with NaNs
#294
Labels
bug
Something isn't working
The
copy
method expects anp.ndarray
as input for thenew_array
argument. However, if that array contains NaNs, theRaster
object created will have as.data
anp.ma.masked_array
which contains unmasked NaNs.This results in a lot of issues: applying
np.ma
functions, writing a Raster to disk in rasterio, propagating nodata when applying arithmetic functions toRaster
objects, etc... Strangely, some systems support the writing of these unmasked NaNs to disk in TIFF, while it result in a break down on others.We should probably check the input type in
copy
, or upstream infrom_array
i.e. inRaster.__init__
if the issue is global to these routines, in order to create a masked_array that masks the NaNs automatically.The text was updated successfully, but these errors were encountered: