-
Notifications
You must be signed in to change notification settings - Fork 2
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 get_partition_input #289
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
# Conflicts: # CHANGES.rst
# Conflicts: # CHANGES.rst
<!--Please ensure the PR fulfills the following requirements! --> <!-- If this is your first PR, make sure to add your details to the AUTHORS.rst! --> ### Pull Request Checklist: - [x] This PR addresses an already opened issue (for bug fixes / features) - This PR fixes #1497 - [x] Tests for the changes have been added (for bug fixes / features) - [x] (If applicable) Documentation has been added / updated (for bug fixes / features) - [x] CHANGES.rst has been updated (with summary of main changes) - [x] Link to issue (:issue:`number`) and pull request (:pull:`number`) has been added ### What kind of change does this PR introduce? * Add partition algo from Lafferty and Sriver (2023) ### Does this PR introduce a breaking change? depends (see options below) ### Other information: TODO list in this PR: - [x] Add weights - [x] add tests - [x] Maybe add `num` to `hawkins_sutton` ? - [x] Clean up based on changes outside of this PR (eg. remove functions that are now elsewhere) TODO list outside of this PR: - [ ] Add a more general `graph_fraction_of_total_variance` to figanos (in progress by Juliette, Ouranosinc/figanos#134) - [ ] Add a function in xscen to prepare the data from a catalog. (Ouranosinc/xscen#289) In this function, I could rename the dimension to fit what the partition vocabulary (`model`, `scenario`, `downscaling`) OR we could change the partition vocab to the catalog/xscen vocab (`source`, `experiment`, `bias_adjust_project`). Option 2 is my personal preference, but that would be a breaking change for `hawkins_sutton`.
…ract # Conflicts: # docs/notebooks/4_ensembles.ipynb
for more information, see https://pre-commit.ci
I don't understand what's going on. In commit, 2ece1d7 everything passed. I removed inconsequential lines andt the RTD build keeps failing. (I can run the notebook no problem on our servers). I have tried to rebuild the rtd a few times. In these different builds (without changing anything), the error is not always the same. Either the datasets doesn't load with a HDF5 error or it loads an empty dataset and fail when the function tries to subset (
|
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.
Pas assez familier avec xscen pour faire une révision en profondeur, mais ça me semble bon.
docs/notebooks/4_ensembles.ipynb
Outdated
"metadata": {}, | ||
"source": [ | ||
"## Ensemble partition\n", | ||
"This tutorial will show how to use the xscen to create the input for [xclim partition functions](https://xclim.readthedocs.io/en/stable/api.html#uncertainty-partitioning)." |
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.
"This tutorial will show how to use the xscen to create the input for [xclim partition functions](https://xclim.readthedocs.io/en/stable/api.html#uncertainty-partitioning)." | |
"This tutorial will show how to use xscen to create the input for [xclim partition functions](https://xclim.readthedocs.io/en/stable/api.html#uncertainty-partitioning)." |
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.
LGTM! One thing that is not currently supported (but it's maybe not an issue) is regional models. If you want to delve into that, you could look at:
Line 374 in ce54df8
for k in info: |
The idea is to look at driving_model
instead of source
, and fill that entry with source
in the case of global models.
docs/notebooks/4_ensembles.ipynb
Outdated
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The function searches the catalog with `search_kw` and creates a dataset with new dimensions in `partition_dim`(`[\"source\", \"experiment\", \"bias_adjust_project\"]`). \n", |
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.
This will need to be edited, since it still relates to the previous behaviour.
I don't think this is necessary for now. I will do another PR if that changes. |
Pull Request Checklist:
number
) and pull request (:pull:number
) has been added.What kind of change does this PR introduce?
xs.ensembles.get_partition_input
to prepare data from catalog to be passed to xclim partionning functions (https://xclim.readthedocs.io/en/stable/api.html#uncertainty-partitioning)processing_level= partition
to be able to put it in a a catalog.workflow 1:
xs.get_partition_input
->xc.ensembles.lafferty_sriver
->fg.partition
workflow 2:
xs.partition
(which gets the input and wraps xclim) -> maybe save to disk and catalog ->fg.partition
or other plots (maybe maps of one component)EDIT: I went with workflow 1
Does this PR introduce a breaking change?
no
Other information:
extract.py
(because we extract from a cat) or inensembles.py
( to match the xclim module).