EcoMetriQReference Book

10. The Report tab and the Processing toolbox

Tab: 📋 Report · Code: ui/main_dialog.py:2706-2772 · Processing: processing_provider.py, processing_algorithms.py

10.1 The Report tab

The Report tab collects the result texts produced in the other tabs into a single text. It does not perform any new computation.

Figure 10.1. The Report tab: site information and the generated report.
Figure 10.1. The Report tab: site information and the generated report.
Interface name What it does Default Code
Site Name: Site name in the report header Unnamed Site ui/main_dialog.py:2712
Location: Location empty ui/main_dialog.py:2713
Date: Date today's date ui/main_dialog.py:2714
Observer: Observer empty ui/main_dialog.py:2715
📋 Generate Comprehensive Report Generates the report - ui/main_dialog.py:2736-2762
💾 Save as TXT Saves the report as ecometriq_report_<date_time>.txt - ui/main_dialog.py:2764-2772

The report is built in this order: a header (site information, report date, plugin version), followed by the result boxes that are filled at that moment: ALPHA INDICES, BETA DIVERSITY, GAMMA DIVERSITY, SPATIAL ANALYSIS. If no tab has been computed, it reads "No computations performed yet."

What is not included in the report

  • The rarefaction table and plots and the validation results are not included in the report; save them separately.
  • The spatial section contains only the text of the last tool run (KDE, Gi*, EOO/AOO or alpha shape), because the four tools share the same results box. If you want the results of all four tools in the report, save the result separately after running each one.

10.2 The Processing toolbox

EcoMetriQ also provides five of the window's computations as QGIS Processing algorithms. The algorithms are found in Processing › Toolbox under the heading EcoMetriQ - Biodiversity Metrics & Spatial Analysis (provider ID ecometriq).

Using Processing has four advantages:

  1. Batch running: with Run as Batch Process… the same algorithm is run on many files.
  2. Graphical Modeler: algorithms are chained in a workflow model, and the model is saved.
  3. Scripting: they are called from Python with processing.run(); the analysis is reproducible.
  4. Coordinate system: the spatial algorithms transform projected data correctly with the CRS of the CSV coordinates parameter (the window lacks this; §3.4).

Each algorithm's dialog has an English help text on the right; the Log tab shows warnings (e.g. abundance based on record counts, a change of the analysis unit). If rows were skipped while the CSV was read, each algorithm writes the warning "Skipped rows: … with unreadable or non-finite coordinates, … with zero or negative counts, …" (only reasons with a non-zero count) to the log (processing_algorithms.py:58-64; rules in §3.3).

ID Display name Group
ecometriq:alpha_diversity_indices 📊 Alpha Diversity Indices v2 (Hill + Coverage + CI) Alpha Diversity
ecometriq:gamma_diversity 🌍 Gamma Diversity & Alpha-Beta-Gamma Partitioning Gamma Diversity
ecometriq:kde_density 🔥 Kernel Density Estimation (KDE + LSCV) Spatial Analysis
ecometriq:hotspot_analysis 🔴 Hotspot Analysis (Gi* + FDR Correction) Spatial Analysis
ecometriq:eoo_aoo 🗺️ EOO / AOO (IUCN Criterion B) Spatial Analysis

There is no separate algorithm for beta diversity or rarefaction; the report of the gamma algorithm includes the multiple-site Baselga beta.

10.3 Algorithm parameters

10.3.1 Alpha Diversity Indices

Figure 10.2. The dialog of the Alpha Diversity Indices algorithm.
Figure 10.2. The dialog of the Alpha Diversity Indices algorithm.
Parameter ID Default Description
CSV File (species, x, y) INPUT_CSV - Input CSV (§3.3)
Compute Shannon Bootstrap CI (slow) RUN_BOOTSTRAP no Percentile bootstrap interval with 500 replicates
Bootstrap RNG seed BOOTSTRAP_SEED 42 Seed for reproducibility
Trait/phylogenetic dissimilarity matrix for Rao's Q (optional CSV) TRAIT_MATRIX none Square, symmetric, zero diagonal, values in [0, 1] (§4.9.2)
Output Report (TXT) OUTPUT_REPORT - Report file

Output numbers: SHANNON, SIMPSON (unbiased 1-D), SPECIES_COUNT, CHAO1 (classic), GOODS_COVERAGE, HILL_D1. On the example data: 6.1913; 0.9975; 694; 992.08; 0.8333; 488.46. The report also includes a 25-step rarefaction table and Rao's Q (processing_algorithms.py:155-239).

With the bootstrap switched on, the result on the example data is: mean 5.9785; 95% interval 5.9324 - 6.0212. The observed H' = 6.1913 lies outside the interval; in this case the algorithm adds the line Warning: The observed H' lies outside the bootstrap interval … to the report (§4.13, Q1).

10.3.2 Gamma Diversity

Parameter ID Default Description
CSV File (species, site, count) INPUT_CSV - A site column is required
Site column name SITE_FIELD site Site column
Output Report (TXT) OUTPUT_REPORT - Report file

