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

Allow multi_model_statistics on cubes with arbitrary dimensions #1808

Merged
merged 13 commits into from
Nov 29, 2022

Conversation

schlunma
Copy link
Contributor

@schlunma schlunma commented Nov 18, 2022

Description

This PR allows the usage of the multi_model_statistics preprocessor on data with arbitrary dimensions, i.e., it's not necessary anymore that data has time and/or horizontal dimensions.

In addition, it converts the pytest.mark.xfail used in the tests to pytest.raises since the corresponding tests are not expected to fail due to a bug. We rather expect the corresponding errors to appear due to different coordinates/shapes in the input cubes.

Pytest doc:

An xfail means that you expect a test to fail for some reason. A common example is a test for a feature not yet implemented, or a bug not yet fixed.

Closes #1009
Closes #890
Closes #891
Closes #738
Closes #41

Link to documentation: https://esmvaltool--1808.org.readthedocs.build/projects/ESMValCore/en/1808/recipe/preprocessor.html?highlight=multi_model_stat#multi-model-statistics


Before you get started

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:

@schlunma schlunma added this to the v2.8.0 milestone Nov 18, 2022
@schlunma schlunma self-assigned this Nov 18, 2022
@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #1808 (1183522) into main (5644203) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
+ Coverage   91.50%   91.53%   +0.03%     
==========================================
  Files         202      202              
  Lines       10919    10938      +19     
==========================================
+ Hits         9991    10012      +21     
+ Misses        928      926       -2     
Impacted Files Coverage Δ
esmvalcore/preprocessor/_multimodel.py 97.35% <100.00%> (+1.20%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@bettina-gier
Copy link
Contributor

Successfully runs in my WIP diagnostic where I used a selfmade mmm workaround before, so thumbs up from me!

@schlunma schlunma marked this pull request as ready for review November 22, 2022 10:05
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

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

very very nice PR and with loads of functionality, great work @schlunma - I would nominate this for the v2.8 Highlights BTW. Just a few questions from me, nothing that warrants requesting changes, but it'd be good to have answers. Even though the testing is bang on, I'd still want to have a recipe or two run - say, two recipes that use MM and have been plagued with issues you fixed here perhaps?

esmvalcore/preprocessor/_multimodel.py Outdated Show resolved Hide resolved
esmvalcore/preprocessor/_multimodel.py Outdated Show resolved Hide resolved
esmvalcore/preprocessor/_multimodel.py Show resolved Hide resolved
@schlunma
Copy link
Contributor Author

Thanks for the review @valeriupredoi !!

I tested 2 custom recipes that benefit from the new features, and @bettina-gier also tested one. All of them work as expected!

Regarding recipes in our repo - since they work with previous versions of the tool they do not suffer from the issues solved here. However, I think many recipes/diagnostics could now be simplified with this change, but that's a different story.

To be safe, I will run 2-3 recipes with the old/new code and compare them 👍

@valeriupredoi
Copy link
Contributor

That's great, cheers, Manu!

To be safe, I will run 2-3 recipes with the old/new code and compare them

Awesome! I should have run those as a reviewer, but after the release I have now developed a chronic aversion of running anything 🤣 And since you're on the job...

@valeriupredoi
Copy link
Contributor

@ESMValGroup/technical-lead-development-team once Manu has finisjed running the extra recipes for testing, could one of yous please have a final looksee and merge this? It's a really neat PR!

@valeriupredoi valeriupredoi added preprocessor Related to the preprocessor enhancement New feature or request labels Nov 22, 2022
@schlunma
Copy link
Contributor Author

All 3 recipe runs were identical. 🎉

@valeriupredoi
Copy link
Contributor

valeriupredoi commented Nov 22, 2022

@schlunma just noticed #1811 (comment) - is that still a blocker for this PR?

@schlunma
Copy link
Contributor Author

No, just for the local recipe I used for testing. Merged the two branches together locally, all fine 👍

(But if you have 5 min to have a quick look at #1811 it would also be much appreciated 👍)

@valeriupredoi
Copy link
Contributor

perfect, thanks, Manu! I will, as soon as I fix the PR on the feedstock, in 10min 👍

@valeriupredoi
Copy link
Contributor

@ESMValGroup/technical-lead-development-team once Manu has finisjed running the extra recipes for testing, could one of yous please have a final looksee and merge this? It's a really neat PR!

giddyup folks! 🍺

@bouweandela
Copy link
Member

Great to see these problems finally fixed @schlunma, awesome job!

@schlunma
Copy link
Contributor Author

@bouweandela I think this can be merged now 👍

@bouweandela
Copy link
Member

I agree, but I didn't merge right away because these are fairly substantial changes, so I wanted to give other members of the @ESMValGroup/technical-lead-development-team the opportunity to comment.

@bouweandela bouweandela merged commit d33e5ad into main Nov 29, 2022
@bouweandela bouweandela deleted the multi_model_stats_arbitrary_coords branch November 29, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment