corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
518 stars 82 forks source link

Setting mask value when using rio.clip and from_disk=True #556

Closed jessjaco closed 2 years ago

jessjaco commented 2 years ago

When using rio.clip with from_disk=False (the default), areas outside of the clipping geometry are given a value of nan. When from_disk=True, these areas are assigned a value of zero. Since the latter uses rasterio.mask.mask, would it be possible to set the nodata arg of that function to something else, or at least to nan for consistency?

jessjaco commented 2 years ago

I'm sorry, I was making a reprex and am only seeing this in some cases. Closing for now until I can figure out what's going on.