Skip to content

Commit

Permalink
vertical flow averades instead of accumulated
Browse files Browse the repository at this point in the history
  • Loading branch information
vgro committed Dec 6, 2023
1 parent 235815d commit ea90efc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/models/hydrology/test_hydrology_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]},
)
Expand Down
4 changes: 2 additions & 2 deletions virtual_rainforest/models/hydrology/below_ground.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions virtual_rainforest/models/hydrology/hydrology_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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},
)
Expand Down

0 comments on commit ea90efc

Please sign in to comment.