Skip to content

Commit

Permalink
Merge pull request #212 from GispoCoding/211-add-statistics-tab-to-eda
Browse files Browse the repository at this point in the history
211 add statistics tab to EDA
  • Loading branch information
nmaarnio committed Sep 18, 2024
2 parents a6cdff6 + d16c82e commit d19300c
Show file tree
Hide file tree
Showing 34 changed files with 857 additions and 223 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from qgis.core import QgsProcessingParameterRasterLayer
from qgis.core import QgsProcessingParameterBand, QgsProcessingParameterRasterLayer

from eis_qgis_plugin.eis_processing.eis_processing_algorithm import EISProcessingAlgorithm

Expand All @@ -12,17 +12,33 @@ def __init__(self) -> None:
self._group = "Exploratory analysis"
self._group_id = "exploratory_analysis"
self._short_help_string = """
Calculate descriptive statistics for raster data.
Compute descriptive statistics for raster data.
Calculates min, max, mean, quantiles (25%, 50% and 75%), \
standard deviation, relative standard deviation and skewness.
Computes the following statistics:
- min
- max
- mean
- quantiles 25%
- quantile 50% (median)
- quantile 75%
- standard deviation
- relative standard deviation
- skewness
Nodata values are removed from the data before the statistics are computed.
"""

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_file"]
self.alg_parameters = ["input_raster", "band"]

input_raster_param = QgsProcessingParameterRasterLayer(
name=self.alg_parameters[0], description="Input raster"
)
input_raster_param.setHelp("Input raster to calculate descriptive statistics for.")
input_raster_param.setHelp("Input raster.")
self.addParameter(input_raster_param)

band_param =QgsProcessingParameterBand(
name=self.alg_parameters[1], description="Band", parentLayerParameterName=self.alg_parameters[0]
)
band_param.setHelp("Raster band to compute descriptive statistics from.")
self.addParameter(band_param)
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ def __init__(self) -> None:
self._group = "Exploratory analysis"
self._group_id = "exploratory_analysis"
self._short_help_string = """
Calculate descriptive statistics for vector data.
Calculates min, max, mean, quantiles (25%, 50% and 75%), \
standard deviation, relative standard deviation and skewness.
Compute descriptive statistics for vector data.
Computes the following statistics:
- min
- max
- mean
- quantiles 25%
- quantile 50% (median)
- quantile 75%
- standard deviation
- relative standard deviation
- skewness
"""

def initAlgorithm(self, config=None):
Expand All @@ -24,13 +32,14 @@ def initAlgorithm(self, config=None):
input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector to calculate descriptive statistics for.")
input_vector_param.setHelp("Input vector.")
self.addParameter(input_vector_param)

column_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Column",
parentLayerParameterName=self.alg_parameters[0],
type=QgsProcessingParameterField.Numeric,
)
column_param.setHelp("Column selection.")
column_param.setHelp("Column in vector data to compute descriptive statistics from.")
self.addParameter(column_param)
2 changes: 2 additions & 0 deletions eis_qgis_plugin/eis_processing/eis_toolkit_invoker.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ def _update_results(self, stdout: str, results: dict, feedback: QgsProcessingFee
feedback.pushInfo(f"* {key}: {value}")
feedback.pushInfo("-----------------------\n ")

results.update(output_dict)


def _update_out_rasters(self, stdout: str):
"""
Expand Down
Loading

0 comments on commit d19300c

Please sign in to comment.