hydromt_sfincs.SfincsModel.setup_mask_active#

SfincsModel.setup_mask_active(mask: str | Path | GeoDataFrame = None, include_mask: str | Path | GeoDataFrame = None, exclude_mask: str | Path | GeoDataFrame = None, mask_buffer: int = 0, zmin: float = None, zmax: float = None, fill_area: float = 10.0, drop_area: float = 0.0, connectivity: int = 8, all_touched: bool = True, reset_mask: bool = True)[source]#

Setup active model cells.

The SFINCS model mask defines inactive (msk=0), active (msk=1), and waterlevel boundary (msk=2) and outflow boundary (msk=3) cells. This method sets the active and inactive cells.

Active model cells are based on a region and cells with valid elevation (i.e. not nodata), optionally bounded by areas inside the include geomtries, outside the exclude geomtries, larger or equal than a minimum elevation threshhold and smaller or equal than a maximum elevation threshhold. All conditions are combined using a logical AND operation.

Sets model layers:

  • msk map: model mask [-]

Parameters:
  • mask (str, Path, gpd.GeoDataFrame, optional) – Path or data source name of polygons to initiliaze active mask with; proceding arguments can be used to include/exclude cells If not given, existing mask (if present) used, else mask is initialized empty.

  • include_mask (str, Path, gpd.GeoDataFrame, optional) – Path or data source name of polygons to include/exclude from the active model domain. Note that include (second last) and exclude (last) areas are processed after other critera, i.e. zmin, zmax and drop_area, and thus overrule these criteria for active model cells.

  • exclude_mask (str, Path, gpd.GeoDataFrame, optional) – Path or data source name of polygons to include/exclude from the active model domain. Note that include (second last) and exclude (last) areas are processed after other critera, i.e. zmin, zmax and drop_area, and thus overrule these criteria for active model cells.

  • mask_buffer (float, optional) – If larger than zero, extend the include_mask geometry with a buffer [m], by default 0.

  • zmin (float, optional) – Minimum and maximum elevation thresholds for active model cells.

  • zmax (float, optional) – Minimum and maximum elevation thresholds for active model cells.

  • fill_area (float, optional) – Maximum area [km2] of contiguous cells below zmin or above zmax but surrounded by cells within the valid elevation range to be kept as active cells, by default 10 km2.

  • drop_area (float, optional) – Maximum area [km2] of contiguous cells to be set as inactive cells, by default 0 km2.

  • connectivity – The connectivity used to define contiguous cells, if 4 only horizontal and vertical connections are used, if 8 (default) also diagonal connections.

  • {4 – The connectivity used to define contiguous cells, if 4 only horizontal and vertical connections are used, if 8 (default) also diagonal connections.

  • 8} – The connectivity used to define contiguous cells, if 4 only horizontal and vertical connections are used, if 8 (default) also diagonal connections.

  • all_touched (bool, optional) – if True (default) include (or exclude) a cell in the mask if it touches any of the include (or exclude) geometries. If False, include a cell only if its center is within one of the shapes, or if it is selected by Bresenham’s line algorithm.

  • reset_mask (bool, optional) – If True (default), reset existing mask layer. If False updating existing mask.