Skip to content
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 support for new processes and methods added in v3.8 #335

Merged
merged 6 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions ravenpy/config/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@
"TFSNOW",
"RELATIVE_HT",
"RELATIVE_LAI",
"CAP_LAI_RATIO",
"SNOCAP_LAI_RATIO",
]


Expand Down Expand Up @@ -276,6 +278,7 @@ class EvaluationMetrics(Enum):
RCOEFF = "RCOEFF"
NSC = "NSC"
KLING_GUPTA = "KLING_GUPTA"
DIAG_SPEARMAN = "DIAG_SPEARMAN"


evaluation_metrics_multiplier = dict(
Expand All @@ -290,6 +293,7 @@ class EvaluationMetrics(Enum):
RCOEFF=-1,
NSC=1,
KLING_GUPTA=1,
DIAG_SPEARMAN=1,
)


Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions ravenpy/config/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ class SoilEvaporation(Process):
"SOILEVAP_ALL",
"SOILEVAP_LINEAR",
"SOILEVAP_SACSMA",
"SOILEVAP_HYMOD2",
]


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"]

Expand Down
8 changes: 8 additions & 0 deletions ravenpy/config/rvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
Loading