Analyze the climate history for any area, line or point inside Germany with nothing more than a shapefile.
This script automates an end‑to‑end workflow to
- Download annual gridded climate rasters (1951 → latest) from the DWD Climate Data Center (CDC).
- Clip & analyse those rasters for a user‑supplied area (polygon shapefile).
- Summarise the results as zonal statistics (min / mean / max) in a tidy JSON file.
- Visualise long‑term trends with ready‑made PNG plots. Also creates an interactive map of the analyzed area.
The goal is to give municipalities, researchers and students a quick way to quantify and visualise local climate change indicators without manual GIS work.
| Stage | What happens | Where in code |
|---|---|---|
| Input | Interactive prompt asks for your .shp path | get_shp() |
| Data download | All relevant .asc.gz / .zip rasters fetched from the DWD open‑data mirror | download_dwd_data() |
| Pre‑processing | Decompress → rename → add CRS → re‑encode to GeoTIFF | decompress_file(), asc_to_tif_add_crs() |
| Clean‑up | Source archives removed to keep disk footprint small | delete_raster_files() |
| Analysis | Per‑polygon zonal stats with rasterstats |
calculate_zonal_stats() |
| Output | - area_rasterstats.json containing the calculated data, - 9 plots showing 17 different climate parameter long term trends, - map of the analyzed area |
visualiser section |
Linux:
# 1. Clone & enter
git clone https://github.com/LevinGiersch/ZonalClimateAnalyzer
cd ZonalClimateAnalyzer
# 2. Create & activate venv (recommended)
python3 -m venv venv
source venv/bin/activate
# 3. Install Python ≥3.9 deps
pip install -r requirements.txt
# 4. Run the script
python ZonalClimateAnalyzer.py
# 5. Follow the prompt:
# Enter the path to the shapefile: /path/to/my_area.shp
# 6. Wait until the process is finishedWindows:
# 1. Clone & enter
git clone https://github.com/LevinGiersch/ZonalClimateAnalyzer
cd ZonalClimateAnalyzer
# 2. Install Python ≥3.9 deps (recommended: venv/conda)
pip install -r requirements.txt
# 3. Run the script
python ZonalClimateAnalyzer.py
# 4. Follow the prompt:
# Enter the path to the shapefile: C:\path\to\my_area.shp
# 5. Wait until the process is finished- Runtime hint: the first execution downloads ≈ 1 GB of rasters and can take 10–20 min (depending on your connection).
| Aspect | Details |
|---|---|
| Provider | Deutscher Wetterdienst (DWD) – Climate Data Center |
| URL root | https://opendata.dwd.de/climate_environment/CDC/grids_germany/annual/ |
| Parameters pulled | air_temperature_*, frost_days, hot_days, ice_days, drought_index, precipitation, snowcover_days, precipGE{10,20,30}mm_days, sunshine_duration, vegetation_{begin,end} |
| Spatial grid | 1 × 1 km GK3 / DHDN Zone 3 (EPSG 31467) |
| Temporal coverage | 1951 – present (updated yearly) |
- A small
gk3.prjfile ships with the repo; shapefiles are re‑projected into this CRS so raster overlays line up exactly. - Detailled informations on the data (as.pdf) can be found inside the 'ZonalClimateAnalyzer/climate_environment_CDC_grids_germany_annual' folder after executing the script.
| File | What it shows |
|---|---|
map.html |
Interactive map of the analyzed area. Shows filename, area and perimeter on hover. |
min_mean_max_temp_plot.png |
Annual maximum, mean and minimum air temperature. Filled bands visualise the spread between the three series. |
ice_frost_days_plot.png |
Counts of frost days (Tmin < 0 °C) and ice days (Tmax < 0 °C). |
snowcover_days_plot.png |
Days per year with snow depth > 1 cm. |
summer_hot_days_plot.png |
Counts of summer days (Tmax ≥ 25 °C) and hot days (Tmax ≥ 30 °C). |
precipitation_drought_plot.png |
Annual precipitation totals (bars) with drought index overlay (line, scaled). |
precip_days_plot.png |
Number of days with heavy precipitation ≥ 10 mm, ≥ 20 mm, ≥ 30 mm. |
sunshine_duration_plot.png |
Average daily sunshine hours for each year. |
vegetativ_phase_plot.png |
Start and end dates of the vegetative season plus reference lines for astronomical seasons. |
vegetativ_phase_len_plot.png |
Length of the vegetative season (days between start and end) for each year. |
- Only works for shapefiles. Support for eg. geojson may be added in the future.
- Re‑downloads rasters each year; archive copies yourself for full reproducibility.
Always credit the DWD Climate Data Center when publishing derived work.
Deutscher Wetterdienst (2025): Grids Germany – Annual. https://opendata.dwd.de/climate_environment/CDC/grids_germany/annual/