hydromt_sfincs.utils.mask_bounds

hydromt_sfincs.utils.mask_bounds(da_msk: DataArray, da_elv: Optional[DataArray] = None, gdf_mask: Optional[GeoDataFrame] = None, gdf_include: Optional[GeoDataFrame] = None, gdf_exclude: Optional[GeoDataFrame] = None, elv_min: Optional[float] = None, elv_max: Optional[float] = None, connectivity: int = 8, all_touched=False) DataArray[source]

Returns a boolean mask model boundary cells, optionally bounded by several criteria. Boundary cells are defined by cells at the edge of active model domain.

Parameters
  • da_msk (xr.DataArray) – Model mask and elevation data.

  • da_elv (xr.DataArray) – Model mask and elevation data.

  • gdf_mask (geopandas.GeoDataFrame, optional) – Geometry describing the initial region constraining model boundary cells.

  • gdf_include (geopandas.GeoDataFrame) – Geometries with areas to include/exclude from the model boundary. Note that exclude (second last) and include (last) areas are processed after other critera, i.e. elv_min, elv_max, and thus overrule these criteria for model boundary cells.

  • gdf_exclude (geopandas.GeoDataFrame) – Geometries with areas to include/exclude from the model boundary. Note that exclude (second last) and include (last) areas are processed after other critera, i.e. elv_min, elv_max, and thus overrule these criteria for model boundary cells.

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

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

  • connectivity ({4, 8}) – The connectivity used to detect the model edge, 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.

Returns

bounds – Boolean mask of model boundary cells.

Return type

xr.DataArray