diff --git a/doc/source/references/release_notes.rst b/doc/source/references/release_notes.rst index 1740a9d2..a69d06f7 100644 --- a/doc/source/references/release_notes.rst +++ b/doc/source/references/release_notes.rst @@ -27,6 +27,7 @@ Note: We no longer strictly follow the yaml given by clix-meta. * [enh] Make ``in_file`` accept a dictionary merging together ``var_name`` and ``in_file`` features. * [enh] ``in_file`` dictionary can now be used to pass percentiles thresholds. These thresholds will be used instead of computing them on relevant indices. * [maint/internal] Refactored IndexConfig and moved all the logic to input_parsing. +* [fix] Add auto detection of variables [prAdjust, tasAdjust, tasmaxAdjust, tasminAdjust] 5.2.2 ----- diff --git a/icclim/models/constants.py b/icclim/models/constants.py index 83ca5835..814d759a 100644 --- a/icclim/models/constants.py +++ b/icclim/models/constants.py @@ -17,11 +17,11 @@ IN_BASE_IDENTIFIER = "reference_epoch" # Aliases of input variables names. -# Source: clix-meta -PR = ["pr", "pradjust", "prec", "rr", "precip", "PREC", "Prec", "RR", "PRECIP", "Precip"] -TAS = ["tas", "tavg", "ta", "tasadjust", "tmean", "tm", "tg", "meant", "TMEAN", "Tmean", "TM", "TG", "MEANT", "meanT", "tasmidpoint"] -TAS_MAX = ["tasmax", "tasmaxadjust", "tmax", "tx", "maxt", "TMAX", "Tmax", "TX", "MAXT", "maxT"] -TAS_MIN = ["tasmin", "tasminadjust", "tmin", "tn", "mint", "TMIN", "Tmin", "TN", "MINT", "minT"] +# Source: clix-meta (modified) +PR = ["pr", "pradjust","prAdjust", "prec", "rr", "precip", "PREC", "Prec", "RR", "PRECIP", "Precip"] +TAS = ["tas", "tavg", "ta", "tasadjust","tasAdjust", "tmean", "tm", "tg", "meant", "TMEAN", "Tmean", "TM", "TG", "MEANT", "meanT", "tasmidpoint"] +TAS_MAX = ["tasmax", "tasmaxadjust","tasmaxAdjust", "tmax", "tx", "maxt", "TMAX", "Tmax", "TX", "MAXT", "maxT"] +TAS_MIN = ["tasmin", "tasminadjust","tasminAdjust", "tmin", "tn", "mint", "TMIN", "Tmin", "TN", "MINT", "minT"] # Aliases of input percentiles variables names # Source icclim dev diff --git a/icclim/tests/test_input_parsing.py b/icclim/tests/test_input_parsing.py index 02c6c198..c5067179 100644 --- a/icclim/tests/test_input_parsing.py +++ b/icclim/tests/test_input_parsing.py @@ -270,3 +270,11 @@ def test_guess_variables__from_list(self): res = guess_var_names(ds, var_names=["pinçon"]) # THEN assert res == ["pinçon"] + + def test_guess_variables__from_alias(self): + # GIVEN + ds = xr.Dataset({"tasmaxAdjust": self.tas_da}) + # WHEN + res = guess_var_names(ds, index=EcadIndex.SU.climate_index) + # THEN + assert res == ["tasmaxAdjust"]