hydromt.MeshModel#

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

Model class Mesh Model for mesh models in HydroMT.

Uses xugrid for working with unstructured grids, for data and topology stored according to UGRID conventions.

See also: xugrid

Initialize a MeshModel for models with an unstructured grid.

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

Initialize a MeshModel for models with an unstructured grid.

Methods

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

Initialize a MeshModel for models with an unstructured grid.

build([region, 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).

get_mesh(grid_name[, include_data])

Return a specific grid topology from mesh based on grid_name.

get_tables_merged()

Return all tables of a model merged into one dataframe.

read([components])

Read the complete model schematization and configuration from model files.

read_config([config_fn])

Parse config from file.

read_forcing([fn])

Read forcing at <root>/<fn> and add to forcing property.

read_geoms([fn])

Read model geometries files at <root>/<fn> and add to geoms property.

read_maps([fn])

Read model map at <root>/<fn> and add to maps component.

read_mesh([fn, crs])

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

read_nc(fn[, mask_and_scale, ...])

Read netcdf files at <root>/<fn> and return as dict of xarray.Dataset.

read_results([fn])

Read results at <root>/<fn> and add to results property.

read_states([fn])

Read states at <root>/<fn> and add to states property.

read_staticgeoms()

Read gemoetries from disk.

read_staticmaps([fn])

Read static model maps at <root>/<fn> and add to staticmaps property.

read_tables([fn])

Read table files at <root>/tables and parse to dict of dataframes.

set_config(*args)

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

set_crs(crs)

Set the coordinate reference system.

set_forcing(data[, name, split_dataset])

Add data to forcing attribute.

set_geoms(geom, name)

Add data to the geoms attribute.

set_maps(data[, name, split_dataset])

Add raster data to the maps component.

set_mesh(data[, name, grid_name, overwrite_grid])

Add data to mesh.

set_results(data[, name, split_dataset])

Add data to results attribute.

set_root(root[, mode])

Initialize the model root.

set_states(data[, name, split_dataset])

Add data to states attribute.

set_staticgeoms(geom, name)

Set the geometries.

set_staticmaps(data[, name])

Add data to staticmaps.

set_tables(tables[, name])

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

setup_basemaps(*args, **kwargs)

setup_config(**cfdict)

Update config with a dictionary.

setup_maps_from_raster_reclass(raster_fn, ...)

HYDROMT CORE METHOD: Add data variable(s) to maps object by reclassifying the data in raster_fn based on reclass_table_fn.

setup_maps_from_rasterdataset(raster_fn[, ...])

HYDROMT CORE METHOD: Add data variable(s) from raster_fn to maps object.

setup_mesh2d(region[, res, crs, grid_name])

HYDROMT CORE METHOD: Create an 2D unstructured mesh or reads an existing 2D mesh according UGRID conventions.

setup_mesh2d_from_raster_reclass(raster_fn, ...)

HYDROMT CORE METHOD: Add data variable(s) to 2D grid_name in mesh object by reclassifying the data in raster_fn based on reclass_table_fn.

setup_mesh2d_from_rasterdataset(raster_fn[, ...])

HYDROMT CORE METHOD: Add data variable(s) from raster_fn to 2D grid_name in mesh object.

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

Set the region of interest of the model.

test_model_api()

Test compliance with HydroMT Model API.

update([model_out, write, opt, ...])

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

write([components])

Write the complete model schematization and configuration to model files.

write_config([config_name, config_root])

Write config to <root/config_fn>.

write_data_catalog([root, data_lib_fn, ...])

Write the data catalog to data_lib_fn.

write_forcing([fn])

Write forcing to netcdf file at <root>/<fn>.

write_geoms([fn, to_wgs84])

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

write_maps([fn])

Write maps to netcdf file at <root>/<fn>.

write_mesh([fn, write_optional_ugrid_attributes])

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

write_nc(nc_dict, fn[, gdal_compliant, ...])

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

write_states([fn])

Write states to netcdf file at <root>/<fn>.

write_staticgeoms()

Write the geometries to disk.

write_staticmaps([fn])

Write static model maps to netcdf file at <root>/<fn>.

write_tables([fn])

Write tables at <root>/tables.

Attributes

api

bounds

Returns model mesh bounds.

config

Model configuration.

coords

Returns the coordinates of model staticmaps.

crs

Returns model mesh crs.

dims

Returns spatial dimension names of staticmaps.

forcing

Model forcing.

geoms

Model geometries.

height

Returns the height of the model staticmaps.

maps

Model maps.

mesh

Model static mesh data.

mesh_datasets

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

mesh_gdf

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

mesh_grids

Dictionnary of grid names and Ugrid topologies in mesh.

mesh_names

List of grid names in mesh.

region

Returns geometry of region of the model area of interest based on mesh total bounds.

res

Returns the resolution of the model staticmaps.

results

Model results.

root

Path to model folder.

shape

Returns the shape of the model staticmaps.

states

Model states.

staticgeoms

Access the geometryes.

staticmaps

Model static maps.

tables

Model tables.

transform

Returns the geospatial transform of the model staticmaps.

width

Returns the width of the model staticmaps.