Output numbers: GAMMA_S, GAMMA_H (pooled), WHITTAKER_BETA, MEAN_ALPHA_S. On the example data: 694; 6.1913; 2.3206; 209.0.

10.3.3 Kernel Density Estimation

Parameter ID Default Description
CSV File INPUT_CSV -
CRS of the CSV coordinates INPUT_CRS EPSG:4326 Coordinates are transformed from this system to WGS84
Species Filter (blank = all) SPECIES_FILTER empty Optional; empty = all species. For a single species the name must be spelled exactly
Bandwidth in metres (0 = normal-reference rule) BANDWIDTH 0 §8.4.3
Use least-squares cross-validation bandwidth (n <= 400) USE_LSCV no At most 400 points
Grid Size (pixels) GRID_SIZE 100 20 - 500
KDE Output Raster OUTPUT_RASTER - .tif or .asc; with a count column, records are weighted by count as in the dialog

LSCV. Least-squares cross-validation selects, among 30 logarithmically spaced candidate bandwidths between 0.1 and 2 times h_{\text{ref}}, the h that minimizes the following criterion (Bowman 1984; Rudemo 1982; modules/spatial_analysis.py:522-585):

\mathrm{LSCV}(h) = \frac{1}{4\pi n^2 h^2} \sum_{i,j} e^{-d_{ij}^2 / 4h^2} - \frac{1}{\pi n (n-1) h^2} \sum_{i \ne j} e^{-d_{ij}^2 / 2h^2}

If the minimum falls at an end of the range (there is no interior minimum), the program falls back to h_{\text{ref}} and writes this to the log. This is common with clustered ecological data. If LSCV is requested with more than 400 points, h_{\text{ref}} is also used and a warning is written.

10.3.4 Hotspot Analysis

Parameter ID Default Description
CSV File INPUT_CSV -
CRS of the CSV coordinates INPUT_CRS EPSG:4326
Analysis variable VALUE_SOURCE Record count/abundance at the point The row's count (1 if absent) or the total abundance of the species
Distance band in metres (0 = 2 x h_ref) BANDWIDTH 0 §8.5
Use adaptive bandwidth (k-NN) USE_ADAPTIVE no The band for each point is the distance to its 8th nearest neighbor
Apply Benjamini-Hochberg FDR correction USE_FDR yes
Significance threshold for classification P_THRESHOLD 0.05 0.0001 - 0.5
Hotspot Point Layer OUTPUT_LAYER - Point layer

As in the window, this algorithm writes a warning to the log when, with presence-only data, the analysis unit changes to cells, and it reports the number of hot and cold spots.

10.3.5 EOO / AOO

Parameter ID Default Description
CSV File INPUT_CSV -
CRS of the CSV coordinates INPUT_CRS EPSG:4326
Species Filter (blank = all) SPECIES_FILTER empty Optional; empty = all species
AOO Grid Cell Size (km) CELL_SIZE_KM 2.0 0.5 - 10
IUCN Assessment Report OUTPUT_REPORT - Threshold comparison report
Convex Hull Layer OUTPUT_HULL - EOO polygon

The output numbers are EOO_KM2 and AOO_KM2. On the example data: 23,340.264 and 3,580.0 km².

10.4 Calling from Python

In the QGIS Python console:

import processing
csv = r"C:/veri/antalya_basin_species.csv"

alfa = processing.run("ecometriq:alpha_diversity_indices", {
    "INPUT_CSV": csv, "RUN_BOOTSTRAP": False, "BOOTSTRAP_SEED": 42,
    "OUTPUT_REPORT": r"C:/veri/alfa.txt"})
print(alfa["SHANNON"], alfa["CHAO1"])

eoo = processing.run("ecometriq:eoo_aoo", {
    "INPUT_CSV": csv, "INPUT_CRS": "EPSG:4326", "SPECIES_FILTER": "Cistus creticus",
    "CELL_SIZE_KM": 2.0, "OUTPUT_REPORT": r"C:/veri/cistus_iucn.txt",
    "OUTPUT_HULL": "TEMPORARY_OUTPUT"})
print(eoo["EOO_KM2"], eoo["AOO_KM2"])

The same analysis can be run for all species files in a folder with a loop or with Run as Batch Process…. Because the computation modules do not depend on QGIS (modules/alpha_beta_indices.py, modules/spatial_analysis.py), they can also be imported and used directly in a Python environment outside QGIS.

10.5 Graphical Modeler

In Processing › Graphical Modeler, the EcoMetriQ algorithms can be chained with other QGIS algorithms. An example model:

  1. Input: CSV file (Vector Layer or File input).
  2. Alpha Diversity Indices → report.
  3. Gamma Diversity → report.
  4. Kernel Density Estimation → raster.
  5. Hotspot Analysis → point layer.
  6. EOO / AOO → report and hull.

The model is saved as .model3 and applied to other data with the same settings. Sharing the model as a supplementary file in a publication makes the analysis reproducible.