hydromt_sfincs.SfincsModel.setup_mask

SfincsModel.setup_mask(mask_fn=None, include_mask_fn=None, exclude_mask_fn=None, elv_min=None, elv_max=None, fill_area=10, drop_area=0, connectivity=8, all_touched=True, reset_mask=False, **kwargs)[source]

Creates mask of active model cells.

The SFINCS model mask defines 0) Inactive, 1) active, and 2) waterlevel boundary and 3) outflow boundary cells. This method sets the active cells set using, while boundary cells are set in the setup_bounds method.

Active model cells are based on 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.

NOTE: Inactive cells are set to nodata values in all staticmaps which cannot be undone!

Sets model layers:

  • msk map: model mask [-]

Parameters
  • mask_fn (str, optional) – Path or data source name of polygons describing the initial region with active model cells. If not given, the initial active model cells are based on valid elevation cells.

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

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

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

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

  • fill_area (float, optional) – Maximum area [km2] of contiguous cells below elv_min or above elv_max 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, reset existing mask layer. If False (default) updating existing mask. Note that previously set inactive cells can not be reset to active cells.