Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update wflow build notebook #258

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Setup components
WflowModel.setup_glaciers
WflowModel.setup_lulcmaps
WflowModel.setup_laimaps
WflowModel.setup_ksathorfarc
WflowModel.setup_ksathorfrac
WflowModel.setup_rootzoneclim
WflowModel.setup_soilmaps
WflowModel.setup_outlets
Expand Down Expand Up @@ -101,8 +101,6 @@ General methods
WflowModel.read_grid
WflowModel.write_grid
WflowModel.clip_grid
WflowModel.read_staticmaps_pcr
WflowModel.write_staticmaps_pcr

WflowModel.set_geoms
WflowModel.read_geoms
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Changed

Fixed
-----
- Wrong dtype for wflow_subcatch map. PR #247
- Wrong dtype for wflow_subcatch map. PR #247,
- Removed building a wflow model without a config file in the build notebook.

v0.5.0 (February 2024)
======================
Expand Down
55 changes: 16 additions & 39 deletions examples/build_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,43 +70,6 @@
"!hydromt build --help"
]
},
{
"cell_type": "markdown",
"id": "f286fccb",
"metadata": {},
"source": [
"### Setup Wflow model base layers "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "closed-excerpt",
"metadata": {},
"outputs": [],
"source": [
"# NOTE: copy this line (without !) to your shell for more direct feedback\n",
"# NOTE: as of hydromt version 0.7.0 the region argument is optional and should be preceded by -r or --region\n",
"# NOTE: the resolution argument has been removed since hydromt v0.7.0 and can now only be configured from the configuration file under the setup_basemap header\n",
"!hydromt build wflow \"./wflow_test_base\" -r \"{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}\" -v -d artifact_data"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "cb9d0032",
"metadata": {},
"source": [
"The example above means the following: run **hydromt build** with:\n",
"\n",
"* `wflow` : i.e. build a Wflow model\n",
"* `./wflow_test_base` : output model folder\n",
"* `-r \"{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}\"` : derive a subbasin with its outlet at the given x,y coordinates and within the given bounds [xmin, ymin, xmax, ymax] (WGS84) snapped to a river with minimum stream order (strord) of 4. All *REGION* options are described in the [docs](https://deltares.github.io/hydromt/latest/user_guide/model_region)\n",
"* `-vv` : give some extra verbosity (2 * v) to display feedback on screen. Now debug messages are provided.\n",
"\n",
"NOTE: As we did not specify a model configuration, only the base maps (topography and hydrography) have been setup using default parameters. To build a complete model we need the use a configuraton file."
]
},
{
"cell_type": "markdown",
"id": "ebd31242",
Expand Down Expand Up @@ -176,6 +139,14 @@
"### Setup complete Wflow model "
]
},
{
"cell_type": "markdown",
"id": "a5062c03",
"metadata": {},
"source": [
"Once we have prepared our data catalog and model build settings file, we are ready to ask HydroMT to build our Wflow model. Building the model can be done from the command line. Down below is an example for the Northern part of the Piave basin in Italy:"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -194,8 +165,14 @@
"id": "b31e92d2",
"metadata": {},
"source": [
"With this example we build a complete Wflow model including forcing. Compared to the previous **hydromt build** we have added:\n",
"* `-i wflow_build.yml` : setup configuration file including all components to build and their arguments"
"With this example we build a complete Wflow model including forcing. The example means the following: run **hydromt build** with:\n",
"\n",
"* `wflow` : i.e. build a Wflow model\n",
"* `./wflow_test_full` : output model folder\n",
"* `-r \"{'subbasin': [12.2051, 45.8331], 'strord': 4, 'bounds': [11.70, 45.35, 12.95, 46.70]}\"` : derive a subbasin with its outlet at the given x,y coordinates and within the given bounds [xmin, ymin, xmax, ymax] (WGS84) snapped to a river with minimum stream order (strord) of 4. All *REGION* options are described in the [docs](https://deltares.github.io/hydromt/latest/user_guide/model_region)\n",
"* `-i wflow_build.yml` : setup configuration file including all components to build and their arguments\n",
"* `-d artifact_data`: data catalog to use. Here `artifact_data` which contains a global data extract for Northern Italy for demo purposes.\n",
"* `-vv` : give some extra verbosity (2 * v) to display feedback on screen. Now debug messages are provided.\n"
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions hydromt_wflow/wflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2707,11 +2707,13 @@ def setup_1dmodel_connection(

There are two methods to connect models:

- `subbasin_area`: creates subcatchments linked to the 1d river based
- `subbasin_area`:
creates subcatchments linked to the 1d river based
on an area threshold (area_max) for the subbasin size. With this method,
if a tributary is larger than the `area_max`, it will be connected to
the 1d river directly.
- `nodes`: subcatchments are derived based on the 1driver nodes (used as
- `nodes`:
subcatchments are derived based on the 1driver nodes (used as
gauges locations). With this method, large tributaries can also be derived
separately using the `add_tributaries` option and adding a `area_max`
threshold for the tributaries.
Expand Down
6 changes: 4 additions & 2 deletions hydromt_wflow/workflows/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def wflow_1dmodel_connection(

There are two methods to connect models:

- "subbasin_area": creates subcatchments linked to the 1d river based on an
- `subbasin_area`:
creates subcatchments linked to the 1d river based on an
area threshold (area_max) for the subbasin size. With this method, if a
tributary is larger than the area_max, it will be connected to the 1d river
directly.
- "nodes": subcatchments are derived based on the 1driver nodes (used as gauges
- `nodes`:
subcatchments are derived based on the 1driver nodes (used as gauges
locations). With this method, large tributaries can also be derived separately
using the add_tributaries option and adding a area_max threshold for the
tributaries.
Expand Down
Loading