hydromt_sfincs.workflows.snap_discharge#

hydromt_sfincs.workflows.snap_discharge(ds: ~xarray.core.dataset.Dataset, gdf: ~geopandas.geodataframe.GeoDataFrame, wdw: int = 1, rel_error: float = 0.05, abs_error: float = 50, uparea_name: str = 'uparea', discharge_name: str = 'discharge', logger=<Logger hydromt_sfincs.workflows.discharge (WARNING)>) DataArray[source]#

Snaps point locations to grid cell with smallest difference in upstream area within wdw around the original location if the local cell does not meet the error criteria. Both the upstream area variable named uparea_name in ds and gdf as well as abs_error should have the same unit (typically km2).

Parameters:
  • ds (xarray.Dataset) – Dataset with discharge and optional uparea variable.

  • gdf (geopandas.GeoDataFrame[Points]) – Dataframe with Point geometries of locations of interest.

  • wdw (int, optional) – Window size in number of cells around discharge boundary locations to snap to, only used if uparea_fn is provided. By default 1.

  • rel_error (float, optional) – Maximum relative error (default 0.05) and absolute error (default 50 km2) between the discharge boundary location upstream area and the upstream area of the best fit grid cell, only used if “discharge” staticgeoms has a “uparea” column.

  • abs_error (float, optional) – Maximum relative error (default 0.05) and absolute error (default 50 km2) between the discharge boundary location upstream area and the upstream area of the best fit grid cell, only used if “discharge” staticgeoms has a “uparea” column.

Returns:

ds – snapped dataset

Return type:

xarray.Dataset