Skip to content

Commit

Permalink
add support for new processes and methods added in v3.8 (#335)
Browse files Browse the repository at this point in the history
Co-authored-by: Trevor James Smith <[email protected]>
  • Loading branch information
huard and Zeitsperre authored Mar 8, 2024
1 parent dc39bf7 commit c150f1a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
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

0 comments on commit c150f1a

Please sign in to comment.