xarray_leaflet
xarray_leaflet copied to clipboard
mask nan in single band raster
Fix #62
I computed the alpha channel as it is done for rgb images.
My assomption is that single band dataset will always use np.nan
as a nodata value.
At first I wanted to use:
alpha = np.where(das[0]==self._da.rio.nodata, 0, 1)
but if nodata
is np.nan
it always returns 1. If you know a trick that could work for any value + np.nan
that would be great. if not, the assumption I made seems to be commonly accepted. e.g @giswqs use the same in the add_raster
method of geemap
: https://github.com/giswqs/geemap/blob/13c83f59ebc6790b531277c5908859d4cb5ec190/geemap/geemap.py#L3526