Conversation
|
@lee1043, could you take a look at this when you have time? @andrewdnolan, just letting you know I took care of this. |
|
Thanks @xylar! |
|
@xylar thanks for the PR! Confirmed that the PMP code tested with demo 1b notebook works fine with shapely 2.1.X versions. |
|
And thanks for this especially! If you can do a 4.0.1 or 4.1.0 release with this update, that would be really helpful to us. |
|
@xylar Thanks for the comment! I am working on updating the build number for 4.0.0 (conda-forge/pcmdi_metrics-feedstock#55), but do you prefer having new version release? |
|
@lee1043, yes you cannot simply update the build number if there have been code changes. You need to do a new release. Changing the build number leaves the code entirely unchanged and just updates the recipe for making the conda package. (Unless you go through the trouble to patch the code on conda-forge, which is to be avoided.) |
|
@xylar Thanks for helping me better understand this! Sure, I can bump the version to 4.0.1 and release through the conda channel today. |
|
Perfect! Thank you! |
This pull request improves compatibility with newer versions of the
shapelylibrary and refines how polygonal geometries are handled in precipitation metrics code. The main changes include updating dependency constraints and making the code more robust to different geometry types returned byshapelyoperations. This ensures consistent behavior acrossshapelyversions and prevents errors when working with simplified geometries.Dependency updates:
shapelydependency constraint in bothconda-env/ci.ymlandconda-env/dev.ymlto allow any version>=2.0.1and<3.0.0, ensuring compatibility with futureshapely2.x releases. [1] [2]Geometry handling improvements:
CalcMetricsDomain3ClustandMedDomain3Clustfunctions (lib_precip_distribution.py), added logic to handle cases whereMultiPolygon.simplifymay return aPolygonorGeometryCollection. The code now coerces the result to aMultiPolygoncontaining only polygonal components, improving robustness to geometry type changes inshapely>=2. [1] [2]CalcMetricsDomainAR6andMedDomainAR6, clarified and corrected the construction ofMultiPolygonobjects: when region polygons are already created, they are passed directly toMultiPolygon, preventing unnecessary wrapping and potential errors. [1] [2] [3]Fixes #1330