-
Notifications
You must be signed in to change notification settings - Fork 1
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
Bugfix multipolygon treatment and adapt to latest Shapely #14
Conversation
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…ions Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
…onstituent parts of a multi-part geometry. From 2.0 and onwards the previous code would result in a TypeError ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
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.
Just one refactor proposition, otherwise lgtm
activefires_pp/post_processing.py
Outdated
shape = geometry.geoms[0] | ||
pth = Path(shape.exterior.coords) | ||
mask = pth.contains_points(points) | ||
for shape in geometry.geoms[start_geom_index:]: | ||
|
||
constituent_part = geometry.geoms[start_geom_index:] | ||
for shape in constituent_part.geoms: | ||
pth = Path(shape.exterior.coords) | ||
mask = np.logical_or(mask, pth.contains_points(points)) | ||
|
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.
this looks very similar to get_maks_from_mulitpolygon
, can it be factorized?
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.
Yes, true. I think this should be done okay now, and at least one test is covering this
Signed-off-by: Adam.Dybbroe <a000680@c21856.ad.smhi.se>
Codecov Report
@@ Coverage Diff @@
## main #14 +/- ##
==========================================
+ Coverage 75.73% 77.45% +1.71%
==========================================
Files 20 20
Lines 1966 2000 +34
Branches 193 192 -1
==========================================
+ Hits 1489 1549 +60
+ Misses 451 422 -29
- Partials 26 29 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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
This PR mainly fixes a problem in the treatment of multi polygons for newer shapely versions.
For a while this deprecation warning has been seen.
Now with shapely 2.0 it results in a
TypeError
and a failure.pytest
flake8