demcompare.stats_dataset ======================== .. py:module:: demcompare.stats_dataset .. autoapi-nested-parse:: Mainly contains the StatsDataset class contains the computed stats of a pair of DEMs for the different classification layers Classes ------- .. autoapisummary:: demcompare.stats_dataset.StatsDataset Module Contents --------------- .. py:class:: StatsDataset(image: numpy.ndarray, dem_processing_method: str = None) StatsDataset class The StatsDataset class contains a list of one xr.dataset per classification layer Each xr.Dataset contains : :image: 2D (row, col) input image as xarray.DataArray, :image_by_class: 3D (row, col; nb_classes) xarray.DataArray containing the image pixels belonging to each class considering the valid pixels :image_by_class_intersection: 3D (row, col; nb_classes) xarray.DataArray containing the image pixels belonging to each class considering the intersection mode :image_by_class_exclusion: 3D (row, col; nb_classes) xarray.DataArray containing the image pixels belonging to each class considering the exclusion mode :attributes: - name : name of the classification_layer. str - stats_by_class : dictionary containing the stats per class considering the standard mode - stats_by_class_intersection : dictionary containing the stats per class considering the intersection mode - stats_by_class_exclusion : dictionary containing the stats per class considering the exclusion mode .. py:attribute:: classif_layers_and_modes :type: Dict .. py:attribute:: image :type: numpy.ndarray .. py:attribute:: classif_layers_dataset :type: List[xarray.Dataset] :value: [] .. py:method:: add_classif_layer_and_mode_stats(classif_name: str, input_stats: List[Dict], mode_name: str) Add the stats of a classification layer and a mode to the corresponding xarray dataset :param classif_name: classification_layer name :type classif_name: str :param input_stats: input statistics :type input_stats: List[str] :mode_name: name of the mode (standard (no name), intersection, exclusion) :type mode_name: str :return: None .. py:method:: save_as_csv_and_json(classif_name: str, stats_dir: str) Saves the classification layer's results to csv and json files on the stats_dir :param classif_name: classification_layer name :type classif_name: str :param stats_dir: output stats directory :type stats_dir: str :return: None .. py:method:: get_classification_layer_names() Returns the available classification layers :return: None .. py:method:: get_classification_layer_dataset(classification_layer: str) -> xarray.Dataset Returns the xr.Dataset corresponding to the input classification layer name :param classification_layer: classification_layer name :type classification_layer: str :return: stats dictionary :rtype: xr.Dataset .. py:method:: get_classification_layer_stats(classification_layer: str) -> Dict Returns all the stats corresponding to the input classification layer name :param classification_layer: classification_layer name :type classification_layer: str :return: stats dictionary :rtype: Dict .. py:method:: get_classification_layer_metrics(classification_layer: str) -> List[str] Returns the metric names available on the input classification layer and mode :param classification_layer: classification_layer name :type classification_layer: str :return: available metric names :rtype: List[str] .. py:method:: get_classification_layer_metric(classification_layer: str, classif_class: int = None, mode: str = '', metric: str = None) -> Union[List, Tuple[numpy.ndarray, numpy.ndarray], numpy.ndarray, float] Returns the metric corresponding to the input classification layer and mode :param classification_layer: classification_layer name :type classification_layer: str :param classif_class: classification_layer class :type classif_class: int :param mode: mode (standard (no name), intersection, exclusion) :type mode: str :param metric: metric :type metric: str :return: metric :rtype: Union[List,Tuple[np.ndarray, np.ndarray], np.ndarray, float]