From 0b112677da07d64756d0ed0a154ca6276f063832 Mon Sep 17 00:00:00 2001 From: lou-a Date: Wed, 2 Oct 2024 13:04:42 -0400 Subject: [PATCH] Updated the change log, added contributor information and included tests Added a note in the CHANGELOG.rst, added contributor information in the .zenodo.json and in the AUTHORS.rst files, and added tests in the test_extractor.py script to confirm that everything is working as I expect. --- .zenodo.json | 7 ++++++- AUTHORS.rst | 2 +- CHANGELOG.rst | 1 + tests/test_extractor.py | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 326f0641..29b8093c 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -24,7 +24,12 @@ "name": "Arsenault, Richard", "affiliation": "École de technologie supérieure", "orcid": "0000-0003-2834-2750" - } + }, + { + "name": "Arnal, Louise", + "affiliation": "Ouranos", + "orcid": "0000-0002-0208-2324" + }, ], "keywords": [ "climate change", diff --git a/AUTHORS.rst b/AUTHORS.rst index c46ee369..e996529c 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -18,4 +18,4 @@ Co-Developers Contributors ------------ -None yet. Why not be the first? +* Louise Arnal `@lou-a `_ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 94a0a02d..35a0cf83 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,7 @@ Internal changes * `ravenpy` now has a `CODE_OF_CONDUCT.md` file. * 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). (PR #401) v0.15.0 (2024-06-20) -------------------- diff --git a/tests/test_extractor.py b/tests/test_extractor.py index f1411d0f..db66da1f 100644 --- a/tests/test_extractor.py +++ b/tests/test_extractor.py @@ -15,7 +15,21 @@ def test_basinmaker_extractor(get_local_testdata, tmp_path): routing_product_version="2.1", ) rvh_config = rvh_extractor.extract(hru_from_sb=True) + + # Create lists of values to check + bedslope_list = [item['bed_slope'] for item in rvh_config["channel_profile"]] + mannings_list = [value for d in rvh_config["channel_profile"] for value in [t[1] for t in d['roughness_zones']]] + reach_length_list = [item['reach_length'] for item in rvh_config["sub_basins"]] + rvh_config.pop("channel_profile") config = BasicRoute(**rvh_config) config.write_rv(tmp_path, modelname="routing") + + # Checks that the bedslope, Manning and reach length values are non negative numbers + assert all(isinstance(x, (int, float)) for x in bedslope_list) is True + assert any(x < 0 for x in bedslope_list) is False + assert all(isinstance(y, (int, float)) for y in mannings_list) is True + assert any(y < 0 for y in mannings_list) is False + assert all(isinstance(z, (int, float)) for z in bedslope_list) is True + assert any(z < 0 for z in reach_length_list) is False