API reference#
DFlowFM model class#
Initialize#
|
API for Delft3D-FM models in HydroMT. |
Setup components#
|
Update config with a dictionary. |
|
Prepare the 1D channels and adds to branches 1D network. |
|
Set the all river parameters from hydrograph and dem maps. |
|
Prepare the 1D rivers and adds to 1D branches. |
|
Prepare the 1D pipes and adds to 1D branches. |
|
Prepare the 1D manholes to pipes or tunnels. |
Prepare the 1D |
|
Prepare the 1D lateral discharge from geodataset of point geometries. |
|
Prepare the 1D lateral discharge from geodataset of polygons. |
|
|
Prepare bridges, including bridge locations and bridge crossections. |
|
Prepare culverts, including locations and crossections. |
|
Create a 2D unstructured mesh according UGRID conventions. |
Refine the 2d mesh. |
|
|
Generate 1d2d links that link mesh1d and mesh2d according UGRID conventions. |
Add data variable(s) from |
|
Add data variable(s) to maps by reclassifying values from |
|
Prepare the 2D boundaries from line geometries. |
|
Prepare constant 2D daily rainfall_rate timeseries based on |
|
Prepare spatially uniform 2D rainfall forcings from |
Attributes#
Return geometry of region of the model area of interest. |
|
Return model crs. |
|
Return model mesh bounds. |
|
Resolution of the mesh2d. |
|
Path to model folder. |
|
Model configuration. |
|
Model maps. |
|
Model geometries. |
|
Model forcing. |
|
Model states. |
|
Model results. |
|
Model static mesh data. |
|
Hydrolib-core FMModel object. |
|
DIMR file object. |
|
Return the branches (gpd.GeoDataFrame object) representing the 1D network. |
|
Extract rivers from branches. |
|
Extract channels from branches. |
|
Extract pipes from branches. |
|
Open system branches (river, channel). |
|
Closed system branches (pipe, tunnel). |
|
List of grid names in mesh. |
|
Dictionnary 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. |
High level methods#
Read the complete model schematization and configuration from file. |
|
Write the complete model schematization and configuration to file. |
|
|
Single method to build a model from scratch based on settings in opt. |
|
Single method to update a model based the settings in opt. |
|
Initialize the model root. |
|
Write the data catalog to data_lib_fn. |
General methods#
|
Get a config value at key(s). |
|
Update the config dictionary at key(s) with values. |
Use Hydrolib-core reader and return to dictionnary. |
|
From config dict to Hydrolib MDU. |
|
|
Add raster data to the maps component. |
Read maps from initialfield and parse to dict of xr.DataArray. |
|
Write maps as tif files in maps folder and update initial fields. |
|
|
Add data to the geoms attribute. |
Read model geometries files at <root>/<geoms> and add to geoms property. |
|
|
Write model geometries to a GeoJSON file at <root>/<geoms>. |
|
Add data to forcing attribute. |
Read forcing at <root/?/> and parse to dict of xr.DataArray. |
|
Write forcing into hydrolib-core ext and forcing models. |
|
|
Add data to states attribute. |
Read states at <root/?/> and parse to dict of xr.DataArray. |
|
Write states at <root/?/> in model ready format. |
|
|
Add data to results attribute. |
Read results at <root/?/> and parse to dict of xr.DataArray. |
|
|
Return a specific grid topology from mesh based on grid_name. |
|
Add data to mesh. |
|
Add or replace the link1d2d in the model mesh. |
Read network file with Hydrolib-core and extract mesh/branches info. |
|
|
Write 1D branches and 2D mesh at <root/dflowfm/fm_net.nc>. |
|
Update the branches object as well as the linked geoms. |
|
Read DIMR from file and else create from hydrolib-core. |
|
Write the dmir file. |
Initialise the hydrolib-core FMModel object. |
|
Return (refdate, tstart, tstop) tuple. |
DFlowFMModel workflows#
Boundaries#
Get boundary locations from branches and associate with node IDs. |
|
|
Select boundary location per branch type and boundary type. |
|
Validate boundaries per branch type. |
|
Compute 1d boundary values. |
Compute 2d boundary timeseries. |
|
|
Compute meteo forcings. |
Compute 1d forcing values. |
|
Compute 1d forcing values. |
|
Get xarray DataArray coordinates that describes polygon geometries. |
Branches#
|
Set all common steps to add branches type of objects. |
|
Process the branches. |
|
Validate the branches. |
|
Add branches to exisitng open system branches at mesh1d node locations. |
|
Determine the nearest branch for each geometry. |
Add or update columns in the branches geodataframe. |
|
Update an attribute column of branches. |
|
Snap new_branches to branches at snappednodes. |
|
Snap geoms to branches and drop the ones that are not snapped. |
Crosssections#
Prepare the default uniform friction and crosssection for branches. |
|
Initialise crosssection options from user input. |
|
|
Set regular cross-sections for each branch. |
|
Set up xyz crosssections. |
|
Set regular cross-sections from point. |
|
Add new_crossections to crosssections. |
DEM#
|
Compute up- and downstream invert levels for pipe lines in gdf. |
|
Estimate river bedlevel zb. |
Manholes#
|
Generate manhole location and bedlevel from branches. |
Mesh#
Return xugrid mesh1d and network1d UgridDataset from branches. |
|
|
Add branch to 1d mesh, from a (list of) (Multi)LineString geometry. |
|
Refine mesh2d by adding new nodes and faces. |
Generate 1d2d links to network from 1d to 2d. |
|
Generate embedded links from 2d to 1d. |
|
Generate 1d2d links from the 2d mesh to the 1d mesh, with a lateral connection. |
Region#
|
Parse hydromt stype region argument into region geometry. |
Roughness#
|
Generate roughness ID column based on frictiontype and frictionvalue. |
Structures#
|
Prepare 1D structures from geodataframe. |
DFlowFM low-level methods#
Input/Output methods#
|
Read branches.gui and add the properties to branches geodataframe. |
|
write branches.gui file from branches geodataframe. |
|
Read crosssections from hydrolib-core crsloc and crsdef objects and add to branches. |
|
Write crosssections into hydrolib-core crsloc and crsdef objects. |
|
Read friction files and add properties to branches geodataframe. |
|
write friction files from crosssections geodataframe. |
|
Read structures into hydrolib-core structures objects. |
|
write structures into hydrolib-core structures objects. |
|
Read manholes from hydrolib-core storagenodes and network 1d nodes for locations. |
|
write manholes into hydrolib-core storage nodes objects. |
|
Read for a specific quantity the external and forcing files and parse to xarray. |
|
Write 1dboundary ext and boundary files from forcing dict. |
|
Read a 1D lateral from external and forcing files. |
|
Write 1dlateral ext and bc files from forcing dict. |
|
Read a 2d boundary forcing location and values, and parse to xarray. |
|
Write 2 boundary forcings from forcing dict. |
|
Read for a specific quantity the external and forcing files and parse to xarray. |
|
Write 2d meteo forcing from forcing dict. |
Mesh conversion methods#
Convert from xugrid mesh to hydrolib-core network object. |
|
Create xugrid mesh1d and network1d UgridDataset from hydrolib-core network object. |
|
Extract link1d2d from hydrolib-core network object. |
|
Create xugrid mesh from hydrolib-core network object. |
|
Return the nodes of mesh 1D as geodataframe. |
|
Get network1d nodes as gdp. |
Graph methods#
Convert a gpd.GeoDataFrame to a nx.DiGraph. |
|
|
Get the possible boundary locations from the branches with id. |
GIS methods#
|
Get a list of lines splitted from a line. |
|
Cut a line into pieces based on distances. |
|
Check if the geodataframe contains all required columns. |
|
Add or update columns in gdf based on column and values in df. |
|
Get geodataframe from dataframe. |