demcompare.metric.matrix_2d_metrics

Mainly contains different matrix metric classes

Module Contents

Classes

DemHillShade

Compute the hill shade and optionnally save plots from a dem

DemSkyViewFactor

Compute the sky vuew factor and optionnally save plots from a dem

class demcompare.metric.matrix_2d_metrics.DemHillShade(parameters: Dict = None)[source]

Bases: demcompare.metric.metric_template.MetricTemplate

Compute the hill shade and optionnally save plots from a dem

compute_hillshade(data: numpy.ndarray, azimuth: float, angle_altitude: float) numpy.ndarray[source]

Compute the hillshade view a of a dem.

Parameters:
  • data (np.array) – input data to compute the metric

  • azimuth (float) – angular direction of the sun

  • angle_altitude (float) – angle of the illumination source above the horizon

Returns:

np.ndarray

compute_metric(data: numpy.ndarray) xarray.Dataset[source]

Compute and optionnally save plots the hillshade view a of a dem using pyplot img_show.

Parameters:

data (xr.Dataset) – input data to compute the metric

Returns:

None

class demcompare.metric.matrix_2d_metrics.DemSkyViewFactor(parameters: Dict = None)[source]

Bases: demcompare.metric.metric_template.MetricTemplate

Compute the sky vuew factor and optionnally save plots from a dem

compute_svf(data: numpy.ndarray) numpy.ndarray[source]

Return the sky view factor of the input DEM. First, compute the FFT of the input dem: F(y) = FFT(DEM). Then, apply a filter y^filter_intensity with s=0.9: F(y) = F(y)* y^filter_intensity. Finally, apply the inverse FFT: IFFT(F(y)). We keep the real part (imaginary part = digital noise).

Parameters:

data (np.array) – input data to compute the metric

Returns:

curvature np.array containing :

Return type:

np.ndarray

compute_metric(data: numpy.ndarray) xarray.Dataset[source]

Compute and optionnally save plots the sky view factor a of a dem using pyplot img_show.

Parameters:

data (np.ndarray) – input data to compute the metric

Returns:

xr.Dataset