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 collapse operator with corresponding yaml file and changes #168

Merged
merged 14 commits into from
Aug 3, 2023

Conversation

Sylviabohnenstengel
Copy link
Contributor

@Sylviabohnenstengel Sylviabohnenstengel commented Jul 25, 2023

Review requested for when you are available next week.

first draft of aggregator dealing with min, max, stdev, etc.
The percentile aggregator is included with further line in yaml file and if condition in aggregator using the **kwargs argument. Interested in solution that looses the if condition when you review the code.

Fixes #99

@Sylviabohnenstengel Sylviabohnenstengel changed the title Add aggregate operator with corresponding yaml file and changes Add collapse operator with corresponding yaml file and changes Jul 26, 2023
@Sylviabohnenstengel
Copy link
Contributor Author

renaming the aggregate operator to collapse operator as it is doing a collaps using min, max, percentile functions.

@Sylviabohnenstengel
Copy link
Contributor Author

@Sylviabohnenstengel Sylviabohnenstengel added the enhancement New feature or request label Jul 26, 2023
@Sylviabohnenstengel Sylviabohnenstengel added this to the basic operators milestone Jul 26, 2023
This was linked to issues Jul 26, 2023
@jfrost-mo
Copy link
Member

At a quick glance the operator looks reasonable. I'll do a more detailed review later today.

Copy link
Member

@jfrost-mo jfrost-mo left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. Some minor changes suggested around the code. I did also wonder whether we wanted to generalise the operator around how many dimensions it can collapse at once. See my comment on the collapse_cube_2dim function.

src/CSET/operators/__init__.py Outdated Show resolved Hide resolved
tests/test_data/plot_instant_air_temp_collapse.yaml Outdated Show resolved Hide resolved
tests/test_data/plot_instant_air_temp_collapse.yaml Outdated Show resolved Hide resolved
tests/operators/test_collapse.py Outdated Show resolved Hide resolved
src/CSET/operators/collapse.py Show resolved Hide resolved
src/CSET/operators/collapse.py Outdated Show resolved Hide resolved
src/CSET/operators/collapse.py Outdated Show resolved Hide resolved
src/CSET/operators/collapse.py Outdated Show resolved Hide resolved
@jfrost-mo
Copy link
Member

jfrost-mo commented Aug 1, 2023

To get the tests passing this branch needs rebasing on main. You can do that as follows:

git pull
git rebase origin/main aggregator_operator
git push --force

@Sylviabohnenstengel
Copy link
Contributor Author

Hi, I have gone through your suggestions and pushed the changes. Could you take a look please? I had already started on the aggregate operator so hope none of the aggregator related code has made it into this push.

Sylviabohnenstengel and others added 8 commits August 3, 2023 11:29
Co-authored-by: James Frost <james.frost@metoffice.gov.uk>
Co-authored-by: James Frost <james.frost@metoffice.gov.uk>
Co-authored-by: James Frost <james.frost@metoffice.gov.uk>
Co-authored-by: James Frost <james.frost@metoffice.gov.uk>
Co-authored-by: James Frost <james.frost@metoffice.gov.uk>
@jfrost-mo
Copy link
Member

I've reformatted the code, removed the unnecessary collapse_2dim operator, and gotten the tests passing.

The 1 dim function already actually handled collapsing over multiple coordinates, so I just updated its docstring.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Coverage

@jfrost-mo
Copy link
Member

Only thing left to do is to add a test for the PERCENTILE method, and it should be ready to merge.

@jfrost-mo jfrost-mo self-requested a review August 3, 2023 11:05
Copy link
Member

@jfrost-mo jfrost-mo left a comment

Choose a reason for hiding this comment

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

I'm happy with this now. @Sylviabohnenstengel if you are happy, go ahead and merge in this PR.

Copy link
Contributor Author

@Sylviabohnenstengel Sylviabohnenstengel left a comment

Choose a reason for hiding this comment

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

Do we still use the test_data/*yaml files?

@jfrost-mo jfrost-mo merged commit 37c7ae3 into main Aug 3, 2023
5 checks passed
@jfrost-mo jfrost-mo deleted the aggregator_operator branch August 3, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New CSET operator: collapse
2 participants