hydromt_sfincs.SfincsModel

class hydromt_sfincs.SfincsModel(root=None, mode='w', config_fn='sfincs.inp', write_gis=True, data_libs=None, deltares_data=None, artifact_data=None, logger=<Logger hydromt_sfincs.sfincs (WARNING)>)[source]

The SFINCS model class (SfincsModel) contains methods to read, write, setup and edit SFINCS models.

Parameters
  • root (str, Path, optional) – Path to model folder

  • mode ({'w', 'r+', 'r'}) – Open model in write, append or reading mode, by default ‘w’

  • config_fn (str, Path, optional) – Filename of model config file, by default “sfincs.inp”

  • write_gis (bool) – Write model files additionally to geotiff and geojson, by default True

  • opt (dict) – Values for model setup options, used when called from CLI

  • sources (dict) – Library with references to data sources

__init__(root=None, mode='w', config_fn='sfincs.inp', write_gis=True, data_libs=None, deltares_data=None, artifact_data=None, logger=<Logger hydromt_sfincs.sfincs (WARNING)>)[source]

The SFINCS model class (SfincsModel) contains methods to read, write, setup and edit SFINCS models.

Parameters
  • root (str, Path, optional) – Path to model folder

  • mode ({'w', 'r+', 'r'}) – Open model in write, append or reading mode, by default ‘w’

  • config_fn (str, Path, optional) – Filename of model config file, by default “sfincs.inp”

  • write_gis (bool) – Write model files additionally to geotiff and geojson, by default True

  • opt (dict) – Values for model setup options, used when called from CLI

  • sources (dict) – Library with references to data sources

Methods

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

The SFINCS model class (SfincsModel) contains methods to read, write, setup and edit SFINCS models.

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).

get_model_time()

Return (tstart, tstop) tuple with parsed model start and end time

get_spatial_attrs([crs])

Get geospatial config (sfincs.inp) attributes.

plot_basemap([fn_out, variable, shaded, ...])

Create basemap plot.

plot_forcing([fn_out])

Plot model timeseries forcing.

read()

Read the complete model schematization and configuration from file.

read_config([config_fn])

Parse config from file.

read_forcing()

Read forcing files and save to forcing attribute.

read_results([chunksize, drop, fn_map, fn_his])

Read results from sfincs_map.nc and sfincs_his.nc and save to the results attribute.

read_states([crs])

Read waterlevel state (zsini) from ascii file and save to states attribute.

read_staticgeoms()

Read geometry files if and save to staticgeoms attribute.

read_staticmaps([crs])

Read SFINCS binary staticmaps and save to staticmaps attribute.

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_forcing_1d(name[, ts, xy])

Set 1D forcing and update staticgoms and config accordingly.

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])

Initialized 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_basemaps(basemaps_fn[, res, crs, ...])

setup_bounds([btype, mask_fn, ...])

Set boundary cells in the model mask.

setup_cn_infiltration([cn_fn, ...])

Setup model potential maximum soil moisture retention map (scsfile) from gridded curve number map.

setup_config(**cfdict)

Update config with a dictionary

setup_gauges(gauges_fn[, overwrite])

Setup model observation point locations.

setup_h_forcing([geodataset_fn, ...])

Setup waterlevel boundary point locations (bnd) and time series (bzs).

setup_manning_roughness([lulc_fn, map_fn, ...])

Setup model manning roughness map (manningfile) from gridded land-use/land-cover map and manning roughness mapping table.

setup_mask([mask_fn, include_mask_fn, ...])

Creates mask of active model cells.

setup_merge_topobathy(topobathy_fn[, ...])

Updates the existing model topobathy data (dep file) with a new topobathy source within the current model extent.

setup_p_forcing([precip_fn])

Setup spatially uniform precipitation forcing (precip).

setup_p_forcing_from_grid([precip_fn, ...])

Setup precipitation forcing from a gridded spatially varying data source.

setup_q_forcing([geodataset_fn, timeseries_fn])

Setup discharge boundary point locations (src) and time series (dis).

setup_q_forcing_from_grid(discharge_fn[, ...])

Setup discharge boundary location (src) and timeseries (dis) based on a gridded discharge dataset.

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

This component sets the region of interest of the model.

setup_river_bathymetry([river_geom_fn, ...])

Burn rivers into the model elevation (dep) file.

setup_river_hydrography([hydrography_fn, ...])

Setup hydrography layers for flow directions ("flwdir") and upstream area ("uparea") which are required to setup the setup_river* model components.

setup_river_inflow([hydrography_fn, ...])

Setup river inflow (source) points where a river enters the model domain.

setup_river_outflow([hydrography_fn, ...])

Setup open boundary cells (mask=3) where a river flows out of the model domain.

setup_structures(structures_fn, stype[, dz, ...])

Setup thin dam or weir structures.

setup_topobathy(topobathy_fn[, res, crs, ...])

Setup model grid and interpolate topobathy (dep) data to this grid.

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.

update_spatial_attrs()

Update geospatial config (sfincs.inp) attributes based on staticmaps

write()

Write the complete model schematization and configuration to file.

write_config([rel_path])

Write config to <root/config_fn>

write_data_catalog([root, used_only])

Write the data catalog to hydromt_data.yml

write_forcing()

Write forcing to ascii (bzd/dis/precip) and netcdf (netampr) files.

write_raster([variables, root, driver, compress])

Write model 2D raster variables to geotiff files.

write_states([fmt])

Write waterlevel state (zsini) to ascii map file.

write_staticgeoms()

Write staticgeoms to bnd/src/obs xy files and thd/weir structure files.

write_staticmaps()

Write SFINCS staticmaps to binary files including map index file.

write_vector([variables, root])

Write model vector (staticgeoms) variables to geojson files.

Attributes

bounds

Returns shape of staticmaps.

config

Returns parsed model configuration.

coords

Returns coordinates of staticmaps.

crs

Returns coordinate reference system embedded in staticmaps.

dims

Returns spatial dimension names of staticmaps.

forcing

dict of xarray.dataarray representation of all forcing

height

Returns height of staticmaps.

mask

Returns model mask map.

region

Returns geometry of region of the model area of interest.

res

Returns coordinates of staticmaps.

results

dict xarray.dataarray representation of model results

root

Path to model folder.

shape

Returns shape of staticmaps.

states

dict xarray.dataarray representation of all states

staticgeoms

geopandas.GeoDataFrame representation of all model geometries

staticmaps

xarray.Dataset representation of all static parameter maps

transform

Returns spatial transform staticmaps.

width

Returns width of staticmaps.