-
Notifications
You must be signed in to change notification settings - Fork 39
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
Draft: Modify extract_season
to return only "full" seasons upon request
#2597
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2597 +/- ##
=======================================
Coverage 94.96% 94.97%
=======================================
Files 253 253
Lines 14701 14716 +15
=======================================
+ Hits 13961 13976 +15
Misses 740 740 ☔ View full report in Codecov by Sentry. |
many thanks @k-a-webb - it's always good practice to have a Draft PR when not ready for review, as you mentioned in the PR title (so I went ahead and made it a Draft for you 👍 ) |
…st months of the season being outside of first/least years
@valeriupredoi, could you please help me understand why the pre-commit.ci check is failing? |
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 @k-a-webb for your contribution. I left big picture comments, they are mostly recommendations rather than requirements, so feel free to ignore them.
@@ -341,6 +341,9 @@ def extract_season(cube: Cube, season: str) -> Cube: | |||
season: | |||
Season to extract. Available: DJF, MAM, JJA, SON | |||
and all sequentially correct combinations: e.g. JJAS | |||
full: |
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.
I would add more documentation or maybe context. I know what the issue is, but I think a person without context might get confused.
full_season_coord, data_dims=result.coord_dims("time") | ||
) | ||
|
||
result = result.extract(iris.Constraint(full_season=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.
Personal preference, rather than need, but I would add a logger message in the debug format which months have been removed. Also on a similar note, in case the values are existing in a timeseries, but have been masked out, as far as I understand they won't be removed. I would recommend to add this information somewhere.
@@ -631,6 +631,18 @@ def test_get_jf(self): | |||
with assert_raises(iris.exceptions.CoordinateNotFoundError): | |||
self.cube.coord("season_year") | |||
|
|||
def test_get_djf_full(self): |
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.
Again, personal preference, rather than requirement, but I would add a second test when you provide a cube, where the season is captured fully (let's say from Dec to Nov) with the keyword full=True
and check that the returned cube is correct.
Description
Related issue: #2591
Include a parameter
full
(I'm open to this being a different word) which triggersextract_season
to only return "complete" seasons. For example, "DJF" and never just "JF". Invokesextract_time
to clip the time vector prior to season extractionCloses #issue_number
Checklist
It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.
To help with the number pull requests: