API#

SFINCS Model class#

The hydromt_sfincs.SfincsModel class is the main entry point to read, write, build, and update SFINCS models using HydroMT. It uses the functionalities provided by the reusable components defined in the hydromt_sfincs.components module.

SfincsModel([root, mode, write_gis, ...])

SFINCS model class.

Methods#

SfincsModel.read()

Read SfincsModel from disk.

SfincsModel.write([write_batch_file, ...])

Write SfincsModel to disk.

SfincsModel.build(*[, write])

Single method to build a model from scratch based on settings in steps.

SfincsModel.update(*[, model_out, write, ...])

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

Plot methods#

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

Create basemap plot.

SfincsModel.plot_forcing([fn_out, forcings])

Plot model timeseries forcing.

Attributes#

SfincsModel.root

Model root

SfincsModel.crs

Returns the model crs

SfincsModel.region

Returns the geometry of the active model cells.

SfincsModel.bbox

Returns the bounding box in WGS 84 of the model grid.

Components#

The hydromt_sfincs.components module defines reusable data container classes that represent configuration, grid, geometries, boundary conditions, outputs, and other model data.

Configuration#

components.config.SfincsConfig(model)

" Class to read and write SFINCS configuration files (sfincs.inp).

components.config.SfincsConfig.data

Return the Pydantic SfincsConfigVariables object.

components.config.SfincsConfig.read()

Read a text file with the sfincs configuration from the root folder and populate the SfincsConfigVariables.

components.config.SfincsConfig.write([...])

Write the SfincsConfigVariables to a text file in the root folder of the model.

components.config.SfincsConfig.update([...])

Update attributes using a dictionary or keyword arguments.

components.config.SfincsConfig.update_grid_from_config()

Update the grid properties from the configuration.

components.config.SfincsConfig.get(key[, ...])

Get the value for a specific key with validation check.

components.config.SfincsConfig.set(key, value)

Set a value for a specific key with validation using Pydantic's model_validate.

components.config.SfincsConfig.get_set_file_variable(key)

Return the absolute file path for a given 'key'.

components.config.SfincsConfigVariables

SFINCS configuration variables with defaults matching sfincs_input.f90.

Grid#

The regular-grid component’s data property contains the complete gridded dataset. The individual grid components (for example, elevation, mask, and roughness) also provide a data property, but that property exposes only the layer or layers relevant to that component. These are component-specific views of data stored on the shared grid; they are not separate data stores. To add or replace a layer, use the parent grid’s set() method.

The grid reads and writes the cell index, mask, and elevation maps. Other component-owned maps are read and written by their components through the grid’s internal layer I/O methods. When SfincsGrid.write() is called with write_components=True, it also calls the owning components’ write() methods. Regular-grid infiltration layers are stored in their configured binary map files; subgrid tables are managed by the subgrid component.

components.grid.SfincsGrid(model)

Regular grid component of the SfincsModel class.

components.grid.SfincsGrid.data

Model static gridded data as xarray.Dataset.

components.grid.SfincsGrid.read([...])

Read SFINCS binary grid files and save to data attribute.

components.grid.SfincsGrid.write([...])

Write SFINCS grid to binary files including map index file.

components.grid.SfincsGrid.create(x0, y0, ...)

Create a regular grid for the SfincsModel.

components.grid.SfincsGrid.create_from_region(region)

Create a regular grid for the SfincsModel based on a region.

components.grid.SfincsGrid._read_layers(...)

Read SFINCS binary maps into data, one file per variable.

components.grid.SfincsGrid._write_layers(...)

Write variables from data as SFINCS binary maps, one file per variable.

components.grid.SfincsGrid.read_map(map_fn, ind)

Read one of the grid variables of the SFINCS model map from a binary file.

components.grid.SfincsGrid.write_map(map_fn, ...)

Write one of the grid variables of the SFINCS model map to a binary file.

components.grid.SfincsElevation(model)

SFINCS Elevation Component.

components.grid.SfincsElevation.data

Return only the available elevation layer from the model grid.

components.grid.SfincsElevation.create(...)

Interpolate topobathy (dep) data to the model grid.

components.grid.SfincsMask(model)

SFINCS Mask Component.

components.grid.SfincsMask.data

Return only the available mask layer from the model grid.

components.grid.SfincsMask.create_active([...])

Create an integer mask with inactive (mask=0) and active (mask=1) cells, optionally bounded by several criteria.

components.grid.SfincsMask.create_boundary([...])

Set boundary cells in the model mask.

components.grid.SfincsRoughness(model)

SFINCS Roughness Component.

components.grid.SfincsRoughness.data

Return only the available roughness layers from the model grid.

components.grid.SfincsRoughness.read()

Read the manning roughness map from its own binary file.

components.grid.SfincsRoughness.write()

Write the manning roughness map to its own binary file.

components.grid.SfincsRoughness.create([...])

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.

components.grid.SfincsInfiltration(model)

SFINCS infiltration component for regular grids.

components.grid.SfincsInfiltration.data

Return only the available infiltration layers from the model grid.

components.grid.SfincsInfiltration.read()

Read the infiltration layers from their own files.

components.grid.SfincsInfiltration.write()

Write each regular-grid infiltration layer to its own binary file.

components.grid.SfincsInfiltration.create_uniform_constant(qinf)

Create a uniform constant infiltration rate in model config.

components.grid.SfincsInfiltration.create_constant([...])

Create spatially varying constant infiltration rate.

components.grid.SfincsInfiltration.create_cn(cn)

Create Curve Number infiltration without recovery.

components.grid.SfincsInfiltration.create_cn_from_landuse_hsg(...)

Create Curve Number infiltration from land use and HSG.

components.grid.SfincsInfiltration.create_cn_with_recovery(...)

Create Curve Number infiltration with recovery.

components.grid.SfincsInfiltration.create_green_ampt(hsg)

Estimate Green-Ampt infiltration from HSG and optional landuse.

components.grid.SfincsInfiltration.create_green_ampt_from_maps(...)

Create Green-Ampt infiltration from final parameter maps.

components.grid.SfincsInfiltration.create_horton(hsg)

Estimate Horton infiltration from HSG and optional landuse.

components.grid.SfincsInfiltration.create_horton_from_maps(f0, ...)

Create Horton infiltration from final parameter maps.

components.grid.SfincsInitialConditions(model)

SFINCS Initial Conditions Component.

components.grid.SfincsInitialConditions.data

Return only the available initial-condition layers from the grid.

components.grid.SfincsInitialConditions.read()

Read the initial water level map from its own binary file.

components.grid.SfincsInitialConditions.write()

Write the initial water level map to its own binary file.

components.grid.SfincsInitialConditions.create(zsini)

Setup spatially varying initial water level (inifile).

components.grid.SfincsStorageVolume(model)

SFINCS Storage Volume Component.

components.grid.SfincsStorageVolume.data

Return only the available storage volume layers from the model grid.

components.grid.SfincsStorageVolume.read()

Read the storage volume map from its own binary file.

components.grid.SfincsStorageVolume.write()

Write the storage volume map to its own binary file.

components.grid.SfincsStorageVolume.create(...)

Create storage volume.

components.grid.SfincsSubgridTable(model[, ...])

SFINCS Subgrid Table Component.

components.grid.SfincsSubgridTable.data

Model static gridded data as xarray.Dataset.

components.grid.SfincsSubgridTable.read([...])

Load subgrid table from file for a regular grid with given mask.

components.grid.SfincsSubgridTable.write([...])

Write subgrid table to file for a regular grid with given mask.

components.grid.SfincsSubgridTable.create(...)

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

Quadtree#

The quadtree grid’s data property contains the complete mesh dataset. Individual quadtree components expose their relevant layer or layers through their own data properties. These are component-specific views of data stored on the shared quadtree grid, not separate data stores; use the parent grid’s set() method to add or replace a layer. The component views retain the mesh topology.

