hydromt_sfincs.components.grid.SfincsMask.create_active#
- SfincsMask.create_active(zmin: float = None, zmax: float = None, include_polygon: str | Path | GeoDataFrame = None, include_zmin: float = None, include_zmax: float = None, exclude_polygon: str | Path | GeoDataFrame = None, exclude_zmin: float = None, exclude_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]#
Create an integer mask with inactive (mask=0) and active (mask=1) cells, optionally bounded by several criteria.
- Parameters:
zmin (
float, optional) – Minimum and maximum elevation thresholds for active model cells.zmax (
float, optional) – Minimum and maximum elevation thresholds for active model cells.include_polygon (
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_polygon (
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.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 (
{4, 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.