Model#
Model class#
High-level methods#
|
General and basic API for models in HydroMT. |
|
Read provided components from disk. |
|
Write provided components to disk with defaults. |
|
Write the data catalog to data_lib_path. |
General methods#
|
Single method to build a model from scratch based on settings in steps. |
|
Single method to update a model based the settings in steps. |
|
Get a component from the model. |
|
Add a component to the model. |
|
Test if two models are equal, based on their components. |
Model attributes#
DataCatalog for data access |
|
Returns coordinate reference system embedded in region. |
|
Model root |
|
Return the model's region component. |
|
ModelRoot#
|
A class to handle model roots in a cross platform manner. |
Attributes#
The mode of the model this object belongs to. |
|
Test whether we are in writing mode or not. |
|
Test whether we are in reading mode or not. |
|
Test whether we are in override mode or not. |
General Methods#
|
Set the path of the root, and create the necessary loggers. |
Model components#
ModelComponent#
Note that the base ModelComponent attributes and methods are available to all model components.
|
Abstract base class for ModelComponent. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Read the file(s) into the component. |
|
Write the component to file(s). |
|
Return the root of the model this component is associated with. |
SpatialModelComponent#
|
Base spatial model component for GIS components. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Provide access to the CRS of the model region. |
|
Return the total bounds of the model region. |
|
Provide access to the underlying GeoDataFrame data of the model region. |
Plugin developer methods
Implement this property in order to provide the region. |
|
Write the model region to file. |
|
Test if two components are equal. |
ConfigComponent#
|
A component to manage configuration files for model simulations/settings. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model config values. |
|
|
Write model config at <root>/{path}. |
|
Read model config at <root>/{path}. |
|
Create a new config file based on a template file. |
Set the config dictionary at key(s) with values. |
|
|
Update the config dictionary at key(s) with values. |
|
Get a config value at key(s). |
Test if two components are equal. |
GeomsComponent#
|
A component to manage geo-spatial geometries. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model geometries. |
|
Provide access to the underlying GeoDataFrame data of the model region. |
|
|
Write model geometries to a vector file (by default GeoJSON) at <root>/<filename>. |
|
Read model geometries files at <root>/<filename>. |
|
Add data to the geom component. |
Test if two GeomsComponents are equal. |
TablesComponent#
|
TablesComponent contains data as a dictionary of pandas.DataFrame. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model tables. |
|
|
Write tables at provided or default filepath if none is provided. |
|
Read tables at provided or default filepath if none is provided. |
|
Add (a) table(s) <pandas.DataFrame> to model. |
Test if two components are equal. |
DatasetsComponent#
|
A component to manage collections of Xarray objects. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model data in the form of xarray objects. |
|
Write dictionary of xarray.Dataset and/or xarray.DataArray to netcdf files. |
|
Read model dataset files at <root>/<filename>. |
|
|
Add data to the xarray component. |
Test if two DatasetsComponents are equal. |
SpatialDatasetsComponent#
|
A component to manage collection of geospatial xarray objects. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model data in the form of xarray objects. |
|
Provide access to the underlying GeoDataFrame data of the model region. |
|
Write dictionary of xarray.Dataset and/or xarray.DataArray to netcdf files. |
|
Read model dataset files at <root>/<filename>. |
|
|
HYDROMT CORE METHOD: Add data variable(s) to datasets component by reclassifying the data in |
|
HYDROMT CORE METHOD: Add data variable(s) from |
Add data to the xarray component. |
|
Test if two DatasetsComponents are equal. |
GridComponent#
|
ModelComponent class for grid components. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Returns the resolution of the model grid. |
|
Returns spatial transform of the model grid. |
|
Returns coordinate reference system embedded in the model grid. |
|
Returns the bounding box of the model grid. |
|
Provide access to the underlying GeoDataFrame data of the model region. |
|
Model static gridded data as xarray.Dataset. |
|
|
Write model grid data to netcdf file at <root>/<fn>. |
|
Read model grid data at <root>/<fn> and add to grid property. |
HYDROMT CORE METHOD: Create a 2D regular grid or reads an existing grid. |
|
HYDROMT CORE METHOD: Adds data to grid component based on a constant value. |
|
HYDROMT CORE METHOD: Add data variable(s) from |
|
HYDROMT CORE METHOD: Add data variable(s) to grid component by reclassifying the data in |
|
HYDROMT CORE METHOD: Add data variable(s) to grid component by rasterizing the data from |
|
|
Add data to grid. |
Test if two components are equal. |
MeshComponent#
|
ModelComponent class for mesh components. |
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
Model static mesh data. |
|
Returns model mesh crs. |
|
Returns model mesh bounds. |
|
Provide access to the underlying GeoDataFrame data of the model region. |
|
List of grid names in mesh. |
|
Dictionary of grid names and Ugrid topologies in mesh. |
|
Dictionnary of grid names and corresponding UgridDataset topology and data variables in mesh. |
|
Returns dict of geometry of grids in mesh as a gpd.GeoDataFrame. |
|
|
Write model grid data to a netCDF file at <root>/<filename>. |
|
Read model mesh data at <root>/<filename> and add to mesh property. |
HYDROMT CORE METHOD: Create an 2D unstructured mesh or reads an existing 2D mesh according UGRID conventions. |
|
|
HYDROMT CORE METHOD: Add data variable(s) from |
|
HYDROMT CORE METHOD: Add data variable(s) to 2D |
|
Add data to mesh. |
|
Return a specific grid topology from mesh based on grid_name. |
VectorComponent#
|
ModelComponent class for vector components. |
Model vector (polygon) data. |
|
Returns the geometry of the model vector as gpd.GeoSeries. |
|
Returns the index dimension of the vector. |
|
Returns coordinate reference system embedded in the vector. |
|
Return the model object this component is associated with. |
|
Return the data catalog of the model this component is associated with. |
|
Return the root of the model this component is associated with. |
|
|
Read model vector from combined netcdf and geojson file. |
|
Write model vector to combined netcdf and geojson files. |
|
Add data to vector. |
Test if two components are equal. |
Model Processes#
Grid#
|
Create a 2D regular grid or reads an existing grid. |
Create a rotated grid based on a geometry. |
|
|
Prepare a grid based on a constant value. |
Prepare data by resampling ds to grid_like. |
|
Prepare data variable(s) resampled to grid_like object by reclassifying the data in |
|
|
Prepare data variable(s) resampled to grid_like object by rasterizing the data from |
|
Return the origin (x0, y0), shape (mmax, nmax) and rotation of the rotated grid. |
Mesh#
HYDROMT CORE METHOD: Create an 2D unstructured mesh or reads an existing 2D mesh according UGRID conventions. |
|
|
Create a 2D mesh from another mesh. |
|
Create a regular 2D mesh from a boundary geometry. |
Resamples data in ds to mesh2d. |
|
Resample data to |
Region#
|
Parse a basin /subbasin / interbasin region and return the GeoDataFrame. |
|
Parse a region of kind bbox and return the GeoDataFrame. |
|
Parse a region and return the GeoDataFrame. |
|
Parse a region of kind grid and return the corresponding xarray object. |
Parse a region with a model path and return that whole Model in read mode. |
|
Parse a region with a mesh path and return that mesh in read mode. |
Basin mask#
Return a geometry of the (sub)(inter)basin(s). |
River bathymetry#
|
Return average river width along a segment based on a river mask raster. |
|
Derive river depth estimates based bankfull discharge. |
Meteo#
|
Return the lazy reprojection of precipitation to model. |
|
Return lazy reprojection of temperature to model grid. |
|
Return lazy reprojection of pressure to model grid. |
|
Determine reference evapotranspiration. |
|
Return lazy reprojection of wind speed to model grid. |
|
Pressure correction based on elevation lapse_rate. |
|
Temperature correction based on elevation data. |
|
Resample data to destination frequency. |
|
Return relative difference between dataset mean timestep and destination freq. |
|
Determine De Bruin (2016) reference evapotranspiration. |
|
Determnines Makkink reference evapotranspiration. |
|
Estimate daily reference evapotranspiration (ETo). |