-
Notifications
You must be signed in to change notification settings - Fork 32
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
Enh/threshold metadata #189
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2d8a841
to
c59d370
Compare
09f2e7c
to
3baf929
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
5b6c7a8
to
9b4498f
Compare
9b4498f
to
052881d
Compare
- We can now compute a CDD or a heatwave We still can't compute CWD (`tn<{t1}` and `pr>{t2}`) though - when in_files is a dictionary, threshold can now be used the same way as `threshold` of `icclim.index`.
- Add registry class - remove ::compute from Indicator class (replaced by plain _call_ method) - turn IndexConfig into a dataclass - Make Threshold constructor handle percentile computation - Divide ClimateVar creation in two separate processes 1. When in_files is a dictionary 2. When in_files is a readable content directly (nc, zarr, da, ds) - BREAKING CHANGE: when in_files is a dict, renamed per_var_name to threshold_var_name
- `threshold` now works with strings thresholds It's either a threshold with unit (e.g. "22 degC") or doy percentiles (e.g. "75 doy_per") or period percentiles (e.g. "75 period_per") - `threshold` works with a combination such as ["1mm", "75 doy_per"] - Refactored read_climate_vars to always create a dictionary from the `var_names`
LogicalLink is not (yet?) part of icclim::index API.
coef is not part of icclim::index API, it can only be computed with a user_index.
date_event is now part of icclim::index API. It can be used on `maximum`, `minimum`, `max_of_rolling_average`, `max_of_rolling_sum`,`min_of_rolling_average`,`min_of_rolling_sum`.
I forgot to add it to count_occurrences (the first and last date of the occurrences, per sampling) and to max_consecutive_occurrence (start and end date of the spell). Also clean up dead code from user index.
cfd0d4c
to
cb76220
Compare
This unit can be used with either `count_occurrences` or `fraction_of_total`. For ECAD indices, '%' is the default unit of rxxpTOT index family (as per specified in ATBD v11). Also fix some minor issues with date_event (explicit use of lat and lon dims).
For the Tier 1 and 2 variable, we should probably script the instantiation of StandardVariable. refs: - https://docs.google.com/spreadsheets/d/1qUauozwXkq7r1g-L4ALMIkCNINIhhCPx/edit#gid=1658589926 - https://www.wcrp-climate.org/wgcm-cmip/wgcm-cmip6 - https://cfconventions.org/Data/cf-standard-names/current/build/cf-standard-name-table.html
`::_guess_dataset_var_names` is capable of handling None standard_index. No need to raise an error.
They were unit tests and are now integration tests.
It was computing **min** instead of max.
Big bad commit of the day that refactor quite a few things following unit test update. - enh: Split `window_width` into 3 distinct parameter. - maint: renamed is_single_var into is_compared_to_reference for readability. - enh: Add `to_percent` to difference_of_means (aka anomaly). - enh: Improve metadata for unknown varaibles - fix: When adding a variable with `must_add_reference_var`, if time_range exist now it works. - maint: Simplified `must_add_reference_var` as `climate_vars_dict` is always a dictionary - enh: Improve input parsing for when the input is a list of mixed type (e.g. path to nc + a DataArray) - maint: update most tests to use generic indicator - maint: some more boring refactoring - maint: Add release notes
- Added `sampling_method` parameter to control the behavior of `slice_mode`. For now this is implemented only for `difference_of_means`.
Yipiti youpi, this pull request is now ready! |
Before merge:
|
Some indices were not using the expected operator. ">=" was used instead of ">" Plus the registry ::list was broken
It was broken when using the new groupby+resample sampling_method.
- Removed `identifier` from generic indicator in favor of `name`, which is **not** templated. - Fixed bootstrapped computation that could not run if "percentiles" was not in coords (because it was renamed) - Fixed some warnings
This was referenced Sep 2, 2022
It should fix gh #73.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request to resolve #183
doc/source/references/release_notes.rst
.Describe the changes you made
threshold
parameter now properly update the index name and title in the output.The generic indices include:
CountOccurrences
for SU, TR, TG90p, TN90p, TX90p, FD, ID, TG10p, TN10p, TX10p, RR1, R10mm, R20mm, R75p, R95p, R99p, SD1, SD5cm, SD50cm, CD, CW, WD, WW
MaxConsecutiveOccurrence
for CSU, CFD, CDD, CWD
SumOfSpellLengths
WSDI, CSDI
Excess
GD4
Deficit
HD17
FractionOfTotal
R75pTOT, R95pTOT, r99pTOT
MeanOfDifference
DTR
DifferenceOfExtremes
ETR
MeanOfAbsoluteOneTimeStepDifference
vDTR
Maximum
RX1day, TXx, TNx, user_index - maximum
Minimum
TXn, TNn, user_index - minimum
Average
TG, TN, TX, SDII, SD, user_index - mean
Sum
PRCPTOT, user_index - sum
StandardDeviation
new
MaxOfRollingSum
RX5day, user_index - rolling_sum on extreme_mode=max
MinOfRollingSum
user_index - rolling_sum on extreme_mode=min
MaxOfRollingAverage
user_index - rolling_average on extreme_mode=max
MinOfRollingAverage
user_index - rolling_average on extreme_mode=min
DifferenceOfMeans
user_index - anomaly
Every generic function is configurable.
Those that depend on a threshold benefit from the Threshold class to allow to pass doy percentiles, period percentiles, per grid cells, scalar with unit and unit less scalar as a valid thresholds.
A few examples (syntax may change):
Results of
icclim.index
are Dataset (or netcdf) with rich metadata including identifier, standard_name, long_name, description, cell_methods, short_name.Example for su33 computed above:
(note that standard_name should be changed to something more CF friendly).