-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for DataArray
objects read through rioxarray
#445
Labels
Comments
This is a helpful reference: https://corteva.github.io/rioxarray/stable/getting_started/nodata_management.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
raster
functionality in for weights building currently supportsDataArray
objects created throughxarray.open_rasterio
:The code above correctly picks up that missing data are specified with -200 and removes them from the calculation of the weights:
This is not the case when we use
DataArray
objects build through the (generally recommended)rioxarray.open_rasterio
:which does not pick up the missing data:
My hunch is that this is because the builder picks up missing values only through the
attrs
object:libpysal/libpysal/weights/raster.py
Lines 229 to 233 in 0f03a31
But
rioxarray
does not populate that general object, instead logs missing data underpop2.rio.nodata
:I think we should support both formats, read through vanilla
xarray
and withrioxarray
loaded in the session too. The former is a more generic approach, the latter is a more robust one for rasters.Not sure what'd be the ideal way of supporting this. I'm cc'ing here @MgeeeeK since he worked on the original implementation and might have some ideas, and @snowman2 as the main driver behind
rioxarray
in case they have some suggestions in terms of best practices.The text was updated successfully, but these errors were encountered: