hydromt_sfincs.SfincsModel#

class hydromt_sfincs.SfincsModel(root: str | None = None, mode: str = 'w', config_fn: str = 'sfincs.inp', write_gis: bool = True, data_libs: ~typing.List[str] | str | None = 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

  • data_libs (List, str) – List of data catalog yaml files, by default None

__init__(root: str | None = None, mode: str = 'w', config_fn: str = 'sfincs.inp', write_gis: bool = True, data_libs: ~typing.List[str] | str | None = 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

  • data_libs (List, str) – List of data catalog yaml files, by default None

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, 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

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

Create basemap plot.

plot_forcing([fn_out])

Plot model timeseries forcing.

read([epsg])

Read the complete model schematization and configuration from file.

read_config([config_fn, epsg])

Parse config from SFINCS input file.

read_forcing([data_vars])

Read forcing files and save to forcing attribute.

read_geoms()

Read geometry files and save to geoms attribute.

read_grid([data_vars])

Read SFINCS binary grid files and save to grid attribute.

read_maps([fn])

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

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

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

read_staticgeoms()

This method will be deprecated in future versions, use read_geoms()

read_staticmaps([fn])

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

read_subgrid()

Read SFINCS subgrid file and add to subgrid attribute.

set_config(*args)

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

set_crs(crs)

Sets the model crs

set_forcing(data[, name, split_dataset])

Add data to forcing attribute.

set_forcing_1d([df_ts, gdf_locs, name, merge])

Set 1D forcing time series for 'bzs' or 'dis' boundary conditions.

set_geoms(geom, name)

Add data to the geoms attribute.

set_grid(data[, name])

Add data to grid.

set_maps(data[, name, split_dataset])

Add raster data to the maps component.

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)

This method will be deprecated in future versions, use set_geoms()

set_staticmaps(data[, name])

This method will be deprecated in future versions.

setup_basemaps(*args, **kwargs)

setup_cn_infiltration(cn[, ...])

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

setup_config(**cfdict)

Update config with a dictionary

setup_constant_infiltration(qinf[, ...])

Setup spatially varying constant infiltration rate (qinffile).

setup_dep(datasets_dep[, buffer_cells, ...])

Interpolate topobathy (dep) data to the model grid.

setup_discharge_forcing([geodataset, ...])

Setup discharge forcing.

setup_discharge_forcing_from_grid(discharge)

Setup discharge forcing based on a gridded discharge dataset.

setup_grid(x0, y0, dx, dy, nmax, mmax, ...)

Setup a regular or quadtree grid.

setup_grid_from_region(region[, res, crs, ...])

Setup a regular or quadtree grid from a region.

setup_manning_roughness([datasets_rgh, ...])

Setup model manning roughness map (manningfile) from gridded manning data or a combinataion of gridded land-use/land-cover map and manning roughness mapping table.

setup_maps_from_raster(raster_fn[, ...])

This component adds data variable(s) from raster_fn to maps object.

setup_maps_from_raster_reclass(raster_fn, ...)

This component adds data variable(s) to maps object by reclassifying the data in raster_fn based on reclass_table_fn.

setup_mask_active([mask, include_mask, ...])

Setup active model cells.

setup_mask_bounds([btype, include_mask, ...])

Set boundary cells in the model mask.

setup_observation_points(locations[, merge])

Setup model observation point locations.

setup_precip_forcing(timeseries)

Setup spatially uniform precipitation forcing (precip).

setup_precip_forcing_from_grid([precip, ...])

Setup precipitation forcing from a gridded spatially varying data source.

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

This component sets the region of interest of the model.

setup_river_inflow([rivers, hydrography, ...])

Setup discharge (src) points where a river enters the model domain.

setup_river_outflow([rivers, hydrography, ...])

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

setup_structures(structures, stype[, dz, merge])

Setup thin dam or weir structures.

setup_subgrid(datasets_dep[, datasets_rgh, ...])

Setup method for subgrid tables based on a list of elevation and Manning's roughness datasets.

setup_tiles([path, region, datasets_dep, ...])

Create both index and topobathy tiles in webmercator format.

setup_waterlevel_bnd_from_mask([distance, merge])

Setup waterlevel boundary (bnd) points along model waterlevel boundary (msk=2).

setup_waterlevel_forcing([geodataset, ...])

Setup waterlevel forcing.

test_model_api()

update([model_out, write, opt])

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

update_grid_from_config()

Update grid properties based on config (sfincs.inp) attributes

update_spatial_attrs()

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

write()

Write the complete model schematization and configuration to file.

write_config([config_fn])

Write config to <root/config_fn>

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

Write the data catalog to data_lib_fn

write_forcing([data_vars])

Write forcing to ascii or netcdf (netampr) files.

write_geoms([data_vars])

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

write_grid([data_vars])

Write SFINCS grid to binary files including map index file.

write_maps([fn])

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

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

Write model 2D raster variables to geotiff files.

write_states()

Write waterlevel state (zsini) to binary map file.

write_staticgeoms()

This method will be deprecated in future versions, use write_geoms()

write_staticmaps([fn])

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

write_subgrid()

Write SFINCS subgrid file.

write_vector([variables, root, gdf])

Write model vector (geoms) variables to geojson files.

Attributes

api

Return all model components and their data types

bounds

Returns the bounding box of the model grid.

config

Model configuration.

coords

Returns the coordinates of model staticmaps.

crs

Returns the model crs

dims

Returns spatial dimension names of staticmaps.

forcing

Model forcing.

geoms

Model geometries.

grid

Model static gridded data.

height

Returns the height of the model staticmaps.

maps

Model maps.

mask

Returns model mask

region

Returns the geometry of the active model cells.

res

Returns the resolution of the model grid.

results

Model results.

root

Path to model folder.

shape

Returns the shape of the model staticmaps.

states

Model states.

staticgeoms

This property will be deprecated in future versions, use geom()

staticmaps

Model static maps.

transform

Returns spatial transform of the model grid.

width

Returns the width of the model staticmaps.