The mask, elevation, and any quadtree-specific variables are stored in the main quadtree file (qtrfile). Other component-owned variables are written to standalone UGRID netCDF files by their components. Calling SfincsQuadtreeGrid.write() with write_components=True also invokes those component writers. Quadtree infiltration, including bucket variables, is stored in inffile; inftype identifies the flavor. The subgrid table is managed separately by its subgrid component.

components.quadtree.SfincsQuadtreeGrid(model)

Quadtree grid component attached to an SfincsModel.

components.quadtree.SfincsQuadtreeGrid.data

Model static mesh data.

components.quadtree.SfincsQuadtreeGrid.read([...])

Reads a quadtree netcdf file and stores it in the QuadtreeGrid object.

components.quadtree.SfincsQuadtreeGrid._read_layers(...)

Read face variables from a standalone UGRID netcdf file into data.

components.quadtree.SfincsQuadtreeGrid._write_layers(...)

Write face variables to a standalone UGRID netcdf file.

components.quadtree.SfincsQuadtreeGrid.write([...])

Writes a quadtree SFINCS netcdf file.

components.quadtree.SfincsQuadtreeGrid.create(x0, ...)

Build the Quadtree grid.

components.quadtree.SfincsQuadtreeGrid.create_from_region(region)

Setup a quadtree grid from a region.

components.quadtree.SfincsQuadtreeElevation(model)

Elevation stored as z in the quadtree grid.

components.quadtree.SfincsQuadtreeElevation.data

Return only elevation, retaining the mesh even before it is created.

components.quadtree.SfincsQuadtreeElevation.read()

Ensure the parent grid is loaded, including elevation in qtrfile.

components.quadtree.SfincsQuadtreeElevation.write()

Leave elevation persistence in qtrfile to the parent grid.

components.quadtree.SfincsQuadtreeElevation.create(...)

Interpolate topobathy (z) data to the model grid.

components.quadtree.SfincsQuadtreeElevation.create_uniform(zb)

components.quadtree.SfincsQuadtreeMask(model)

Mask stored in the shared quadtree grid.

components.quadtree.SfincsQuadtreeMask.data

Return only this mask, retaining the parent mesh.

components.quadtree.SfincsQuadtreeMask.read()

Ensure the parent grid is loaded, including masks in qtrfile.

components.quadtree.SfincsQuadtreeMask.write()

Leave mask persistence in qtrfile to the parent grid.

components.quadtree.SfincsQuadtreeMask.create_active([...])

Setup active model cells.

components.quadtree.SfincsQuadtreeMask.create_boundary([...])

Set boundary cells in the model mask.

components.quadtree.SfincsQuadtreeRoughness(model)

components.quadtree.SfincsQuadtreeRoughness.data

Return only roughness layers, retaining the parent mesh.

components.quadtree.SfincsQuadtreeRoughness.read()

Read the manning roughness layer from its own file.

components.quadtree.SfincsQuadtreeRoughness.write()

Write the manning roughness layer to its own file.

components.quadtree.SfincsQuadtreeRoughness.create(...)

