demcompare.metric.vector_metrics

Mainly contains different 2D metric classes

Module Contents

Classes

CumulativeProbabilityFunction

Cumulative Probability Function metric class

ProbabilityDensityFunction

Probability Density Function metric class

RatioAboveThreshold

Ratio above threshold metric class

class demcompare.metric.vector_metrics.CumulativeProbabilityFunction(parameters: Dict = None)[source]

Bases: demcompare.metric.metric_template.MetricTemplate

Cumulative Probability Function metric class

_BIN_STEP = 0.1[source]
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_csv_metric(output_file: str)[source]

Save the metric to a csv file

Parameters:

output_file (str) – path where the csv file is saved

Returns:

None

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

class demcompare.metric.vector_metrics.ProbabilityDensityFunction(parameters: Dict = None)[source]

Bases: demcompare.metric.metric_template.MetricTemplate

Probability Density Function metric class

_BIN_STEP = 0.2[source]
_WIDTH = 0.7[source]
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]

save_csv_metric(output_file: str)[source]

Save the metric to a csv file

Parameters:

output_file (str) – path where the csv file is saved

Returns:

None

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

class demcompare.metric.vector_metrics.RatioAboveThreshold(parameters: Dict = None)[source]

Bases: demcompare.metric.metric_template.MetricTemplate

Ratio above threshold metric class

_ELEVATION_THRESHOLDS = [0.5, 1, 3][source]
_ORIGINAL_UNIT = 'm'[source]
static _get_thresholds_in_meters(threshold: List[float], original_unit: str)[source]

Create list of threshold in meters.

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 ratio_above_threshold

Return type:

np.ndarray

save_csv_metric(output_file: str)[source]

Save the metric to a csv file

Parameters:

output_file (str) – path where the csv file is saved

Returns:

None