Model components#

ModelComponent#

Note that the base ModelComponent attributes and methods are available to all model components.

components.ModelComponent(model)

Abstract base class for ModelComponent.

components.ModelComponent.model

Return the model object this component is associated with.

components.ModelComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.ModelComponent.read()

Read the file(s) into the component.

components.ModelComponent.write()

Write the component to file(s).

components.ModelComponent.root

Return the root of the model this component is associated with.

SpatialModelComponent#

components.SpatialModelComponent(model, *[, ...])

Base spatial model component for GIS components.

components.SpatialModelComponent.model

Return the model object this component is associated with.

components.SpatialModelComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.SpatialModelComponent.root

Return the root of the model this component is associated with.

components.SpatialModelComponent.crs

Provide access to the CRS of the model region.

components.SpatialModelComponent.bounds

Return the total bounds of the model region.

components.SpatialModelComponent.region

Provide access to the underlying GeoDataFrame data of the model region.

Plugin developer methods

components.SpatialModelComponent._region_data

Implement this property in order to provide the region.

components.SpatialModelComponent.write_region([...])

Write the model region to file.

components.SpatialModelComponent.test_equal(other)

Test if two components are equal.

ConfigComponent#

components.ConfigComponent(model, *[, ...])

A component to manage configuration files for model simulations/settings.

components.ConfigComponent.model

Return the model object this component is associated with.

components.ConfigComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.ConfigComponent.root

Return the root of the model this component is associated with.

components.ConfigComponent.data

Model config values.

components.ConfigComponent.write([file_path])

Write model config at <root>/{path}.

components.ConfigComponent.read([path])

Read model config at <root>/{path}.

components.ConfigComponent.create([template])

Create a new config file based on a template file.

components.ConfigComponent.update(data)

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

components.ConfigComponent.set(key, value)

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

components.ConfigComponent.get_value(key[, ...])

Get a config value at key(s).

components.ConfigComponent.test_equal(other)

Test if two components are equal.

GeomsComponent#

components.GeomsComponent(model, *[, ...])

A component to manage geo-spatial geometries.

components.GeomsComponent.model

Return the model object this component is associated with.

components.GeomsComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.GeomsComponent.root

Return the root of the model this component is associated with.

components.GeomsComponent.data

Model geometries.

components.GeomsComponent.region

Provide access to the underlying GeoDataFrame data of the model region.

components.GeomsComponent.write([filename, ...])

Write model geometries to a vector file (by default GeoJSON) at <root>/<filename>.

components.GeomsComponent.read([filename])

Read model geometries files at <root>/<filename>.

components.GeomsComponent.set(geom, name)

Add data to the geom component.

components.GeomsComponent.test_equal(other)

Test if two GeomsComponents are equal.

TablesComponent#

components.TablesComponent(model[, filename])

TablesComponent contains data as a dictionary of pandas.DataFrame.

components.TablesComponent.model

Return the model object this component is associated with.

components.TablesComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.TablesComponent.root

Return the root of the model this component is associated with.

components.TablesComponent.data

Model tables.

components.TablesComponent.write([filename])

Write tables at provided or default file path if none is provided.

components.TablesComponent.read([filename])

Read tables at provided or default file path if none is provided.

components.TablesComponent.set(tables[, name])

Add (a) table(s) <pandas.DataFrame> to model.

components.TablesComponent.test_equal(other)

Test if two components are equal.

DatasetsComponent#

components.DatasetsComponent(model[, filename])

A component to manage collections of Xarray objects.

components.DatasetsComponent.model

Return the model object this component is associated with.

components.DatasetsComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.DatasetsComponent.root

Return the root of the model this component is associated with.

components.DatasetsComponent.data

Model data in the form of xarray objects.

components.DatasetsComponent.write([...])

Write dictionary of xarray.Dataset and/or xarray.DataArray to netcdf files.

components.DatasetsComponent.read([filename])

Read model dataset files at <root>/<filename>.

components.DatasetsComponent.set(data[, ...])

Add data to the xarray component.

components.DatasetsComponent.test_equal(other)

Test if two DatasetsComponents are equal.

SpatialDatasetsComponent#

components.SpatialDatasetsComponent(model, ...)

A component to manage collection of geospatial xarray objects.

components.SpatialDatasetsComponent.model

Return the model object this component is associated with.

