Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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: 1 addition & 1 deletion AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Contributors
------------

* Louise Arnal <[email protected]> `@lou-a <https://github.com/lou-a>`_
* Pascal Bourgault <[email protected]> `@aulemahal <https://github.com/aulemaha>`_
* Pascal Bourgault <[email protected]> `@aulemahal <https://github.com/aulemahal>`_
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RavenPy |logo|
+----------------------------+-----------------------------------------------------+


A Python wrapper to setup and run the hydrologic modelling framework Raven_.
A Python wrapper for running the hydrologic modelling framework Raven_.
Comment thread
Zeitsperre marked this conversation as resolved.
Outdated

* Free software: MIT license
* Documentation: https://ravenpy.readthedocs.io
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def rebuild_readme():
# the built documents.
#
# The short X.Y version.
version = ravenpy.__version__
version = ravenpy.__version__.split("-")[0]
# The full version, including alpha/beta/rc tags.
release = ravenpy.__version__

Expand Down
2 changes: 1 addition & 1 deletion src/ravenpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""A Python wrapper to setup and run the hydrologic modelling framework Raven."""
"""A Python wrapper for running the hydrologic modelling framework Raven."""

###################################################################################
# MIT License
Expand Down
6 changes: 3 additions & 3 deletions src/ravenpy/cli/aggregate_forcings_to_hrus.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def aggregate_forcings_to_hrus(
command will require.
"""
# NOTE: This is in order to make sphinx-click happy. Magic. Do not touch.
import netCDF4 as nc4 # noqa: N813
import netCDF4
import numpy as np

gws = GridWeights.parse(Path(input_weight_file).read_text())
Expand All @@ -76,7 +76,7 @@ def aggregate_forcings_to_hrus(
weights_data = gws.data

# read NetCDF
nc_in = nc4.Dataset(input_nc_file, "r")
nc_in = netCDF4.Dataset(input_nc_file, "r")

# length of dimensions
nlon = nc_in.dimensions[dim_names[0]].size
Expand Down Expand Up @@ -107,7 +107,7 @@ def aggregate_forcings_to_hrus(
else:
output_nc_file_path = Path(output_nc_file)

nc_out = nc4.Dataset(output_nc_file_path, "w")
nc_out = netCDF4.Dataset(output_nc_file_path, "w")
_ = nc_out.createDimension("time", ntime)
_ = nc_out.createDimension("nHRU", nHRU)

Expand Down
4 changes: 2 additions & 2 deletions src/ravenpy/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def parse_symbolic(value, **kwds):
Note that parsing the output of `model_dump` can cause problems because there is not always enough information in the
dictionary to recreate the correct model.
"""
from pymbolic.mapper.evaluator import EvaluationMapper as EM # noqa: N817
from pymbolic.mapper.evaluator import EvaluationMapper
from pymbolic.primitives import ExpressionNode, Variable

if isinstance(value, dict):
Expand All @@ -337,7 +337,7 @@ def parse_symbolic(value, **kwds):

elif isinstance(value, (Variable, ExpressionNode)):
# Inject numerical values numerical value
return EM(context=kwds)(value)
return EvaluationMapper(context=kwds)(value)

else:
return value
8 changes: 4 additions & 4 deletions src/ravenpy/config/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ class EvaluationPeriod(LineCommand):
"""

name: str
start: dt.date
end: dt.date
start: Union[str, dt.date]
end: Union[str, dt.date]
Comment thread
Zeitsperre marked this conversation as resolved.
Outdated


class CustomOutput(LineCommand):
Expand Down Expand Up @@ -427,8 +427,8 @@ class ChannelProfile(FlatCommand):

name: str = "chn_XXX"
bed_slope: float = 0
survey_points: tuple[tuple[float, float], ...] = ()
roughness_zones: tuple[tuple[float, float], ...] = ()
survey_points: list[tuple[Union[int, float], Union[int, float]]] = ()
roughness_zones: list[tuple[Union[int, float], Union[int, float]]] = ()
Comment thread
Zeitsperre marked this conversation as resolved.
Outdated

def to_rv(self):
template = """
Expand Down
4 changes: 2 additions & 2 deletions src/ravenpy/config/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

def nc_attrs(cls, val):
"""Ensure default netCDF attributes are present."""
# FIXME: assertions should not be found outside of testing code. Replace with conditional logic.
assert "model_id" in val # noqa: S101
if "model_id" not in val:
raise ValueError("The key 'model_id' must be present in the input dictionary.")

out = default_nc_attrs()
out.update(val)
Expand Down
2 changes: 1 addition & 1 deletion src/ravenpy/config/emulators/gr4jcn.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class GR4JCN(Config):
p.Split(
algo="RAVEN_DEFAULT",
source="SOIL[2]",
to=["CONVOLUTION[0]", "CONVOLUTION[1]"],
to=("CONVOLUTION[0]", "CONVOLUTION[1]"),
p=0.9,
),
p.Convolve(algo="CONVOL_GR4J_1", source="CONVOLUTION[0]", to="SOIL[1]"),
Expand Down
Loading