hydromt.DataArray.raster.xy_to_idx#

DataArray.raster.xy_to_idx(xs, ys, mask=None, mask_outside=False, nodata=-1)#

Return linear index of x, y coordinates.

Parameters:
  • xs (ndarray of float) – x coordinates

  • ys (ndarray of float) – y coordinates

  • mask (ndarray of bool, optional) – data mask of valid values, by default None

  • mask_outside (boolean, optional) – mask xy points outside domain (i.e. set nodata), by default False

  • nodata (int, optional) – nodata value, used for output array, by default -1

Returns:

linear indices

Return type:

ndarray of int