hydromt.flw.gauge_map#

hydromt.flw.gauge_map(ds: ~xarray.core.dataset.Dataset | ~xarray.core.dataarray.DataArray, idxs: ~numpy.ndarray | None = None, xy: ~typing.Tuple | None = None, ids: ~numpy.ndarray | None = None, stream: ~xarray.core.dataarray.DataArray | None = None, flwdir: ~pyflwdir.pyflwdir.FlwdirRaster | None = None, max_dist: float = 10000.0, logger=<Logger hydromt.flw (WARNING)>) Tuple[DataArray, ndarray, ndarray][source]#

Return map with unique gauge IDs.

Gauge locations should be provided by either x,y coordinates (xy) or linear indices (idxs). Gauge labels (ids) can optionally be provided, but are by default numbered starting at one.

If flwdir and stream are provided, the gauge locations are snapped to the nearest downstream river defined by the boolean stream mask. Else, the gauge locations

Parameters:
  • ds (xarray.Dataset) – Dataset or Dataarray with destination grid.

  • idxs (1D array or int, optional) – linear indices of gauges, by default is None.

  • xy (tuple of 1D array of float, optional) – x, y coordinates of gauges, by default is None.

  • ids (1D array of int32, optional) – IDs of gauges, values must be larger than zero. By default None and numbered on the fly.

  • flwdir (pyflwdir.FlwdirRaster, optional) – Flow direction raster object, by default None.

  • stream (2D array of bool, optional) – Mask of stream cells used to snap gauges to, by default None

  • max_dist (float, optional) – Maximum distance between original and snapped point location. A warning is logged if exceeded. By default 10 km.

  • logger (logger object, optional) – The logger object used for logging messages. If not provided, the default logger will be used.

Returns:

  • da_gauges (xarray.DataArray) – Map with unique gauge IDs

  • idxs (1D array or int) – linear indices of gauges

  • ids (1D array of int) – IDs of gauges