You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've been trying to figure out if it is possible to generate a mask for a region using rioxarrays clip functionality. The issue is that I have 2D lat/long coordinates and I get an error " DimensionMissingCoordinateError: x missing coordinates." because my x and y dimensions don't have coordinates.
This is the file that I'm trying to make a mask with, which is currently just an array of 1's on the grid that I'm interested in.
Hi, I've been trying to figure out if it is possible to generate a mask for a region using rioxarrays clip functionality. The issue is that I have 2D lat/long coordinates and I get an error " DimensionMissingCoordinateError: x missing coordinates." because my x and y dimensions don't have coordinates.
This is the file that I'm trying to make a mask with, which is currently just an array of 1's on the grid that I'm interested in.
Dimensions: (x: 953, y: 834)
Coordinates:
lat (y, x) float32 -10.590603 -10.5368185 ... 46.668922 46.591976
lon (y, x) float32 -139.08585 -139.02963 ... 22.654575 22.661009
spatial_ref int64 0
Dimensions without coordinates: x, y
Data variables:
CONUS_mask (y, x) float64 1.0 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0 1.0
Below is the code I am using.
mask.rio.write_crs("+proj=latlong
+R=6371229",inplace=True)
CONUS_shp
= geopandas.read_file('/path/to/file.shp', crs="+proj=latlong+R=6371229")
clipped = mask.rio.clip(CONUS_shp.geometry.apply(mapping), crs="+proj=latlong +R=6371229")
I also saw #114, where it was recommended to filter with xr.where for a similar 2D coordinate case, but that solution won't work with a shape file.
Thanks for your help!
The text was updated successfully, but these errors were encountered: