From c150f1a757d4aa34c7506a9d1069437777912c6a Mon Sep 17 00:00:00 2001 From: David Huard Date: Fri, 8 Mar 2024 14:03:46 -0500 Subject: [PATCH] add support for new processes and methods added in v3.8 (#335) Co-authored-by: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com> --- HISTORY.rst | 2 ++ ravenpy/config/options.py | 17 +++++++++++++++++ ravenpy/config/processes.py | 5 +++++ ravenpy/config/rvs.py | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 40003a14..f29caa98 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -4,6 +4,7 @@ History 0.14.0 (2024--soon) ------------------- +* Add support for new processes and methods added in Raven v3.8. * Added support for Python 3.12 and dropped support for Python3.8. * Upgraded `raven-hydro` to v0.3.0 and `RavenHydroFramework` to v3.8. * `ravenpy` now requires `xclim` >= v0.48.2, `xarray` >= v2023.11.0, and `pandas` >= 2.2.0. @@ -27,6 +28,7 @@ Internal changes * Fix notebook execution. (PR #329) * Refactor and simplify testing data fetching. (PR #332) + Breaking changes ^^^^^^^^^^^^^^^^ * Update to `pydantic` v2.0. (PR #326) diff --git a/ravenpy/config/options.py b/ravenpy/config/options.py index 3b4bd963..ceca1dc1 100644 --- a/ravenpy/config/options.py +++ b/ravenpy/config/options.py @@ -223,6 +223,8 @@ "TFSNOW", "RELATIVE_HT", "RELATIVE_LAI", + "CAP_LAI_RATIO", + "SNOCAP_LAI_RATIO", ] @@ -276,6 +278,7 @@ class EvaluationMetrics(Enum): RCOEFF = "RCOEFF" NSC = "NSC" KLING_GUPTA = "KLING_GUPTA" + DIAG_SPEARMAN = "DIAG_SPEARMAN" evaluation_metrics_multiplier = dict( @@ -290,6 +293,7 @@ class EvaluationMetrics(Enum): RCOEFF=-1, NSC=1, KLING_GUPTA=1, + DIAG_SPEARMAN=1, ) @@ -308,6 +312,15 @@ class Evaporation(Enum): MONTHLY_FACTOR = "PET_MONTHLY_FACTOR" MOHYSE = "PET_MOHYSE" OUDIN = "PET_OUDIN" + VAP_DEFICIT = "PET_VAPDEFICIT" + + +class LWIncomingMethod(Enum): + DATA = "LW_INC_DATA" + DEFAULT = "LW_INC_DEFAULT" + SICART = "LW_INC_SICART" + SKYVIEW = "LW_INC_SKYVIEW" + DINGMAN = "LW_INC_DINGMAN" class LWRadiationMethod(Enum): @@ -379,12 +392,16 @@ class RainSnowFraction(Enum): HBV = "RAINSNOW_HBV" HARDER = "RAINSNOW_HARDER" HSPF = "RAINSNOW_HSPF" + WANG = "RAINSNOW_WANG" + SNTHERM89 = "RAINSNOW_SNTHERM89" class RelativeHumidityMethod(Enum): CONSTANT = "RELHUM_CONSTANT" DATA = "RELHUM_DATA" MINDEWPT = "RELHUM_MINDEWPT" + CORR = "RELHUM_CORR" + WINDVEL = "WINDVEL_CORR" class Routing(Enum): diff --git a/ravenpy/config/processes.py b/ravenpy/config/processes.py index 8876db2b..c7d8e96a 100644 --- a/ravenpy/config/processes.py +++ b/ravenpy/config/processes.py @@ -50,6 +50,7 @@ class SoilEvaporation(Process): "SOILEVAP_ALL", "SOILEVAP_LINEAR", "SOILEVAP_SACSMA", + "SOILEVAP_HYMOD2", ] @@ -57,6 +58,10 @@ class LakeEvaporation(Process): algo: Literal["LAKE_EVAP_BASIC"] +class LakeFreeze(Process): + algo: Literal["LFREEZE_BASIC", "LFREEZE_THERMAL"] + + class OpenWaterEvaporation(Process): algo: Literal["OPEN_WATER_EVAP", "OPEN_WATER_RIPARIAN"] diff --git a/ravenpy/config/rvs.py b/ravenpy/config/rvs.py index 9478b520..0e8d1ef3 100644 --- a/ravenpy/config/rvs.py +++ b/ravenpy/config/rvs.py @@ -66,6 +66,10 @@ class RVI(RV): alias="MonthlyInterpolationMethod" ) soil_model: Optional[rc.SoilModel] = optfield(alias="SoilModel") + temperature_correction: Optional[bool] = optfield( + alias="TemperatureCorrection", + description="Gridded or gauged temperature bias correction.", + ) lake_storage: Optional[o.StateVariables] = optfield(alias="LakeStorage") define_hru_groups: Optional[Sequence[str]] = optfield(alias="DefineHRUGroups") @@ -108,6 +112,10 @@ class RVI(RV): write_subbasin_file: Optional[bool] = optfield( alias="WriteSubbasinFile" ) # Undocumented + write_local_flows: Optional[bool] = optfield( + alias="WriteLocalFlows", + description="Write local contribution to hydrograph in hydrograph.csv", + ) @field_validator("soil_model", mode="before") @classmethod