From dca452d3a01261df360a392743689e237b0ef56b Mon Sep 17 00:00:00 2001 From: veenstrajelmer <60435591+veenstrajelmer@users.noreply.github.com> Date: Fri, 18 Oct 2024 06:10:46 +0200 Subject: [PATCH] fixed typo in setup manholes parameters (#187) * update argument name to be in line with docs and consistent with related namings * included change in notebooks * updated changelog * fixed type declaration --- docs/changelog.rst | 1 + examples/build_1d2dmodel.ipynb | 2 +- examples/build_1dmodel.ipynb | 2 +- examples/dflowfm_build.yml | 2 +- examples/dflowfm_build1d.yml | 2 +- hydromt_delft3dfm/dflowfm.py | 10 +++++----- hydromt_delft3dfm/utils.py | 4 +--- tests/data/dflowfm_build.yml | 2 +- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 05bfeab7..4f89ed0a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,7 @@ Changed ------- - Change default spacing in setup_channels from ``None`` to ``np.inf``. (PR #133) - Added ``maxdist`` variable to setup_rivers and setup_channels. (PR #153) +- Renamed ``manhole_defaults_fn`` to ``manholes_defaults_fn`` in ``setup_manholes`` for consistency. (PR #187) Fixed ----- diff --git a/examples/build_1d2dmodel.ipynb b/examples/build_1d2dmodel.ipynb index 441f7cbb..6c966a19 100644 --- a/examples/build_1d2dmodel.ipynb +++ b/examples/build_1d2dmodel.ipynb @@ -146,7 +146,7 @@ "\n", "- [setup_rivers_from_dem](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_rivers_from_dem.html): We will derive the 1D rivers lines based on the *MERIT Hydro DEM* and that intersects with the region bounding box [12.4331, 46.4661, 12.5212, 46.5369]. River roughness will be a Manning constant of 25.0 and we will use data from *rivers_lin2019* database to prepare rectangular cross-sections. \n", "- [setup_pipes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_pipes.html): We will add pipes by assuming that they are located under the roads, with a standard length of 50 meters. The roads are defined in the *grip_roads* data and the standard length are defined in the argument spacing. Roughness will be a WhiteColeBrook constant of 0.003 and we will use a circular cross-sections of 0.5m. The pipes invert levels will be derived from the *MERIT Hydro DEM* assuming a constant depth of the pipe underground of 2 meters. \n", - "- [setup_manholes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_manholes.html): For a pipe network, manholes are present at pipe connections. Here we do not have specific input data locations for our pipes, so manholes will be generated based on a set of standards specified in manhole_defaults_fn.\n", + "- [setup_manholes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_manholes.html): For a pipe network, manholes are present at pipe connections. Here we do not have specific input data locations for our pipes, so manholes will be generated based on a set of standards specified in manholes_defaults_fn.\n", "- [setup_1dboundary](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_1dboundary.html): Finally as a default, we will apply both upstream and downstream boundaries of our rivers with a constant waterlevel of -2.0 meter a.s.l\n", "\n", "- [setup_mesh2d](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_mesh2d.html): we will prepare a regular grid for the region bounding box [12.4331, 46.4661, 12.5212, 46.5369] of *500***500* meters resolution.\n", diff --git a/examples/build_1dmodel.ipynb b/examples/build_1dmodel.ipynb index 465b9960..b277a024 100644 --- a/examples/build_1dmodel.ipynb +++ b/examples/build_1dmodel.ipynb @@ -143,7 +143,7 @@ "- [global](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.html#hydromt_delft3dfm.DFlowFMModel): Our model will be defined in the projected CRS WGS84 EPSG 3857. TO ensure the 1D network is connected, we will allow snapping of 25 meters using argument network_snap_offset. The 1D computational grid for the open water system will be created at 40 meters distance using argument openwater_computation_node_distance. \n", "- [setup_rivers_from_dem](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_rivers_from_dem.html): We will derive the 1D rivers lines based on the *MERIT Hydro DEM* and that intersects with the region bounding box [12.4331, 46.4661, 12.5212, 46.5369]. River roughness will be a Manning constant of 25.0 and we will use data from *rivers_lin2019* database to prepare rectangular cross-sections. \n", "- [setup_pipes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_pipes.html): We will add pipes by assuming that they are located under the roads, with a standard length of 50 meters. The roads are defined in the *grip_roads* data and the standard length are defined in the argument spacing. Roughness will be a WhiteColeBrook constant of 0.003 and we will use a circular cross-sections of 0.5m. The pipes invert levels will be derived from the *MERIT Hydro DEM* assuming a constant depth of the pipe underground of 2 meters. \n", - "- [setup_manholes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_manholes.html): For a pipe network, manholes are present at pipe connections. Here we do not have specific input data locations for our pipes, so manholes will be generated based on a set of standards specified in manhole_defaults_fn.\n", + "- [setup_manholes](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_manholes.html): For a pipe network, manholes are present at pipe connections. Here we do not have specific input data locations for our pipes, so manholes will be generated based on a set of standards specified in manholes_defaults_fn.\n", "- [setup_1dboundary](https://deltares.github.io/hydromt_delft3dfm/latest/_generated/hydromt_delft3dfm.DFlowFMModel.setup_1dboundary.html): Finally as a default, we will apply both upstream and downstream boundaries of our rivers with a constant waterlevel of -2.0 meter a.s.l\n", "\n", "Feel free to use the links of each components to know more about how each function works and what are all the available settings." diff --git a/examples/dflowfm_build.yml b/examples/dflowfm_build.yml index 73c5a41c..e818f3cd 100644 --- a/examples/dflowfm_build.yml +++ b/examples/dflowfm_build.yml @@ -34,7 +34,7 @@ setup_pipes: setup_manholes: manholes_fn: - manhole_defaults_fn: manholes_defaults + manholes_defaults_fn: manholes_defaults dem_fn: merit_hydro bedlevel_shift: 0.5 diff --git a/examples/dflowfm_build1d.yml b/examples/dflowfm_build1d.yml index 40fca81d..a19e9eec 100644 --- a/examples/dflowfm_build1d.yml +++ b/examples/dflowfm_build1d.yml @@ -34,7 +34,7 @@ setup_pipes: setup_manholes: manholes_fn: - manhole_defaults_fn: manholes_defaults + manholes_defaults_fn: manholes_defaults dem_fn: merit_hydro bedlevel_shift: 0.5 diff --git a/hydromt_delft3dfm/dflowfm.py b/hydromt_delft3dfm/dflowfm.py index c01ff118..dabd90b3 100644 --- a/hydromt_delft3dfm/dflowfm.py +++ b/hydromt_delft3dfm/dflowfm.py @@ -1319,7 +1319,7 @@ def _setup_crosssections( def setup_manholes( self, manholes_fn: str = None, - manhole_defaults_fn: str = "manholes_defaults", + manholes_defaults_fn: str = "manholes_defaults", bedlevel_shift: float = -0.5, dem_fn: str = None, snap_offset: float = 1e-3, @@ -1330,7 +1330,7 @@ def setup_manholes( Can only be used after all branches are setup. The manholes are generated based on a set of standards specified in - ``manhole_defaults_fn`` (default) and can be overwritten with manholes + ``manholes_defaults_fn`` (default) and can be overwritten with manholes read from ``manholes_fn``. Use ``manholes_fn`` to set the manholes from a dataset of point locations. @@ -1339,7 +1339,7 @@ def setup_manholes( Manhole attributes ["area", "streetstoragearea", "storagetype", "streetlevel"] are either taken from ``manholes_fn`` or filled in using defaults in - ``manhole_defaults_fn``. + ``manholes_defaults_fn``. Manhole attribute ["bedlevel"] is always generated from invert levels of the pipe/tunnel network plus a shift defined in ``bedlevel_shift``. This is needed for numerical stability. @@ -1414,7 +1414,7 @@ def setup_manholes( self.set_branches(branches) # add manhole attributes from defaults - defaults = self.data_catalog.get_dataframe(manhole_defaults_fn) + defaults = self.data_catalog.get_dataframe(manholes_defaults_fn) # add defaults manholes = workflows.update_data_columns_attributes(manholes, defaults) @@ -3713,7 +3713,7 @@ def set_mesh( def set_link1d2d( self, - link1d2d: xr.Dataset(), + link1d2d: xr.Dataset, ): """ Add or replace the link1d2d in the model mesh. diff --git a/hydromt_delft3dfm/utils.py b/hydromt_delft3dfm/utils.py index b3cc7a7b..9e820f28 100644 --- a/hydromt_delft3dfm/utils.py +++ b/hydromt_delft3dfm/utils.py @@ -156,9 +156,7 @@ def write_branches_gui( return branchgui_fn -def read_crosssections( - gdf: gpd.GeoDataFrame, fm_model: FMModel -) -> tuple((gpd.GeoDataFrame, gpd.GeoDataFrame)): +def read_crosssections(gdf: gpd.GeoDataFrame, fm_model: FMModel) -> gpd.GeoDataFrame: """ Read crosssections from hydrolib-core crsloc and crsdef objects and add to branches. diff --git a/tests/data/dflowfm_build.yml b/tests/data/dflowfm_build.yml index 24f1972a..4783d98c 100644 --- a/tests/data/dflowfm_build.yml +++ b/tests/data/dflowfm_build.yml @@ -34,7 +34,7 @@ setup_pipes: setup_manholes: manholes_fn: - manhole_defaults_fn: manholes_defaults + manholes_defaults_fn: manholes_defaults dem_fn: merit_hydro bedlevel_shift: 0.5