🔬 Dive into the Background Theory

This section provides a deeper look into the data, mathematics, and methodology behind RegionMatch.

You do not need this section to use the plugin. It is intended for users who want to understand how similarity is computed, how data are prepared, and how configuration choices influence the results.


1. Mathematical Description of Similarity

This section describes how RegionMatch translates multidimensional regional characteristics into a single similarity score.

1.1 Feature Selection and Weighting

Let \(A\) denote the set of comparison aspects:

  • climate

  • sociodemography

  • orography

  • land use

Each aspect \(a \in A\) is associated with a feature vector:

\[X_a \subseteq \mathbb{R}^n\]

Users assign a numeric weight to each aspect:

\[w_a \in \{0,\; 0.5,\; 1\}\]

Weight \(w_a\)

Meaning

1.0

high relevance

0.5

medium relevance

0.0

low relevance

The sum of all weights defines the maximum possible similarity score:

\[S_{\text{max}} = \sum_{a \in A} w_a\]

This implies that the scale of the similarity score depends directly on the selected weights.


1.2 Distance Calculation

For each aspect \(a\), the distance between the reference region \(x_0 \in \mathbb{R}^n\) and another region \(x_i \in \mathbb{R}^n\) is computed using the standardised Euclidean distance:

\[d_a(x_0, x_i) = \sqrt{ \sum_{j=1}^{n} \frac{(x_{0j} - x_{ij})^2}{\sigma_j^2} }\]

where \(\sigma_j^2\) denotes the variance of feature \(j\) across all regions.

In the implementation, this is computed using:

scipy.spatial.distance.cdist(
    target_features,
    all_features,
    metric="seuclidean",
    V=variances,
)

Standardisation ensures that indicators with large numeric ranges do not dominate the distance calculation.


1.3 Similarity Score Construction

Raw distances are transformed into similarity values by normalising and inverting the distance range:

\[s_a(x_0, x_i) = 1 - \frac{d_a(x_0, x_i) - d_{\min}}{d_{\max} - d_{\min}}\]

This transformation ensures that:

  • values close to 1 indicate high similarity

  • values close to 0 indicate low similarity

Each aspect-specific similarity is then weighted according to user-defined relevance:

\[S(x_i) = \sum_{a \in A} w_a \cdot s_a(x_0, x_i)\]

with

\[w_a \in \{0,\; 0.5,\; 1\}\]

2. Data Basis

RegionMatch relies on a harmonised table that combines administrative, sociodemographic, land use, orographic, and climate information for all German districts (NUTS3 level).

2.1 Overview of Input Data

Data

Unit

Aspect

Source

NUTS_CODE

n.a.

Description

Bundesamt für Kartografie und Geodäsie

NUTS_NAME

n.a.

Description

Bundesamt für Kartografie und Geodäsie

Total area

km²

Sociodemographic

DESTATIS

Total population

n.a.

Sociodemographic

DESTATIS

Population density

1/km²

Sociodemographic

DESTATIS

Population over 65

%

Sociodemographic

Deutschlandatlas

Urban & traffic areas

%

Land use

Deutschlandatlas

Agricultural land

%

Land use

Deutschlandatlas

Forest area

%

Land use

Deutschlandatlas

Orography type

n.a.

Orography

NUKLEUS ensemble

Hot days

days

Climate

NUKLEUS ensemble

Longest dry spell

days

Climate

NUKLEUS ensemble

Heavy precipitation days

days

Climate

NUKLEUS ensemble

Tropical nights

days

Climate

NUKLEUS ensemble

Climate indicators are based on near-surface values, provided as 30-year means for the historical period and as changes relative to the historical period for +2 °C and +3 °C global warming levels.


3. Climate Indicators

The following climate indicators are used:

Indicator

Abbreviation

Definition

Hot days

TXge30

Days with daily maximum temperature ≥ 30 °C

Tropical nights

TR

Days with daily minimum temperature > 20 °C

Heavy precipitation days

R30mm

Days with precipitation ≥ 30 mm

Longest dry spell

CDD

Longest sequence of days with precipitation < 1 mm

Indicator definitions follow the Climpact standard indices.


4. Spatial Aggregation of Climate Data

German district geometries are derived from NUTS3 shapefiles provided by the Federal Agency for Cartography and Geodesy (german: Bundesamt für Kartografie und Geodäsie). These geometries are converted to GeoJSON and filtered to include only land districts.

The geometries are then used to spatially aggregate climate model output using regionmask, xarray, and cosine-latitude weighting.

This approach allows efficient computation of district-level climate indicators.


5. Orography Classification

Orography is provided as elevation (meters above sea level) in the NUKLEUS model data.

Each district is assigned an orography type based on the maximum elevation within its boundaries:

Type

Condition

Code

Lowland

max < 200 m

0

Upland

200–500 m

1

Highlands

500–1500 m

2

High mountains

≥ 1500 m

3

These numeric codes are used directly in the similarity calculation.


6. Code Structure and Data Updates

6.1 Main Components

  • run_plugin.py: Core similarity computation

  • utils.py: Visualisation, mapping, and output generation

  • prepare_data.py: Input data preparation

6.2 Updating the Data Basis

Data preparation is decoupled from the plugin logic and handled via scripts in data/.

Running the preparation workflow:

  • downloads updated sociodemographic and land use data

  • computes climate indicators

  • determines orography types

  • assembles the final input table used by the plugin

This separation ensures reproducibility and easier maintenance.