cost¶
This module contains functions to calculate an (euclidean) and influence weighted distance transform
Functions
calculate_dt |
calculates euclidean distance transform. |
calculate_iwdt |
calculates influence weighted distance transform |
-
calculate_dt()¶ calculates euclidean distance transform.
Parameters: - dt (2D numpy array) – array with source cells initiated to zero and remaining cells to a large none-zero value (typically 999999.0)
- cellsize (float) – cellsize
- option (int) –
parameter used to determine the output:
- Returns dt, blx, bly (backlinks). Default
- Return dt only
- Returns blx, bly (backlinks)
Returns: - dt (2D numpy array, *optional*) – distance transform
- blx, bly (2D numpy arrays, *optional*) – distance transform backlinks
Notes
This is a wrapper for the cython function
cy_calculate_dt()
-
calculate_iwdt()¶ calculates influence weighted distance transform
Parameters: - iwdt (2D numpy array) – array with source cells initiated to zero and remaining cells to a large none-zero value (typically 999999.0)
- iwdt_dict (dictionary) – dictionary containing information needed to calculate iwdt (see Notes below)
- option (int) –
parameter used to determine the output:
- Returns iwdt, blx, bly (backlinks). Default
- Return iwdt only
- Returns blx, bly (backlinks)
Returns: - iwdt (2D numpy array, *optional*) – influence weighted distance transform
- blx, bly (2D numpy arrays, *optional*) – influence weighted distance transform backlinks
Notes
Wrapper function for the cython function
cy_calculate_iwdt(). To calculate influence weighted distance transform, it is necessary to generate a dictionary (iwdt_dict{}) with the following entries:- ‘dem:’ - 2D numpy array array with elevation data
- ‘netcost:’ - 2D numpy array array with values between 0 and 1. Must have the same dimensions as *dem
- ‘cellsize:’ - float cellsize
- ‘weight:’- float weight associated with netcost. Must be a value between 0 and 1
- ‘coef:’- numpy array coefficients for polynomial mapping gradient to cost