Skip to content

Commit

Permalink
updated changelog; added test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoostBuitink committed Feb 8, 2024
1 parent f68d009 commit 8675b68
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Fixed
- **setup_config_output_timeseries**: bugfix for reducer.
- update hydromt configuration files from ini to yml format. PR #230
- remove or update calls to check if source in self.data_catalog `Issue #501 <https://github.com/Deltares/hydromt/issues/501>`_
- Included NoDataStrategy from hydromt-core: setup functions for lakes, reservoirs, glaciers, and gauges are skipped when no data is found withing the model region (same behavior as before) PR #229

Deprecated
----------
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""add global fixtures."""

import logging
import platform
from os.path import abspath, dirname, join
Expand Down Expand Up @@ -72,7 +73,7 @@ def example_wflow_results():
@pytest.fixture()
def clipped_wflow_model():
root = join(EXAMPLEDIR, "wflow_piave_clip")
mod = WflowModel(root=root, mode="r")
mod = WflowModel(root=root, mode="r", data_libs="artifact_data")
return mod


Expand Down
15 changes: 15 additions & 0 deletions tests/test_model_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,18 @@ def test_setup_floodplains_2d(elevtn_map, example_wflow_model, floodplain1d_test
.raster.mask_nodata()
.equals(floodplain1d_testdata[f"{mapname}_D4"])
)


def test_skip_nodata_reservoir(clipped_wflow_model):
# Using the clipped_wflow_model as the reservoirs are not in this model
clipped_wflow_model.setup_reservoirs(
reservoirs_fn="hydro_reservoirs",
min_area=0.0,
)
assert clipped_wflow_model.config["model"]["reservoirs"] == False
# Get names for two reservoir layers
for mapname in ["resareas", "reslocs"]:
# Check if layers are indeed not present in the model
assert (
clipped_wflow_model._MAPS[mapname] not in clipped_wflow_model.grid.data_vars
)

0 comments on commit 8675b68

Please sign in to comment.