Interpolate roughness (Manning's n) data to the model grid.

components.quadtree.SfincsQuadtreeInfiltration(model)

SFINCS infiltration component for quadtree grids.

components.quadtree.SfincsQuadtreeInfiltration.data

Return only infiltration layers, retaining the parent mesh.

components.quadtree.SfincsQuadtreeInfiltration.read()

Read the infiltration layers from their own file.

components.quadtree.SfincsQuadtreeInfiltration.write()

Write the infiltration layers to their own file.

components.quadtree.SfincsQuadtreeInfiltration.create_uniform_constant(qinf)

Create a uniform constant infiltration rate in model config.

components.quadtree.SfincsQuadtreeInfiltration.create_constant([...])

Create spatially varying constant infiltration rate.

components.quadtree.SfincsQuadtreeInfiltration.create_cn(cn)

Create Curve Number infiltration without recovery for quadtree grids.

components.quadtree.SfincsQuadtreeInfiltration.create_cn_from_landuse_hsg(...)

Create Curve Number infiltration from land use and HSG.

components.quadtree.SfincsQuadtreeInfiltration.create_cn_with_recovery(...)

Create Curve Number infiltration with recovery for quadtree grids.

components.quadtree.SfincsQuadtreeInfiltration.create_green_ampt(hsg)

Estimate Green-Ampt infiltration from HSG and optional landuse.

components.quadtree.SfincsQuadtreeInfiltration.create_green_ampt_from_maps(...)

Create Green-Ampt infiltration from final parameter maps.

components.quadtree.SfincsQuadtreeInfiltration.create_horton(hsg)

Estimate Horton infiltration from HSG and optional landuse.

components.quadtree.SfincsQuadtreeInfiltration.create_horton_from_maps(f0, ...)

Create Horton infiltration from final parameter maps.

components.quadtree.SfincsQuadtreeInfiltration.create_bucket(hsg)

Estimate bucket infiltration from HSG and optional landuse.

components.quadtree.SfincsQuadtreeInfiltration.create_bucket_from_maps(...)

Create bucket infiltration from final parameter maps.

components.quadtree.SfincsQuadtreeInfiltration.create_runoff_coefficient([...])

Create a spatially varying constant run-off coefficient.

components.quadtree.SfincsQuadtreeInitialConditions(model)

SFINCS initial conditions component for quadtree grids.

components.quadtree.SfincsQuadtreeInitialConditions.data

Return only initial-condition layers, retaining the parent mesh.

components.quadtree.SfincsQuadtreeInitialConditions.read()

Read the initial water level layer from its own file.

components.quadtree.SfincsQuadtreeInitialConditions.write()

Write the initial water level layer to its own file.

components.quadtree.SfincsQuadtreeInitialConditions.create(zsini)

Setup spatially varying initial water level (ncinifile).

components.quadtree.SfincsQuadtreeInitialConditions.create_from_polygon(zsini)

Setup spatially varying initial water level (ncinifile).

components.quadtree.SfincsQuadtreeStorageVolume(model)

SFINCS storage volume component for quadtree grids.

components.quadtree.SfincsQuadtreeStorageVolume.data

Return only storage volume layers, retaining the parent mesh.

components.quadtree.SfincsQuadtreeStorageVolume.read()

Read the storage volume layer from its own file.

components.quadtree.SfincsQuadtreeStorageVolume.write()

Write the storage volume layer to its own file.

components.quadtree.SfincsQuadtreeStorageVolume.create(...)

Setup storage volume.

components.quadtree.SfincsQuadtreeSubgridTable(model)

components.quadtree.SfincsQuadtreeSubgridTable.read([...])

Read SFINCS subgrid table (*.nc) file for Quadree grid

components.quadtree.SfincsQuadtreeSubgridTable.write([...])

Write SFINCS subgrid table (*.sbg) file for Quadree grid

components.quadtree.SfincsQuadtreeSubgridTable.create(...)

Build SFINCS subgrid table for quadtree grid

components.quadtree.SnapWaveQuadtreeMask(model)

components.quadtree.SnapWaveQuadtreeMask.data

Return only this mask, retaining the parent mesh.

components.quadtree.SnapWaveQuadtreeMask.create([...])

Setup active model snapwave mask and add boundaries.

components.quadtree.SnapWaveQuadtreeMask.create_active([...])

Setup active model cells.

components.quadtree.SnapWaveQuadtreeMask.create_boundary([...])

Set boundary cells in the model mask.

Geometries#

components.geometries.SfincsObservationPoints(model)

SFINCS Observation Points Component.

components.geometries.SfincsObservationPoints.data

Observation point data, returned as a GeoDataFrame.

components.geometries.SfincsObservationPoints.read([...])

Read SFINCS observation points (.obs) file.

components.geometries.SfincsObservationPoints.write([...])

Write SFINCS observation points (.obs) file, and set obsfile in config (if it was not already set)

components.geometries.SfincsObservationPoints.create(...)

Create model observation point locations.

components.geometries.SfincsCrossSections(model)

SFINCS Cross-Sections Component.

components.geometries.SfincsCrossSections.data

Cross-section lines data, returned as a GeoDataFrame.

components.geometries.SfincsCrossSections.read([...])

Read ascii SFINCS cross-sections (.crs) file.

components.geometries.SfincsCrossSections.write([...])

Write ascii SFINCS cross-sections (.crs) file, and set crsfile in config (if it was not already set).

components.geometries.SfincsCrossSections.create(...)

Create model cross-sections (old name: setup_observation_lines)

components.geometries.SfincsThinDams(model)

SFINCS thin dams geometry component.

components.geometries.SfincsThinDams.data

Thin dam data, returned as a GeoDataFrame.

components.geometries.SfincsThinDams.read([...])

Read SFINCS thin dams (.thd) file.

components.geometries.SfincsThinDams.write([...])

Write SFINCS thin dams (.thd) file, and set thdfile in config (if it was not already set)

components.geometries.SfincsThinDams.create(...)

Create model thin dams (old name: setup_structures).

components.geometries.SfincsWeirs(model)

SFINCS weir geometry component.

components.geometries.SfincsWeirs.data

Weirs lines data, returned as a GeoDataFrame.

components.geometries.SfincsWeirs.read([...])

Read SFINCS weir (.weir) file.

components.geometries.SfincsWeirs.write([...])

Write SFINCS weir (.weir) file, and set weirfile in config (if it was not already set).

components.geometries.SfincsWeirs.create(...)

Create model weir lines (old name: setup_structures).

components.geometries.SfincsDrainageStructures(model)

SFINCS drainage structures component.

components.geometries.SfincsDrainageStructures.data

Drainage structures data, returns geopandas.GeoDataFrame

components.geometries.SfincsDrainageStructures.read([...])

Read SFINCS drainage structures (.drn) file.

components.geometries.SfincsDrainageStructures.write([...])

Write SFINCS drainage structures (.drn) file, and make sure drnfile is in config (if it was not already set).

components.geometries.SfincsDrainageStructures.create(...)

Create drainage structures such as pumps, culverts, valves, or gates (old name: setup_drainage_structures).

Forcing#

components.forcing.SfincsWaterLevel(model)

Water level boundary component for SFINCS models.

components.forcing.SfincsWaterLevel.data

Get the internal xarray dataset/dataarray containing point timeseries and geometry information.

components.forcing.SfincsWaterLevel.read([...])

Read SFINCS boundary conditions (.bnd, .bzs, .bca files) or netcdf file.

components.forcing.SfincsWaterLevel.write([...])

Write SFINCS boundary conditions (.bnd, .bzs, .bca files) or netcdf file.

components.forcing.SfincsWaterLevel.create([...])

Setup waterlevel forcing.

components.forcing.SfincsWaterLevel.create_timeseries([...])

Applies time series boundary conditions for each point Create numpy datetime64 array for time series with python datetime.datetime objects

components.forcing.SfincsWaterLevel.create_timeseries_from_astro([...])

Generates boundary time series file from astronomical components

components.forcing.SfincsWaterLevel.create_boundary_points_from_mask([...])

Get boundary points from waterlevel boundary cells of mask in grid or quadtree grid.

components.forcing.SfincsDischargePoints(model)

Discharge point component for SFINCS models.

components.forcing.SfincsDischargePoints.data

Get the internal xarray dataset/dataarray containing point timeseries and geometry information.

components.forcing.SfincsDischargePoints.read([...])

Read SFINCS discharge points (.dis, .src files) or netcdf file.

components.forcing.SfincsDischargePoints.write([...])

Write SFINCS discharges (.src, .dis files) or netcdf file.

components.forcing.SfincsDischargePoints.create([...])

Setup discharge forcing.

components.forcing.SfincsDischargePoints.create_timeseries([...])

Applies time series discharges for each point Create numpy datetime64 array for time series with python datetime.datetime objects

components.forcing.SfincsPrecipitation(model)

SFINCS precipitation forcing.

components.forcing.SfincsPrecipitation.data

Meteo data.

components.forcing.SfincsPrecipitation.read([...])

Read precipitation data from file.

components.forcing.SfincsPrecipitation.write([...])

Write meteo data to file.

components.forcing.SfincsPrecipitation.create(precip)

Setup precipitation forcing from a gridded spatially varying data source.

components.forcing.SfincsPrecipitation.create_uniform([...])

Setup spatially uniform precipitation forcing (precip).

components.forcing.SfincsPressure(model)

components.forcing.SfincsPressure.data

Meteo data.

components.forcing.SfincsPressure.read([...])

Read meteo data from file.

components.forcing.SfincsPressure.write([...])

Write meteo data to file.

components.forcing.SfincsPressure.create(press)

Setup pressure forcing from a gridded spatially varying data source.

components.forcing.SfincsWind(model)

components.forcing.SfincsWind.data

Meteo data.

components.forcing.SfincsWind.read([filename])

Read meteo data from file.

components.forcing.SfincsWind.write([...])

Write meteo data to file.

components.forcing.SfincsWind.create(wind[, ...])

Setup wind forcing from a gridded spatially varying data source.

components.forcing.SfincsWind.create_uniform([...])

Setup spatially uniform wind forcing (wind).

components.forcing.SfincsRivers(model)

This class contains functions to create and manage river inflow/outflow points in the SFINCS model.

components.forcing.SfincsRivers.data

River geometry data.

components.forcing.SfincsRivers.read()

Read the file(s) into the component.

components.forcing.SfincsRivers.write()

Write the river inflow data to a gis-file.

components.forcing.SfincsRivers.create_river_inflow([...])

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

Output#

components.output.SfincsOutput(model)

SFINCS model output component.

SFINCS workflows#

workflows.merge_multi_dataarrays(da_list[, ...])

Merge a list of data arrays by reprojecting these to a common destination grid and combine valid values.

workflows.merge_dataarrays(da1, da2[, ...])

Return merged data from two data arrays.

workflows.burn_river_rect(da_elv, gdf_riv[, ...])

Burn rivers with a rectangular cross profile into a DEM.

workflows.snap_discharge(ds, gdf[, wdw, ...])

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.

workflows.river_source_points(gdf_riv, gdf_mask)

Returns the locations where a river flows in (inflow=True) or out (inflow=False) of the model gdf_mask.

workflows.river_centerline_from_hydrography(...)

Returns the centerline of rivers based on a flow direction raster data (da_flwdir).

Infiltration#

Estimation maths only; these take already-read arrays and tables and return SFINCS parameter maps. Reading data and writing config is done by the infiltration components.

workflows.mask_invalid_ksat(da_ksat)

Return Ksat as float32 with nodata and negative values set to NaN.

workflows.normalize_hsg_codes(da_hsg[, mode])

Normalize single- and dual-HSG classes to the requested convention.

workflows.cn_to_s(da_cn[, da_mask, nodata, ...])

Convert curve numbers to potential maximum soil moisture retention S.

workflows.curve_number_from_landuse_hsg(...)

Map land-use and HSG classes to curve numbers.

workflows.adjust_curve_number(da_cn[, ...])

Adjust CN-II values to a requested antecedent moisture condition.

workflows.curve_number_with_recovery(...[, ...])

Estimate SCS curve-number-with-recovery parameters.

workflows.constant_infiltration_from_ksat_lulc(...)

Estimate spatially varying constant infiltration from Ksat and land use.

workflows.green_ampt_from_hsg(da_hsg, df_map, *)

Estimate Green-Ampt parameters from HSG classes and optional Ksat.

workflows.green_ampt_from_hsg_landuse(...[, ...])

Estimate Green-Ampt parameters from soil classes, Ksat, and land use.

workflows.horton_from_hsg(da_hsg, df_map, *)

Estimate Horton parameters from HSG classes and optional Ksat.

workflows.horton_from_hsg_landuse(da_hsg, ...)

Estimate Horton parameters from soil classes, Ksat, and land use.

workflows.bucket_from_hsg(da_hsg, df_map, *)

Estimate bucket parameters from HSG classes and optional Ksat.

workflows.bucket_from_hsg_landuse(da_hsg, ...)

Estimate bucket parameters from soil classes, Ksat, and land use.

Flood map downscaling#

workflows.downscaling.downscale_floodmap(...)

Create a downscaled floodmap for (model) region.

workflows.downscaling.adjust_zsmax_dilation(...)

Cell-space WSE dilation pre-step — works on both quadtree and regular grids.

workflows.downscaling.adjust_zsmax_energyhead(...)

Add the velocity head v²/(2g) to zsmax (Bernoulli correction).

workflows.downscaling.remove_disconnected_flooding(...)

Remove disconnected flooding from a downscaled depth raster.

workflows.cog.create_index_cog(model, ...[, ...])

Make a Cloud Optimized GeoTIFF (COG) file with the corresponding indices of the SFINCS grid cells to the high-resolution DEM COG.

workflows.cog.create_topobathy_cog(model, ...)

Write a Cloud Optimized GeoTIFF (COG) with merged topobathy data.

SFINCS low-level methods#

Input/Output methods#

readers.read_binary_map(fn, ind, shape[, ...])

Read binary map.

writers.write_binary_map(fn, data, msk[, dtype])

Write binary map file.

readers.read_binary_map_index(fn_ind)

Read binary map index file.

writers.write_binary_map_index(fn_ind, msk)

Write flat index of binary map file.

readers.read_ascii_map(fn)

Read ascii map

writers.write_ascii_map(fn, data[, fmt])

Write ascii map

readers.read_timeseries(fn, tref)

Read ascii timeseries files such as sfincs.bzs, sfincs.dis and sfincs.precip.

writers.write_timeseries(fn, df, tref[, fmt])

Write pandas.DataFrame to fixed width ascii timeseries files such as sfincs.bzs, sfincs.dis and sfincs.precip.

readers.read_xy(fn[, crs])

Read sfincs xy files and parse to GeoDataFrame.

writers.write_xy(path, gdf[, fmt])

Write geopandas.GeoDataFrame with Point geometries to point xy files.

readers.read_xyn(fn[, crs])

Read xyn files.

writers.write_xyn([fn, gdf, fmt])

Write xyn files, for example observation points with names.

readers.read_geoms(fn)

Read structure files to list of dictionaries.

writers.write_geoms(fn, feats[, stype, fmt, ...])

Write list of structure dictionaries to file

readers.read_drn(fn[, crs])

Read drainage structure files to geodataframe.

writers.write_drn(fn, gdf_drainage[, fmt])

Write structure files from list of dictionaries.

readers.read_sfincs_map_results(fn_map, ds_like)

Read sfincs_map.nc staggered grid netcdf files and parse to two hydromt.RasterDataset objects: one with face and one with edge variables.

readers.read_sfincs_his_results(fn_his[, ...])

Read sfincs_his.nc point timeseries netcdf file and parse to hydromt.GeoDataset object.

Utilities#

utils.parse_datetime(dt[, format])

Checks and/or parses datetime from a string, default sfincs datetime string format

utils.gdf2linestring(gdf)

Convert GeoDataFrame[LineString] to list of structure dictionaries

utils.linestring2gdf(feats[, crs])

Convert list of structure dictionaries to GeoDataFrame[LineString]

utils.gdf2polygon(gdf)

Convert GeoDataFrame[Polygon] to list of structure dictionaries

utils.polygon2gdf(feats[, crs, zmin, zmax])

Convert list of structure dictionaries to GeoDataFrame[Polygon]

utils.get_bounds_vector(da_msk)

Get bounds of vectorized mask as GeoDataFrame.

utils.mask2gdf(da_mask[, option])

Convert a boolean mask to a GeoDataFrame of polygons.

utils.rotated_grid(pol, res[, dec_origin, ...])

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#

plots.plot_basemap(ds, geoms[, variable, ...])

Create basemap plot.

plots.plot_forcing(forcing, **kwargs)

Plot model timeseries forcing.