demcompare.metric.vector_metrics
Mainly contains different 2D metric classes
Module Contents
Classes
Cumulative Probability Function metric class |
|
Probability Density Function metric class |
|
Ratio above threshold metric class |
|
Slope orientation histogram of the DEM |
- class demcompare.metric.vector_metrics.CumulativeProbabilityFunction(parameters: Dict = None)[source]
Bases:
demcompare.metric.metric_template.MetricTemplate
Cumulative Probability Function metric class
- compute_metric(data: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray] | numpy.ndarray | float [source]
Metric computation method
- Parameters:
data (np.array) – input data to compute the metric
- Returns:
the computed cdf (y axis) and bins (y axis)
- Return type:
Tuple[np.ndarray, np.ndarray]
- class demcompare.metric.vector_metrics.ProbabilityDensityFunction(parameters: Dict = None)[source]
Bases:
demcompare.metric.metric_template.MetricTemplate
Probability Density Function metric class
- compute_metric(data: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray] | numpy.ndarray | float [source]
Metric computation method
- Parameters:
data (np.array) – input data to compute the metric
- Returns:
the computed pdf (y axis) and bins (y axis)
- Return type:
Tuple[np.ndarray, np.ndarray]
- class demcompare.metric.vector_metrics.RatioAboveThreshold(parameters: Dict = None)[source]
Bases:
demcompare.metric.metric_template.MetricTemplate
Ratio above threshold metric class
- static _get_thresholds_in_meters(threshold: List[float], original_unit: str)[source]
Create list of threshold in meters.
- class demcompare.metric.vector_metrics.SlopeOrientationHistogram(parameters: Dict = None)[source]
Bases:
demcompare.metric.metric_template.MetricTemplate
Slope orientation histogram of the DEM
- compute_orientation_slope(dem: numpy.ndarray) numpy.ndarray [source]
Return the slope orientation histogram of the input dem.
- Parameters:
dem (np.ndarray) – dem
- Returns:
slope orientation
- Return type:
np.ndarray
- compute_slope_orientation(normale: numpy.ndarray) numpy.ndarray [source]
Compute the orientation of a map of vectors defined at each pixel with respect to the North direction. Calculated orientations are between 0° and +360° (+270° = West direction)
- Parameters:
normale (np.ndarray) – vector (3D, row, col) normal to the surface
- Returns:
vector orientation (row, col) at each pixel
- Return type:
np.ndarray
- compute_metric(data: numpy.ndarray) Tuple[numpy.ndarray, numpy.ndarray] | numpy.ndarray | float [source]
Metric computation method
- Parameters:
data (np.array) – input data to compute the metric
- Returns:
the computed cdf (y axis) and bins (y axis)
- Return type:
Tuple[np.ndarray, np.ndarray]
- save_plot_metric(output_file: str)[source]
Compute and save the metric plot
- Parameters:
output_file (str) – path where the plot image is saved
- Returns:
None
- compute_histogram(data: numpy.ndarray, nbins: int, normalise: bool = True) Tuple[numpy.ndarray, numpy.ndarray] [source]
DEM slope orientation histogram computation.
- Parameters:
data (np.ndarray) – orientation of the DEM
nbins (int) – number of bins of the histogram
normalise (bool) – normalise or not the histogram
- Returns:
the histogram of the orientation
- Return type:
Tuple[np.ndarray, np.ndarray]