Cropping dataset with rotated poles #8082
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Re-gridding to 1D You might also use the provided 2D ds_clip = ds.where(
(
((ds.lat > bbox["bottom"]) & (ds.lat < bbox["top"]))
& ((ds.lon > bbox["left"]) & (ds.lon < bbox["right"]))
),
drop=True,
) Another approach would be to project your shapefile coordinates into the rotated pole domain and do cropping and all further computation in that domain. This at least excludes any errors which might be introduced by grid interpolation. |
Beta Was this translation helpful? Give feedback.
Re-gridding to 1D
lat
/lon
always involves interpolation and that is sometimes not really wanted. There is #2281 discussing potential approaches.You might also use the provided 2D
lat
/lon
coordinates for cropping/masking. As always this depends on your actual use-case. The below example just crops with a simple bounding box.Another approach would be to project your shapefile coordinates into the rotated pole domain and do cropping and all further computation in that domain. This at least excludes any errors which mig…