pyflwdir.gis_utils.spread2d#
- pyflwdir.gis_utils.spread2d(obs, msk=None, nodata=0, frc=None, latlon=False, transform=Affine(1.0, 0.0, 0.0, 0.0, -1.0, 0.0))[source]#
Returns filled array with nearest observations, origin cells and friction distance to origin. The friction distance is measured through valid cells in the mask and has a uniform value of 1. by default. The diagonal distance is taken as the hypot of the vertical and horizontal distances.
- Parameters:
osb (2D array) – Initial array with observations.
msk (2D array of bool, optional) – Mask of valid cells to consider for filling.
nodata (int, float) – Missing data value in obs. Cells with this value and where mask equals True are filled, by default 0.
frc (2D array of float) – Friction values, by default a uniform value of 1 is used.
latlon (bool) – True for geographic CRS, False for projected CRS. If True, the transform units are assumed to be degrees and converted to metric distances.
transform (Affine) – Coefficients mapping pixel coordinates to coordinate reference system.
- Returns:
out (2D array of obs.dtype) – Output observations array where nodata values are filled with the nearest observation.
src (2D array of int32) – Linear index of origin cell.
dst (2D array of float32) – Distance to origin cell.