-
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
Climatological op #290
Climatological op #290
Conversation
… and stride (formerly 'interval')
…matologicalMean adjusted to reflect minor changes in long_name, description, history
…me to output; all tests pass
…tors_for_available_vars Branch is behind main.
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
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.
it will be great to have all those options ! thanks!
### Pull Request Checklist: - [ ] This PR addresses an already opened issue (for bug fixes / features) - This PR fixes #xyz - [ ] (If applicable) Documentation has been added / updated (for bug fixes / features). - [x] (If applicable) Tests have been added. - [x] This PR does not seem to break the templates. - [x] CHANGES.rst has been updated (with summary of main changes). - [x] Link to pull request (:pull:`number`) has been added. ### What kind of change does this PR introduce? Adds the function `xscen.indicators.select_inds_for_avail_vars` to filter the indicators that can be calculated with the variables available in a `xarray.Dataset`. ### Does this PR introduce a breaking change? No. ### Other information:
…climatological_op
…n produce_horizon
…s.utils.unstack_dates working
…climatological_op
…omment in test_aggregate.py
…climatological_op
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! This will be a great addition.
"- The `cat:frequency` and `cat:xrfreq` attributes remain unchanged.\n", | ||
"\n", | ||
"\n", | ||
"Alternatively, setting the `horizons_as_dim` argument to *True* will rearrange the dataset with a new dimension `period` and a dimension named according to the temporal aggregation (`year`, `season` or `month`). The time stamps are conserved in the `time` coordinate as an array with those two new dimensions." |
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.
"Alternatively, setting the `horizons_as_dim` argument to *True* will rearrange the dataset with a new dimension `period` and a dimension named according to the temporal aggregation (`year`, `season` or `month`). The time stamps are conserved in the `time` coordinate as an array with those two new dimensions." | |
"Alternatively, setting the `horizons_as_dim` argument to *True* will rearrange the dataset with a new dimension `horizon` and a dimension named according to the temporal aggregation (`year`, `season` or `month`). The time stamps are conserved in the `time` coordinate as an array with those two new dimensions." |
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.
and a dimension named according to the temporal aggregation (
year,
seasonor
month)
If year
has been removed, it would need to be removed here too.
xscen/aggregate.py
Outdated
else: | ||
op_kwargs = { | ||
"keep_attrs": True | ||
} # ToDo: Is there a global setting in xscen so we don't need this? |
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 think that calling with xr.set_options(keep_attrs=True):
would work in a workflow.
This is something we discussed a while ago, and having a blanket statement for keep_attrs=True
would probably not be advised. It's better to do it as needed, such as here.
} # ToDo: Is there a global setting in xscen so we don't need this? | |
} |
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.
great!
Pull Request Checklist:
number
) and pull request (:pull:number
) has been added.What kind of change does this PR introduce?
xscen.aggregate.climatological_mean is replaced by xscen.aggregate.climatological_op.
climatological_op permits to apply operations ('op') other than 'mean' to the input dataset.
operations implemented: ['max', 'mean', 'median', 'min', 'std', 'sum', 'var', 'linregress']
other additions:
Modifiede the "Getting Started" notebook to use climatological_op with option 'mean'.
Does this PR introduce a breaking change?
No, climatological_mean is retained and calls climatological_op.
Tests for climatological_mean were adjusted for minor changes in attribute values.
Other information:
Uses a wrapper for scipy.stats.linregress for trend calculation with xarray.