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 at <root/?/> and parse to dict of xr.DataArray
Read results at <root/?/> and parse to dict of xr.DataArray
Read states at <root/?/> and parse to dict of xr.DataArray
Read staticgeoms at <root/?/> and parse to dict of geopandas
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 at <root/?/> in model ready format
write states at <root/?/> in model ready format
Write staticmaps at <root/?/> in model ready format
Write staticmaps at <root/?/> in model ready format
Attributes
bounds
Returns shape of staticmaps.
Returns parsed model configuration.
coords
Returns coordinates of staticmaps.
crs
Returns coordinate reference system embedded in staticmaps.
dims
Returns spatial dimension names of staticmaps.
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.
dict xarray.dataarray representation of model results
root
Path to model folder.
shape
Returns shape of staticmaps.
dict xarray.dataarray representation of all states
geopandas.GeoDataFrame representation of all model geometries
xarray.Dataset representation of all static parameter maps
transform
Returns spatial transform staticmaps.
width
Returns width of staticmaps.