Proximity#

Warning

proximity() with distance_metric='EUCLIDEAN' (the default) returns distances in the coordinate units of the DataArray. With default integer indices this equals pixel counts. Use 'GREAT_CIRCLE' for lat/lon data (returns metres).

Caution

With Dask, proximity() expands each chunk by max_distance cells. If max_distance is infinite (the default), the whole array is loaded into a single chunk. Set a finite max_distance to keep memory bounded.

Caution

proximity(), allocation(), and direction() require monotonic 1D x and y coordinates (strictly increasing or strictly decreasing). A non-monotonic axis raises a ValueError; sort the raster along that axis first.

Allocation#

xrspatial.proximity.allocation(raster[, x, ...])

Calculates, for all pixels in the input raster, the nearest source based on a set of target values and a distance metric.

Direction#

xrspatial.proximity.direction(raster[, x, ...])

Calculates, for all cells in the array, the downward slope direction Calculates, for all pixels in the input raster, the direction to nearest source based on a set of target values and a distance metric.

Proximity#

xrspatial.proximity.euclidean_distance(x1, ...)

Calculates Euclidean (straight line) distance between (x1, y1) and (x2, y2).

xrspatial.proximity.great_circle_distance(x1, ...)

Calculates great-circle (orthodromic/spherical) distance between (x1, y1) and (x2, y2), assuming each point is a longitude, latitude pair.

xrspatial.proximity.manhattan_distance(x1, ...)

Calculates Manhattan distance (sum of distance in x and y directions) between (x1, y1) and (x2, y2).

xrspatial.proximity.proximity(raster[, x, ...])

Computes the proximity of all pixels in the image to a set of pixels in the source image based on a distance metric.

Cost Distance#

xrspatial.cost_distance.cost_distance(...[, ...])

Compute accumulated cost-distance through a friction surface.

Least-Cost Corridor#

xrspatial.corridor.least_cost_corridor(friction)

Compute a least-cost corridor between two source regions.

Balanced Allocation#

xrspatial.balanced_allocation.balanced_allocation(...)

Partition a cost surface into balanced service territories.

Surface Distance#

xrspatial.surface_distance.surface_distance(...)

Compute surface distance along terrain to nearest target pixel.

Surface Allocation#

xrspatial.surface_distance.surface_allocation(...)

Compute nearest-target allocation along terrain surface.

Surface Direction#

xrspatial.surface_distance.surface_direction(...)

Compute compass direction to nearest target along terrain surface.