Updating a model#

To add or change one or more components of an existing model the update method can be used. The update method works identical for all HydroMT model plugins, but the model methods (i.e. sections and options in the .yaml workflow file) are different for each model.

Steps in brief:

  1. You have an existing model schematization. This model does not have to be complete.

  2. Prepare or use a pre-defined data catalog with all the required data sources, see working with data

  3. Prepare a model workflow with the methods that you want to use to add or change components of your model: see model workflow.

  4. Update your model using the CLI or Python interface

From CLI#

The hydromt update command line interface (CLI) method can be run from the command line after the right conda environment is activated.

By default, the model is updated in place, overwriting the existing model schematization. To save a copy of the model provide a new output model root directory with the -o option.

By default, all model methods in the .yaml configuration file provided with -i will be updated. To update only certain methods, the -c <method> option can be used to select methods in combination with .yaml file. Besides the .yaml file, method arguments can be set from the CLI with --opt <method.argument=value>. If used in combination with an .yaml file, it will overwrite the same arguments in the .yaml file. Both -c and -opt can be used repeatedly in a single update.

Example usage

In the following example a Wflow model at /path/to/model is updated and the results are written to a new directory /path/to/model_out. The pipeline with methods which are updated are outlined in the wflow_config.yaml configuration file and used data sources in the data_catalog.yml catalog file.

hydromt update wflow /path/to/model_root -o /path/to/model_out -i /path/to/wflow_config.yaml -d /path/to/data_catalog.yml -v

The following example updates (overwrites!) the landuse-landcover based staticmaps in a Wflow model with the setup_lulcmaps method based on a the different landuse-landcover dataset according to setup_lulcmaps.lulc_fn=vito.

Overview of options

To check all options see :ref: the CLI API, or do:

hydromt update --help