API reference#
SFINCS model class#
Initialize#
|
The SFINCS model class (SfincsModel) contains methods to read, write, setup and edit SFINCS models. |
Setup components#
|
Update config with a dictionary. |
|
Set the region of interest of the model. |
|
Setup a regular or quadtree grid. |
|
Setup a regular or quadtree grid from a region. |
|
Interpolate topobathy (dep) data to the model grid. |
|
Setup active model cells. |
|
Set boundary cells in the model mask. |
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 spatially varying constant infiltration rate (qinffile). |
|
|
Setup model potential maximum soil moisture retention map (scsfile) from gridded curve number map. |
Setup model the Soil Conservation Service (SCS) Curve Number (CN) files for SFINCS including recovery term based on the soil saturation |
|
|
Setup method for subgrid tables based on a list of elevation and Manning's roughness datasets. |
|
Setup discharge (src) points where a river enters the model domain. |
|
Setup open boundary cells (mask=3) where a river flows out of the model domain. |
|
Setup model observation point locations. |
|
Setup model observation lines (cross-sections) to monitor discharges. |
|
Setup thin dam or weir structures. |
|
Setup drainage structures. |
|
Setup storage volume. |
Setup waterlevel forcing. |
|
Setup waterlevel boundary (bnd) points along model waterlevel boundary (msk=2). |
|
Setup discharge forcing. |
|
Setup discharge forcing based on a gridded discharge dataset. |
|
Setup spatially uniform precipitation forcing (precip). |
|
Setup precipitation forcing from a gridded spatially varying data source. |
|
Setup pressure forcing from a gridded spatially varying data source. |
|
|
Setup spatially uniform wind forcing (wind). |
Setup pressure forcing from a gridded spatially varying data source. |
|
|
Create both index and topobathy tiles in webmercator format. |
Plot methods#
|
Create basemap plot. |
|
Plot model timeseries forcing. |
Attributes#
Returns the geometry of the active model cells. |
|
Returns model mask |
|
Returns the model crs |
|
Returns the resolution of the model grid. |
|
Path to model folder. |
|
Model configuration. |
|
Model static gridded data as xarray.Dataset. |
|
Model geometries. |
|
Model forcing. |
|
Model states. |
|
Model results. |
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. |
Low level methods#
Update grid properties based on config (sfincs.inp) attributes |
|
Update geospatial config (sfincs.inp) attributes based on grid |
|
|
Set 1D forcing time series for 'bzs' or 'dis' boundary conditions. |
Return (tstart, tstop) tuple with parsed model start and end time |
General methods#
|
Update config with a dictionary. |
|
Get a config value at key(s). |
|
Update the config dictionary at key(s) with values. |
|
Parse config from SFINCS input file. |
|
Write config to <root/config_fn> |
|
Add data to grid. |
|
Read SFINCS binary grid files and save to grid attribute. |
|
Write SFINCS grid to binary files including map index file. |
Read SFINCS subgrid file and add to subgrid attribute. |
|
Write SFINCS subgrid file. |
|
|
Add data to the geoms attribute. |
Read geometry files and save to geoms attribute. |
|
|
Write geoms to bnd/src/obs xy files and thd/weir structure files. |
|
Add data to forcing attribute. |
|
Read forcing files and save to forcing attribute. |
|
Write forcing to ascii or netcdf (netampr) files. |
|
Add data to states attribute. |
Read waterlevel state (zsini) from binary file and save to states attribute. |
|
Write waterlevel state (zsini) to binary map file. |
|
|
Add data to results attribute. |
|
Read results from sfincs_map.nc and sfincs_his.nc and save to the results attribute. |
SFINCS workflows#
|
Merge a list of data arrays by reprojecting these to a common destination grid and combine valid values. |
|
Return merged data from two data arrays. |
|
Burn rivers with a rectangular cross profile into a DEM. |
|
Snaps point locations to grid cell with smallest difference in upstream area within wdw around the original location if the local cell does not meet the error criteria. |
|
Returns the locations where a river flows in (inflow=True) or out (inflow=False) of the model gdf_mask. |
Returns the centerline of rivers based on a flow direction raster data (da_flwdir). |
|
Landuse related workflows for SFINCS. |
|
|
Convert Curve Numbers to potential maximum soil moisture retention S [inch]. |
|
Create webmercator topobathy tiles for a given region. |
Create a downscaled floodmap for (model) region in webmercator tile format |
SFINCS low-level methods#
Input/Output methods#
|
Read binary map. |
|
Write binary map file. |
|
Read binary map index file. |
|
Write flat index of binary map file. |
Read ascii map |
|
|
Write ascii map |
|
Read ascii timeseries files such as sfincs.bzs, sfincs.dis and sfincs.precip. |
|
Write pandas.DataFrame to fixed width ascii timeseries files such as sfincs.bzs, sfincs.dis and sfincs.precip. |
|
Read sfincs xy files and parse to GeoDataFrame. |
|
Write geopandas.GeoDataFrame with Point geometries to point xy files. |
|
|
|
|
|
Read structure files to list of dictionaries. |
|
Write list of structure dictionaries to file |
|
Read drainage structure files to geodataframe. |
|
Write structure files from list of dictionaries. |
|
Read sfincs_map.nc staggered grid netcdf files and parse to two hydromt.RasterDataset objects: one with face and one with edge variables. |
|
Read sfincs_his.nc point timeseries netcdf file and parse to hydromt.GeoDataset object. |
Utilities#
|
Checks and/or parses datetime from a string, default sfincs datetime string format |
|
Convert GeoDataFrame[LineString] to list of structure dictionaries |
|
Convert list of structure dictionaries to GeoDataFrame[LineString] |
|
Convert GeoDataFrame[Polygon] to list of structure dictionaries |
|
Convert list of structure dictionaries to GeoDataFrame[Polygon] |
|
Get bounds of vectorized mask as GeoDataFrame. |
|
Convert a boolean mask to a GeoDataFrame of polygons. |
|
Returns the origin (x0, y0), shape (mmax, nmax) and rotation of the rotated grid fitted to the minimum rotated rectangle around the area of interest (pol). |
Visualization#
|
Create basemap plot. |
|
Plot model timeseries forcing. |
|
Create a downscaled floodmap for (model) region. |
Create a downscaled floodmap for (model) region in webmercator tile format |