From ea90efc294d180902ed238d968506cdd732aa027 Mon Sep 17 00:00:00 2001 From: vgro Date: Wed, 6 Dec 2023 16:15:08 +0000 Subject: [PATCH] vertical flow averades instead of accumulated --- tests/models/hydrology/test_hydrology_model.py | 2 +- virtual_rainforest/models/hydrology/below_ground.py | 4 ++-- virtual_rainforest/models/hydrology/hydrology_model.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/models/hydrology/test_hydrology_model.py b/tests/models/hydrology/test_hydrology_model.py index 7b09dbd48..f8470caec 100644 --- a/tests/models/hydrology/test_hydrology_model.py +++ b/tests/models/hydrology/test_hydrology_model.py @@ -402,7 +402,7 @@ def test_setup( coords={"cell_id": [0, 1, 2]}, ) exp_vertical_flow = DataArray( - [62.72513, 62.87226, 62.71498], + [1.04541883, 1.04787099, 1.04524967], dims=["cell_id"], coords={"cell_id": [0, 1, 2]}, ) diff --git a/virtual_rainforest/models/hydrology/below_ground.py b/virtual_rainforest/models/hydrology/below_ground.py index a535620e5..011364034 100644 --- a/virtual_rainforest/models/hydrology/below_ground.py +++ b/virtual_rainforest/models/hydrology/below_ground.py @@ -20,7 +20,7 @@ def calculate_vertical_flow( groundwater_capacity: Union[float, NDArray[np.float32]], seconds_to_day: float, ) -> NDArray[np.float32]: - r"""Calculate vertical water flow through soil column. + r"""Calculate vertical water flow through soil column, [mm d-1]. To calculate the flow of water through unsaturated soil, this function uses the Richards equation. First, the function calculates the effective saturation :math:`S` @@ -65,7 +65,7 @@ def calculate_vertical_flow( seconds_to_day: factor to convert between second and day Returns: - volumetric flow rate of water, [mm/timestep] + volumetric flow rate of water, [mm d-1] """ shape_parameter = 1 - 1 / nonlinearily_parameter diff --git a/virtual_rainforest/models/hydrology/hydrology_model.py b/virtual_rainforest/models/hydrology/hydrology_model.py index 14c1b4ca2..cdae8b5a8 100644 --- a/virtual_rainforest/models/hydrology/hydrology_model.py +++ b/virtual_rainforest/models/hydrology/hydrology_model.py @@ -307,7 +307,7 @@ def update(self, time_index: int, **kwargs: Any) -> None: * surface_runoff, [mm], equivalent to SPLASH runoff * surface_runoff_accumulated, [mm] * soil_evaporation, [mm] - * vertical_flow, [mm/timestep] + * vertical_flow, [mm d-1] * groundwater_storage, [mm] * subsurface_flow, [mm] * baseflow, [mm] @@ -348,7 +348,7 @@ def update(self, time_index: int, **kwargs: Any) -> None: Vertical flow between soil layers is calculated using the Richards equation, see :func:`~virtual_rainforest.models.hydrology.below_ground.calculate_vertical_flow` - . That function returns total vertical flow in mm. Note that there are + . That function returns mean vertical flow in mm per day. Note that there are severe limitations to this approach on the temporal and spatial scale of this model and this can only be treated as a very rough approximation! @@ -500,7 +500,7 @@ def update(self, time_index: int, **kwargs: Any) -> None: ) ) - # Calculate vertical flow between soil layers in mm per time step + # Calculate vertical flow between soil layers in mm per day # Note that there are severe limitations to this approach on the temporal # spatial scale of this model and this can only be treated as a very rough # approximation to discuss nutrient leaching. @@ -590,7 +590,7 @@ def update(self, time_index: int, **kwargs: Any) -> None: ) soil_hydrology["vertical_flow"] = DataArray( - np.sum(daily_lists["vertical_flow"], axis=(0, 1)), + np.mean(daily_lists["vertical_flow"], axis=(0, 1)), dims="cell_id", coords={"cell_id": self.data.grid.cell_id}, )