Skip to content
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

Add conversion between shapely and cf for polygons #495

Merged
merged 7 commits into from
Jan 19, 2024

Conversation

jsignell
Copy link
Contributor

This is a follow up to #460 now with polygons!

There is a slight wrinkle in that unlike shapely cf doesn't seem to associate particular holes with particular polygons. I am kind of assuming that the order will be interleaved exterior and interior rings. This seem to match the examples that I've seen.

@dcherian dcherian requested a review from aulemahal January 18, 2024 17:04
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (5ee1bc7) 85.78% compared to head (a7db3ad) 85.78%.

Files Patch % Lines
cf_xarray/geometry.py 86.20% 9 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #495   +/-   ##
=======================================
  Coverage   85.78%   85.78%           
=======================================
  Files          13       13           
  Lines        2279     2364   +85     
  Branches      172      183   +11     
=======================================
+ Hits         1955     2028   +73     
- Misses        294      303    +9     
- Partials       30       33    +3     
Flag Coverage Δ
mypy 38.53% <28.73%> (-0.45%) ⬇️
unittests 93.98% <95.58%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@aulemahal aulemahal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I don't have much to say, this looks clean!

The typo in the tests made me think about invalid polygons, but I guess we don't really care at this level ? The invalidity is simply being translated from one format to the other, not our fault.

cf_xarray/geometry.py Outdated Show resolved Hide resolved
cf_xarray/tests/test_geometry.py Outdated Show resolved Hide resolved
cf_xarray/geometry.py Outdated Show resolved Hide resolved
Co-authored-by: Pascal Bourgault <[email protected]>
@jsignell
Copy link
Contributor Author

Ok @dcherian I think this one is good to go!

@dcherian dcherian merged commit 35a8a02 into xarray-contrib:main Jan 19, 2024
12 checks passed
@dcherian
Copy link
Contributor

Thanks Julia! Can we have you on board as a maintainer please/

@jsignell jsignell deleted the polygons branch January 22, 2024 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants