-
Notifications
You must be signed in to change notification settings - Fork 283
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
Shapefile masking #5470
Shapefile masking #5470
Conversation
I think what you have is good. We tend to take the lead from other Scientific Python packages, and the preference there is to not have too many convenience functions when they can be achieved with a few user lines (accepting that some places in Iris have broken this rule in the past!)
A Masking heading within Subsetting a Cube seems appropriate. For this work we will need to start with a placeholder where we can add further detail on masking in general IN FUTURE. Then you can add the shape-specific details as a sub-heading.
This is probably 'good enough' as is - especially looking at cost vs benefit. |
…arnings/errors aswell.
…into shapefile_masking * 'shapefile_masking' of https://github.com/acchamber/iris: fixed spacing (SciTools#5572) DOCS: Removed broken git links. (SciTools#5569)
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.
Thanks so much for taking the plunge on this @acchamber 💐. I have lots of reading material for you below!
This is being planned as part of the 🐙Iris v3.8.0 project. The next block of time for this work ends on I'm buddying on quite a few outstanding project items that are due by
|
Thanks for the update on the timeframe. I've made a start on some comments, and have some focus time today to work on others. How do you want the ones that have been addressed marked - I remember you prefer for the reviewer to mark resolved, should I just comment on each indervidually? After this week none of my other work has urgent timeframes so can push on this. |
Yep, thanks 👍
If you've just addressed something via a commit, there is no need to say anything, I'm happy to check through. But if it helps your own method to comment on each then feel free. And if there is any discussion to be had then definitely comment within the relevant thread. If you want to post multiple comments at once: you can do this by reviewing your own pull request, which leaves each of your comments as |
@acchamber @trexfeathers ⌚ing this with interest, and might have some availability to help maintain momentum on this |
Oh! And please try to avoid squashing your current commits, so that I can tell what is new since my last review. I've kept a record of what I've reviewed so far. I can cope with rebasing because they will still have the same messages (despite different hashes). |
…into shapefile_masking * 'shapefile_masking' of https://github.com/acchamber/iris: Update lib/iris/_shapefiles.py
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #5470 +/- ##
==========================================
+ Coverage 89.71% 89.74% +0.03%
==========================================
Files 90 91 +1
Lines 22815 22904 +89
Branches 5438 5457 +19
==========================================
+ Hits 20468 20556 +88
Misses 1617 1617
- Partials 730 731 +1 ☔ View full report in Codecov by Sentry. |
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.
From the coverage report, I can see that we need unit tests to exercise the following blocks:
mask_cube_from_shapefile(..., in_place=True
)- Passing an 'invalid Geometry object' for
shape
_transform_coord_system(..., geometry_system=None)
Possibly an argument for just removing this option?- Error handling when the code can't find X/Y coords on the
Cube
I left the "geometry_system" keyword in in case it's useful in the future - there's cases you'd use it, there's just not a good way of automatically detecting the projection of a shape because shapefile metadata isn't standardized enough and shapely won't read it if it does. Can rejig the code to remove it but didn't see any harm in keeping it for anyone digging deep enough. Other tests have been added |
Docstring tidy up
OK, I reckon it's just this left:
|
Co-authored-by: Martin Yeo <[email protected]>
for more information, see https://pre-commit.ci
First attempt at user guide section in place - I've not put in a second example or use of the minimum_weight keyword to keep it simple, but it's a MVP now I think. |
Awesome work @acchamber, well done and thanks for sticking with it 🥇 |
…umpydoc-pre-commit * 'numpydoc-pre-commit' of github.com:tkknight/iris: Update CF standard names to v84. (SciTools#5761) Regrid docs fix (SciTools#5758) Improve ncdata and CF information on "iris heart xarray" page (SciTools#5752) Pin ASV - airspeed-velocity/asv#1385. (SciTools#5756) Normalise units of coordinate bounds (SciTools#5746) Add "Which Regridder?" Documentation (SciTools#5742) Document `Coord.ignore_axis` (SciTools#5744) Disable navidation with keys for docs HTML theme options (SciTools#5747) Shapefile masking (SciTools#5470) [pre-commit.ci] pre-commit autoupdate (SciTools#5739) DOCS: Add whatsnew for ruff pydocstyle compliance (SciTools#5700) update docstring (SciTools#5737) Updated environment lockfiles (SciTools#5738) Consider NaNs equal when comparing cubes (SciTools#5713)
🚀 Pull Request
Description
Adds the apply_shapefile function to iris.util that allows a user to mask a cube with a shapefile.
Thing to work on
Consult Iris pull request check list