hydromt_sfincs.utils.mask_topobathy

hydromt_sfincs.utils.mask_topobathy(da_elv: ~xarray.core.dataarray.DataArray, gdf_mask: ~typing.Optional[~geopandas.geodataframe.GeoDataFrame] = None, gdf_include: ~typing.Optional[~geopandas.geodataframe.GeoDataFrame] = None, gdf_exclude: ~typing.Optional[~geopandas.geodataframe.GeoDataFrame] = None, elv_min: ~typing.Optional[float] = None, elv_max: ~typing.Optional[float] = None, fill_area: float = 10, drop_area: float = 0, connectivity: int = 8, all_touched=True, logger=<Logger hydromt_sfincs.utils (WARNING)>) DataArray[source]

Returns a boolean mask of valid (non nondata) elevation cells, optionally bounded by several criteria.

Parameters
  • da_elv (xr.DataArray) – Model elevation

  • gdf_mask (geopandas.GeoDataFrame, optional) – Geometry describing the initial region with active model cells. If not given, the initial active model cells are based on valid elevation cells.

  • gdf_include (geopandas.GeoDataFrame, optional) – Geometries with areas to include/exclude from the active model cells. 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.

  • gdf_exclude (geopandas.GeoDataFrame, optional) – Geometries with areas to include/exclude from the active model cells. 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 ({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.

Returns

model elevation mask

Return type

xr.DataArray