diff --git a/.cruft.json b/.cruft.json index 57a97dbb..11c95c88 100644 --- a/.cruft.json +++ b/.cruft.json @@ -10,7 +10,7 @@ "project_slug": "ravenpy", "project_short_description": "A Python wrapper to setup and run the hydrologic modelling framework Raven.", "pypi_username": "CSHS-CWRA", - "version": "0.15.1-dev.1", + "version": "0.15.1-dev.2", "use_pytest": "y", "use_black": "y", "use_conda": "y", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index abbc21d5..8fda29da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: pyupgrade args: [ '--py39-plus' ] - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -42,7 +42,7 @@ repos: hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.9 hooks: - id: ruff args: [ '--fix' ] @@ -86,7 +86,7 @@ repos: - id: numpydoc-validation exclude: ^docs/|^tests/ - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.2 + rev: 0.29.3 hooks: - id: check-github-workflows - id: check-readthedocs diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ab763786..1a9ca3a6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,7 @@ Internal changes * Many `numpydoc`-style docstrings have been adjusted for consistency. * Added `setuptools` to the `gis` build recipe to ensure that the `gdal` bindings are built successfully. (PR #400) * Modified the sub-basin and channel profile extraction functions to correctly set the river length to zero and set default values for reach attributes in sub-basins with no channel routing (i.e., sub-basins with lakes or headwater basins). (issue #354, PR #401) +* Improved the HBV-EC emulator by adding parameter information (name, definition, and Raven default values) and fixed the variable name for the adiabatic temperature lapse rate. (PR #404) v0.15.0 (2024-06-20) -------------------- diff --git a/docs/notebooks/10_Data_assimilation.ipynb b/docs/notebooks/10_Data_assimilation.ipynb index 51ab3865..1728f9d9 100644 --- a/docs/notebooks/10_Data_assimilation.ipynb +++ b/docs/notebooks/10_Data_assimilation.ipynb @@ -156,14 +156,7 @@ " adj=\"MULTIPLICATIVE\",\n", " ),\n", " rc.ForcingPerturbation(\n", - " forcing=\"TEMP_MAX\",\n", - " dist=\"DIST_NORMAL\",\n", - " p1=0.0,\n", - " p2=2.0,\n", - " adj=\"ADDITIVE\",\n", - " ),\n", - " rc.ForcingPerturbation(\n", - " forcing=\"TEMP_MIN\",\n", + " forcing=\"TEMP_AVE\",\n", " dist=\"DIST_NORMAL\",\n", " p1=0.0,\n", " p2=2.0,\n", @@ -456,7 +449,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.12.5" } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index bca5e43d..c98480c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,7 +166,7 @@ target-version = [ ] [tool.bumpversion] -current_version = "0.15.1-dev.1" +current_version = "0.15.1-dev.2" commit = true commit_args = "--no-verify" tag = false diff --git a/src/ravenpy/__init__.py b/src/ravenpy/__init__.py index de96c42c..54797a38 100644 --- a/src/ravenpy/__init__.py +++ b/src/ravenpy/__init__.py @@ -30,4 +30,4 @@ __author__ = """David Huard""" __email__ = "huard.david@ouranos.ca" -__version__ = "0.15.1-dev.1" +__version__ = "0.15.1-dev.2" diff --git a/src/ravenpy/config/emulators/hbvec.py b/src/ravenpy/config/emulators/hbvec.py index 2a306141..d1b4d98f 100644 --- a/src/ravenpy/config/emulators/hbvec.py +++ b/src/ravenpy/config/emulators/hbvec.py @@ -17,27 +17,69 @@ @dataclass(config=SymConfig) class P(Params): - X01: Sym = Variable("X01") - X02: Sym = Variable("X02") - X03: Sym = Variable("X03") - X04: Sym = Variable("X04") - X05: Sym = Variable("X05") - X06: Sym = Variable("X06") - X07: Sym = Variable("X07") - X08: Sym = Variable("X08") - X09: Sym = Variable("X09") - X10: Sym = Variable("X10") - X11: Sym = Variable("X11") - X12: Sym = Variable("X12") - X13: Sym = Variable("X13") - X14: Sym = Variable("X14") - X15: Sym = Variable("X15") - X16: Sym = Variable("X16") - X17: Sym = Variable("X17") - X18: Sym = Variable("X18") - X19: Sym = Variable("X19") - X20: Sym = Variable("X20") - X21: Sym = Variable("X21") + X01: Sym = Variable( + "X01" + ) # RAINSNOW_TEMP | rain/snow halfway transition temperature [◦C] | default=-0.15, min=-3.0, max=3.0 + X02: Sym = Variable( + "X02" + ) # MELT_FACTOR | maximum snow melt factor used in degree day models [mm/d/◦C] | default=5.04, min=-9999, max=-9999 + X03: Sym = Variable( + "X03" + ) # REFREEZE_FACTOR | maximum refreeze factor used in degree day models [mm/d/◦C] | default=5.04, min=0.0, max=10.0 + X04: Sym = Variable( + "X04" + ) # SNOW_SWI | water saturation fraction of snow [-] | default=0.05, min=0.0, max=0.5 + X05: Sym = Variable( + "X05" + ) # POROSITY | effective porosity of the soil [-] | default=0.4, min=0.0, max=1.0 + X06: Sym = Variable( + "X06" + ) # FIELD_CAPACITY | field capacity saturation of the soil [-] | default=0.0, min=0.0, max=1.0 + X07: Sym = Variable( + "X07" + ) # HBV_BETA | HBV infiltration exponent [-] | default=1, min=-9999, max=-9999 + X08: Sym = Variable( + "X08" + ) # MAX_PERC_RATE | VIC/ARNO/GAWSER percolation rate [mm/d] | default=-9999, min=-9999, max=-9999 + X09: Sym = Variable( + "X09" + ) # BASEFLOW_COEFF | linear baseflow storage/routing coeff (FAST_RES) [1/d] | default=0.1, min=0.0, max=9999 + X10: Sym = Variable( + "X10" + ) # BASEFLOW_COEFF | linear baseflow storage/routing coeff (SLOW_RES) [1/d] | default=0.1, min=0.0, max=9999 + X11: Sym = Variable( + "X11" + ) # TIME_CONC | the time of concentration of the unit hydrograph [d] | default=1, min=0, max=200 + X12: Sym = Variable( + "X12" + ) # PRECIP_LAPSE | precipitation lapse rate for orographic correction [mm/d/km] | default=-9999, min=0.0, max=-9999 + X13: Sym = Variable( + "X13" + ) # ADIABATIC_LAPSE | adiabatic temperature lapse rate [◦C/km] | default=6.4, min=5, max=8 + X14: Sym = Variable( + "X14" + ) # SAT_WILT | hydroscopic minimum saturation [-] | default=0.0, min=0.0, max=1.0 + X15: Sym = Variable( + "X15" + ) # BASEFLOW_N | VIC/ARNO baseflow exponent [-] | default=5, min=-9999, max=-9999 + X16: Sym = Variable( + "X16" + ) # MAX_CAP_RISE_RATE | HBV max capillary rise rate [mm/d] | default=0, min=-9999, max=-9999 + X17: Sym = Variable( + "X17" + ) # TOPSOIL THICKNESS | soil layer thickness (TOPSOIL) [m] | + X18: Sym = Variable( + "X18" + ) # HBV_MELT_FOR_CORR | HBV snowmelt forest correction (MRF in HBV-EC) [-] | default=1, min=-9999, max=9999 + X19: Sym = Variable( + "X19" + ) # GLAC_STORAGE_COEFF | maximum linear storage coefficient for glacial melt [-] | default=0.1, min=0, max=1 + X20: Sym = Variable( + "X20" + ) # RAIN_CORR | rain correction factor for subbasin (multiplier) [-] | default=1.0, min=0.5, max=2.0 + X21: Sym = Variable( + "X21" + ) # SNOW_CORR | snow correction factor for subbasin (multiplier) [-] | default=1.0, min=0.5, max=2.0 class LandHRU(HRU): @@ -161,7 +203,7 @@ class HBVEC(Config): ) global_parameter: dict = Field( { - "AdiabaticLapse": P.X13, + "ADIABATIC_LAPSE": P.X13, "SNOW_SWI": P.X04, "PRECIP_LAPSE": P.X12, }, diff --git a/tests/test_ravenpy.py b/tests/test_ravenpy.py index 42bf215f..ed92b333 100644 --- a/tests/test_ravenpy.py +++ b/tests/test_ravenpy.py @@ -43,4 +43,4 @@ def test_package_metadata(): contents = f.read() assert """David Huard""" in contents assert '__email__ = "huard.david@ouranos.ca"' in contents - assert '__version__ = "0.15.1-dev.1"' in contents + assert '__version__ = "0.15.1-dev.2"' in contents