demcompare.metric.matrix_2d_metrics =================================== .. py:module:: demcompare.metric.matrix_2d_metrics .. autoapi-nested-parse:: Mainly contains different matrix metric classes Classes ------- .. autoapisummary:: demcompare.metric.matrix_2d_metrics.DemHillShade demcompare.metric.matrix_2d_metrics.DemSkyViewFactor Module Contents --------------- .. py:class:: DemHillShade(parameters: Dict = None) Bases: :py:obj:`demcompare.metric.metric_template.MetricTemplate` Compute the hill shade and optionnally save plots from a dem .. py:attribute:: type :value: 'matrix2D' .. py:attribute:: fig_title :value: 'DEM hill shade' .. py:attribute:: colorbar_title :value: 'Hill shade' .. py:attribute:: azimuth :type: float :value: 315 .. py:attribute:: angle_altitude :type: float :value: 45 .. py:attribute:: cmap :type: str :value: 'Greys_r' .. py:attribute:: cmap_nodata :type: str :value: 'royalblue' .. py:attribute:: plot_path :type: str :value: None .. py:attribute:: no_data_location :type: numpy.ndarray :value: None .. py:attribute:: bounds :type: rasterio.coords.BoundingBox :value: None .. py:method:: compute_hillshade(data: numpy.ndarray, azimuth: float, angle_altitude: float) -> numpy.ndarray Compute the hillshade view a of a dem. :param data: input data to compute the metric :type data: np.array :param azimuth: angular direction of the sun :type azimuth: float :param angle_altitude: angle of the illumination source above the horizon :type angle_altitude: float :return: np.ndarray .. py:method:: compute_metric(data: numpy.ndarray) -> xarray.Dataset Compute and optionnally save plots the hillshade view a of a dem using pyplot img_show. :param data: input data to compute the metric :type data: xr.Dataset :return: None .. py:class:: DemSkyViewFactor(parameters: Dict = None) Bases: :py:obj:`demcompare.metric.metric_template.MetricTemplate` Compute the sky vuew factor and optionnally save plots from a dem .. py:attribute:: type :value: 'matrix2D' .. py:attribute:: fig_title :value: 'DEM sky view factor' .. py:attribute:: colorbar_title :value: 'Sky view factor' .. py:attribute:: filter_intensity :type: float :value: 0.9 .. py:attribute:: replication :type: bool :value: True .. py:attribute:: quantiles :value: [0.09, 0.91] .. py:attribute:: cmap :type: str :value: 'Greys_r' .. py:attribute:: cmap_nodata :type: str :value: 'royalblue' .. py:attribute:: plot_path :type: str :value: None .. py:attribute:: no_data_location :type: numpy.ndarray :value: None .. py:attribute:: bounds :type: rasterio.coords.BoundingBox :value: None .. py:method:: compute_svf(data: numpy.ndarray) -> numpy.ndarray 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). :param data: input data to compute the metric :type data: np.array :return: curvature np.array containing : :rtype: np.ndarray .. py:method:: compute_metric(data: numpy.ndarray) -> xarray.Dataset Compute and optionnally save plots the sky view factor a of a dem using pyplot img_show. :param data: input data to compute the metric :type data: np.ndarray :return: xr.Dataset