hydromt.Model#

class hydromt.Model(root: ~typing.Optional[str] = None, mode: str = 'w', config_fn: ~typing.Optional[str] = None, data_libs: ~typing.Optional[~typing.List[str]] = None, logger=<Logger hydromt.models.model_api (WARNING)>, **artifact_keys)[source]#

General and basic API for models in HydroMT

Initialize a model

Parameters:
  • root (str, optional) – Model root, by default None

  • mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”

  • config_fn (str, optional) – Model simulation configuration file, by default None. Note that this is not the HydroMT model setup configuration file!

  • data_libs (List[str], optional) – List of data catalog yaml files, by default None

__init__(root: ~typing.Optional[str] = None, mode: str = 'w', config_fn: ~typing.Optional[str] = None, data_libs: ~typing.Optional[~typing.List[str]] = None, logger=<Logger hydromt.models.model_api (WARNING)>, **artifact_keys)[source]#

Initialize a model

Parameters:
  • root (str, optional) – Model root, by default None

  • mode ({'r','r+','w'}, optional) – read/append/write mode, by default “w”

  • config_fn (str, optional) – Model simulation configuration file, by default None. Note that this is not the HydroMT model setup configuration file!

  • data_libs (List[str], optional) – List of data catalog yaml files, by default None

Methods

__init__([root, mode, config_fn, data_libs, ...])

Initialize a model

build(region[, res, write, opt])

Single method to build a model from scratch based on settings in opt.

get_config(*args[, fallback, abs_path])

Get a config value at key(s).

read()

Method to read the complete model schematization and configuration from file.

read_config([config_fn])

Parse config from file.

read_forcing()

Read forcing at <root/?/> and parse to dict of xr.DataArray

read_results()

Read results at <root/?/> and parse to dict of xr.DataArray

read_states()

Read states at <root/?/> and parse to dict of xr.DataArray

read_staticgeoms()

Read staticgeoms at <root/?/> and parse to dict of geopandas

read_staticmaps()

Read staticmaps at <root/?/> and parse to xarray Dataset

set_config(*args)

Update the config dictionary at key(s) with values.

set_crs(crs)

Embed coordinate reference system staticmaps metadata.

set_forcing(data[, name])

Add data to forcing attribute which is a dictionary of xarray.DataArray.

set_results(data[, name, split_dataset])

Add data to results attribute which is a dictionary of xarray.DataArray and/or xarray.Dataset.

set_root(root[, mode])

Initialize the model root.

set_states(data[, name])

Add data to states attribute which is a dictionary of xarray.DataArray.

set_staticgeoms(geom, name)

Add geom to staticmaps

set_staticmaps(data[, name])

Add data to staticmaps.

setup_config(**cfdict)

Update config with a dictionary

setup_region(region[, hydrography_fn, ...])

This component sets the region of interest of the model.

test_model_api()

Test compliance to model API instances.

update([model_out, write, opt])

Single method to update a model based the settings in opt.

write()

Method to write the complete model schematization and configuration to file.

write_config([config_name, config_root])

Write config to <root/config_fn>

write_data_catalog([root, used_only])

Write the data catalog to hydromt_data.yml

write_forcing()

write forcing at <root/?/> in model ready format

write_states()

write states at <root/?/> in model ready format

write_staticgeoms()

Write staticmaps at <root/?/> in model ready format

write_staticmaps()

Write staticmaps at <root/?/> in model ready format

Attributes

bounds

Returns shape of staticmaps.

config

Returns parsed model configuration.

coords

Returns coordinates of staticmaps.

crs

Returns coordinate reference system embedded in staticmaps.

dims

Returns spatial dimension names of staticmaps.

forcing

dict of xarray.dataarray representation of all forcing

height

Returns height of staticmaps.

region

Returns geometry of region of the model area of interest.

res

Returns coordinates of staticmaps.

results

dict xarray.dataarray representation of model results

root

Path to model folder.

shape

Returns shape of staticmaps.

states

dict xarray.dataarray representation of all states

staticgeoms

geopandas.GeoDataFrame representation of all model geometries

staticmaps

xarray.Dataset representation of all static parameter maps

transform

Returns spatial transform staticmaps.

width

Returns width of staticmaps.