-
Notifications
You must be signed in to change notification settings - Fork 2
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
Better spatial mean #260
Better spatial mean #260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Juste pour bien comprendre, segmentize
: c'est que les vertices du polygone sont trop longues et on les sépare en plusieurs et simplify
: c'est que les vertices sont trop courtes, alors on en combine plusieurs ensemble ?
Est-ce que le 1 en argument de segmentize
c'est aussi en degré?
Exact! Les deux ont un argument "tolerance" dans les mêmes unités que les coordonnées des polygones. Donc des degrés pour tout nos cas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I'm happy to see that bug finally resolved 😄
call_kwargs["out_chunks"] = kwargs_copy.pop("out_chunks") | ||
|
||
# Pre-emptive segmentization. Same threshold as xESMF, but there's not strong analysis behind this choice | ||
geoms = shapely.segmentize(polygon.geometry, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am I right in thinking that this will be skipped if we provided a shapefile with a resolution finer than 1°?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't do anything to the shape indeed.
geoms == shapely.segmentize(geoms, 1)
if no geom has any vertex longer than 1.
Pull Request Checklist:
number
) and pull request (:pull:number
) has been added.What kind of change does this PR introduce?
region='global'
tospatial_mean
. It will simply be replace by a bbox region covering the whole globe.spatial_mean
, methodxesmf
will automatically segmentize the polygons down to a resolution of 1°, to ensure a correct average.out_chunks
available inregrid_dataset
andspatial_mean
if using xesmf >= 0.8spatial_mean
with methodxesmf
and aGeoDataFrame
as shape.Does this PR introduce a breaking change?
Shouldn't.
Other information:
Added a test for
region='global'
.