xrspatial.surface_distance.surface_direction#

xrspatial.surface_distance.surface_direction(raster: DataArray, elevation: DataArray, x: str = 'x', y: str = 'y', target_values: list = [], max_distance: float = inf, connectivity: int = 8, method: str = 'planar') DataArray[source]#

Compute compass direction to nearest target along terrain surface.

For each pixel, returns the compass direction (in degrees) to the nearest target pixel by surface distance. 0 = source pixel, 90 = east, 180 = south, 270 = west, 360 = north.

Parameters:
Returns:

2-D array of direction values (float32, degrees).

Return type:

xr.DataArray or xr.Dataset