Open RondeauG opened 2 years ago
That would necessitate the cell boundaries I believe. Similarly with xESMF, this is trivial to obtain for rectilinear grids, but not for curvilinear (rotated pole) ones. Would you be ok if this had the same conditions as in xESMF? i.e. : When touching = True
, if lat
and lon
are 2D arrays and ds.cf.get_bounds
fails, then the function fails.
I think so, but in that case we'd definitely need both buffer
and touching
for subset_shape
and subset_bbox
. This way, buffer
could still be used for curvilinear grids.
Also, reading a little more on which features shapely
has, I think that intersects
or overlaps
would be better terms than touches/touching
.
From https://shapely.readthedocs.io/en/stable/manual.html#object.intersects:
Description
Currently,
clisops
will subset a dataset based on the lat/lon coordinate of the grid pixels, meaning that the center of the pixel needs to be inside the region to be kept. An option to instead keep all the pixels that touch the region would be very useful.I realise that the
buffer
argument ofsubset_shape
already serves that purpose, but it can be difficult to use effectively since the optimal value depends on model resolution. At minimum, however, a similar option should be included forsubset_bbox
too.