utils.slope module

Functions that convert slopes to different metrics

Function

Description

To metric from gradient

to_percent

Converts gradient to slope percent

to_radians

Converts gradient to slope angle in radians

to_degrees

Converts gradient to slope angle in degrees

to_sine

Converts gradient to sin(θ)

From metric to gradient

from_percent

Converts slope percent to gradient

from_radians

Converts slope angle in radians to gradient

from_degrees

Converts slope angle in degrees to gradient

from_sine

Convert sin(θ) to gradient

This module contains functions that convert between slope gradients (rise/run), and other common slope metrics:

  • slope percent (slope * 100),

  • slope angle (θ) in radians or degrees, and

  • sin(θ)

Each slope metric has “to” and “from” methods which convert to the measure from a slope gradient, or from the measure to a slope gradient, respectively. All functions are designed to work on numpy arrays.

To Metric

pfdf.utils.slope.to_percent(slope)

Converts slope gradient (rise/run) to slope percent (slope * 100)

Inputs:
  • slope (ndarray) – Array of slope gradients

Outputs:

ndarray – Array of slope percents

pfdf.utils.slope.to_radians(slope)

Converts slope gradient (rise/run) to slope angle (θ) in radians

Inputs:
  • slope (ndarray) – Array of slope gradients

Outputs:

ndarray – Array of slope angles in radians

pfdf.utils.slope.to_degrees(slope)

Converts slope gradient (rise/run) to slope angle (θ) in degrees

Inputs:
  • slope (ndarray) – Array of slope gradients

Outputs:

ndarray – Array of slope angles in degrees

pfdf.utils.slope.to_sine(slope)

Converts slope gradient (rise/run) to the sine of the slope angle, sin(θ)

Inputs:
  • slope (ndarray) – Array of slope gradients

Outputs:

ndarray – Array of sin(θ) values


From Metric

pfdf.utils.slope.from_percent(slope)

Converts slope percent (slope * 100) to slope gradient (rise/run)

Inputs:
  • slope (ndarray) – Array of slope percents

Outputs:

ndarray – Array of slope gradients

pfdf.utils.slope.from_radians(slope)

Converts slope angle (θ) in radians to slope gradient (rise/run)

Inputs:
  • slope (ndarray) – Array of slope angles in radians

Outputs:

ndarray – Array of slope gradients

pfdf.utils.slope.from_degrees(slope)

Converts slope angle (θ) in degrees to slope gradient (rise/run)

Inputs:
  • slope (ndarray) – Array of slope angles in degrees

Outputs:

ndarray – Array of slope gradients

pfdf.utils.slope.from_sine(slope)

Converts the sine of the slope angle, sin(θ), to slope gradient (rise/run)

Inputs:
  • slope (ndarray) – Array of sin(θ) values

Outputs:

ndarray – Array of slope gradients