raster_tools.distance.cda_allocation#

raster_tools.distance.cda_allocation(costs, sources, elevation=None, connectivity=8)[source]#

Calculate just the cost distance allocation for a cost surface.

See cost_distance_analysis for a full description.

Parameters
  • costs (Raster or raster path) – A raster representing a cost surface. Values less than 0 are treated as null values.

  • sources (Raster or raster path, or sequence) – A raster or sequence of indices. If a raster, pixels that are not null are used as source locations. The raster must have a null value set. The values at valid locations are used as the corresponding values in the allocation output. If a sequence, must have shape (M, 2) where M is the number of source pixels. Each item represents an index into costs to be used as a source. The element number, starting at 0, is used as the corresponding allocation value.

  • elevation (Raster or raster path, optional) – A raster containing elevation values on the same grid as costs. If provided, the elevation values are used when calculating the travel distance between pixels. This makes the algorithm 3D aware.

  • connectivity (int, optional) – The number of neighbor moves to allow. 8 (default) permits moves to all 8 neighbors; 4 restricts moves to the 4 orthogonal neighbors. Any other value raises a ValueError.

Returns

allocation – The allocation result. This is the same shape as the costs input Raster.

Return type

Raster

See also

cost_distance_analysis

Full cost distance solution