pyflwdir.FlwdirRaster.upscale#

FlwdirRaster.upscale(scale_factor: int, method: Literal['ihu', 'eam_plus', 'eam', 'dmm'] = 'ihu', uparea: ndarray | None = None, **kwargs) → tuple[FlwdirRaster, ndarray][source]#

Upscale a flow-direction network to a lower resolution.

Available methods are Iterative Hydrography Upscaling (IHU) [2], Effective Area Method (EAM) [3] and Double Maximum Method (DMM) [4].

This method supports D8 and LDD flow-direction data only.

Parameters:
  • scale_factor (int) – Number of high-resolution cells along each side of an upscaled cell.

  • method ({'ihu', 'eam_plus', 'eam', 'dmm'}) – Upscaling method, by default ‘ihu’.

  • uparea (2D array of float or int, optional) – Raster of upstream area. Calculated on the fly if not provided.

  • **kwargs (dict) – Additional keyword arguments passed to the selected upscaling method. For IHU, these include minlen_ratio, minupa_ratio, r_ratio, niter, opt_rivlen, min_error, and pit_out_of_cell.

Returns:

  • flw (FlwdirRaster) – Upscaled flow-direction raster.

  • idxs_out (2D array of int) – Linear indices of the high-resolution outlet cells corresponding to each upscaled cell.