components.SpatialDatasetsComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.SpatialDatasetsComponent.root

Return the root of the model this component is associated with.

components.SpatialDatasetsComponent.data

Model data in the form of xarray objects.

components.SpatialDatasetsComponent.region

Provide access to the underlying GeoDataFrame data of the model region.

components.SpatialDatasetsComponent.write([...])

Write dictionary of xarray.Dataset and/or xarray.DataArray to netcdf files.

components.SpatialDatasetsComponent.read([...])

Read model dataset files at <root>/<filename>.

components.SpatialDatasetsComponent.add_raster_data_from_raster_reclass(...)

HYDROMT CORE METHOD: Add data variable(s) to datasets component by reclassifying the data in raster_filename based on reclass_table_filename.

components.SpatialDatasetsComponent.add_raster_data_from_rasterdataset(...)

HYDROMT CORE METHOD: Add data variable(s) from raster_filename to datasets component.

components.SpatialDatasetsComponent.set(data)

Add data to the xarray component.

components.SpatialDatasetsComponent.test_equal(other)

Test if two DatasetsComponents are equal.

GridComponent#

components.GridComponent(model, *[, ...])

ModelComponent class for grid components.

components.GridComponent.model

Return the model object this component is associated with.

components.GridComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.GridComponent.root

Return the root of the model this component is associated with.

components.GridComponent.res

Returns the resolution of the model grid.

components.GridComponent.transform

Returns spatial transform of the model grid.

components.GridComponent.crs

Returns coordinate reference system embedded in the model grid.

components.GridComponent.bounds

Returns the bounding box of the model grid.

components.GridComponent.region

Provide access to the underlying GeoDataFrame data of the model region.

components.GridComponent.data

Model static gridded data as xarray.Dataset.

components.GridComponent.write([filename, ...])

Write model grid data to netcdf file at <root>/<fn>.

components.GridComponent.read([filename])

Read model grid data at <root>/<fn> and add to grid property.

components.GridComponent.set(data[, name, ...])

Add data to grid.

components.GridComponent.test_equal(other)

Test if two components are equal.

MeshComponent#

components.MeshComponent(model, *[, ...])

ModelComponent class for mesh components.

components.MeshComponent.model

Return the model object this component is associated with.

components.MeshComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.MeshComponent.root

Return the root of the model this component is associated with.

components.MeshComponent.data

Model static mesh data.

components.MeshComponent.crs

Returns model mesh crs.

components.MeshComponent.bounds

Returns model mesh bounds.

components.MeshComponent.region

Provide access to the underlying GeoDataFrame data of the model region.

components.MeshComponent.mesh_names

List of grid names in mesh.

components.MeshComponent.mesh_grids

Dictionary of grid names and Ugrid topologies in mesh.

components.MeshComponent.mesh_datasets

Dictionnary of grid names and corresponding UgridDataset topology and data variables in mesh.

components.MeshComponent.mesh_gdf

Returns dict of geometry of grids in mesh as a gpd.GeoDataFrame.

components.MeshComponent.write([filename, ...])

Write model grid data to a netCDF file at <root>/<filename>.

components.MeshComponent.read([filename, crs])

Read model mesh data at <root>/<filename> and add to mesh property.

components.MeshComponent.set(data, *[, ...])

Add data to mesh.

components.MeshComponent.get_mesh(grid_name)

Return a specific grid topology from mesh based on grid_name.

VectorComponent#

components.VectorComponent(model, *[, ...])

ModelComponent class for vector components.

components.VectorComponent.data

Model vector (polygon) data.

components.VectorComponent.geometry

Returns the geometry of the model vector as gpd.GeoSeries.

components.VectorComponent.index_dim

Returns the index dimension of the vector.

components.VectorComponent.crs

Returns coordinate reference system embedded in the vector.

components.VectorComponent.model

Return the model object this component is associated with.

components.VectorComponent.data_catalog

Return the data catalog of the model this component is associated with.

components.VectorComponent.root

Return the root of the model this component is associated with.

components.VectorComponent.read(*[, ...])

Read model vector from combined netcdf and geojson file.

components.VectorComponent.write([filename, ...])

Write model vector to combined netcdf and geojson files.

components.VectorComponent.set([data, name, ...])

Add data to vector.

components.VectorComponent.test_equal(other)

Test if two components are equal.