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

Allowed usage of multi_model_statistics on single cubes/products #1849

Merged
merged 5 commits into from
Jan 13, 2023

Conversation

schlunma
Copy link
Contributor

@schlunma schlunma commented Dec 5, 2022

Description

This PR allows the usage of our multi_model_statistics and ensemble_statistics preprocessors on single cubes/products.

Closes #1211


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:

@codecov
Copy link

codecov bot commented Dec 5, 2022

Codecov Report

Merging #1849 (82a97f4) into main (31328ed) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #1849   +/-   ##
=======================================
  Coverage   91.65%   91.65%           
=======================================
  Files         232      232           
  Lines       11555    11557    +2     
=======================================
+ Hits        10591    10593    +2     
  Misses        964      964           
Impacted Files Coverage Δ
esmvalcore/preprocessor/_multimodel.py 97.37% <100.00%> (+0.02%) ⬆️

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

@schlunma
Copy link
Contributor Author

schlunma commented Dec 5, 2022

Open question for the @ESMValGroup/esmvaltool-coreteam:

In the current state of the PR, using std_dev on a single cube returns a fully-masked array. The reason for this is the default usage of ddof=1 by iris.analysis.STD_DEV which leads to a division by zero.

This definitely makes sense, but one could also argue that the result should be an array with zeros here (see #1211). How should we deal with this? Iris allows using ddof=0 as kwargs in cube.collapsed, but currently it's not possible to pass arbitrary kwargs to multi_model_statistics. An option could be to add an additional operator that uses ddof=0.

@bouweandela
Copy link
Member

Are there more iris analysis operators that support arguments? If yes, it might be nice to add support for that in the multimodel statistics function. Maybe best done in a separate pull request?

@schlunma
Copy link
Contributor Author

schlunma commented Dec 7, 2022

Yeah, lots of operators support arguments, see https://scitools-iris.readthedocs.io/en/latest/generated/api/iris/analysis.html. Examples are mdtol, or the many arguments of iris.analysis.PERCENTILE (which are partly handled at the moment with the syntax pXX.YY for the operator).

I opened an issue here: #1851

@schlunma schlunma self-assigned this Dec 8, 2022
@schlunma schlunma added the enhancement New feature or request label Dec 8, 2022
@schlunma schlunma added this to the v2.8.0 milestone Dec 8, 2022
@schlunma schlunma marked this pull request as ready for review December 8, 2022 14:56
@schlunma
Copy link
Contributor Author

schlunma commented Dec 8, 2022

This is ready for review now

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.

great, cheers @schlunma 🍺

esmvalcore/preprocessor/_multimodel.py Show resolved Hide resolved
@bouweandela bouweandela merged commit 80dc689 into main Jan 13, 2023
@bouweandela bouweandela deleted the single_model_mm_stats branch January 13, 2023 16:32
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.

How should multi-model statistics work for a single cube?
3 participants