This repository contains the workflow used to generate the Swiss drought monitoring blog and associated figures for the Bern region.
The project combines meteorological observations from MeteoSwiss with vegetation health information from swissEO to assess current drought conditions. The workflow calculates climatic water deficit indicators and visualizes recent vegetation stress patterns.
- Climatic Water Deficit (CWD) time series
- Potential Climatic Water Deficit (PCWD) time series
- Vegetation Health Index (VHI) maps derived from swissEO
- Updated drought monitoring blog post rendered from Quarto
Daily meteorological observations are downloaded from the MeteoSwiss Open Government Data portal:
- Bern historical station data
- Bern recent station data
Source:
https://data.geo.admin.ch/ch.meteoschweiz.ogd-smn/
The data download is automated through:
analysis/download_meteoswiss_data.RDownloaded files are stored in:
data-raw/
Vegetation Health Index (VHI) raster products are retrieved from the Swiss Federal Geoportal STAC API.
Collection:
ch.swisstopo.swisseo_vhi_v100
Source:
The workflow automatically searches for the most recent valid VHI dataset and downloads the required raster subset for the Bern region.
Large raster datasets are not intended to be stored permanently in the repository. They are downloaded automatically during execution and stored locally in:
data-raw/swisseo_vhi_bern/
project/
│
├── analysis/
│ └── download_meteoswiss_data.R
│
├── R/
│ ├── 01_calc_pcwd.R
│ ├── 02_swissEOVHI.R
│ └── calc_pet.R
│
├── data/
│ ├── Bern_pcwd_daily.csv
│ ├── swisseo_vhi_bern_plot_data.csv
│ ├── swisseo_vhi_bern_stats.csv
│ └── swisseo_vhi_bern_crop_YYYY-MM-DD.tif
│
├── data-raw/
│
├── vignettes/
│ └── drought_2026.qmd
│
└── README.md
analysis/download_meteoswiss_data.RDownloads daily MeteoSwiss station observations for Bern and stores them in data-raw/.
R/01_calc_pcwd.RThis script:
-
reads MeteoSwiss observations
-
calculates daily potential evapotranspiration (PET)
-
calculates:
- PCWD (Potential Climatic Water Deficit)
- CWD (Climatic Water Deficit)
-
exports processed data to:
data/Bern_pcwd_daily.csv
R/02_swissEOVHI.RThis script:
- downloads the latest available swissEO VHI product
- crops the raster around Bern
- converts the raster into a plot-ready data frame
- calculates summary statistics
- exports processed data to:
data/swisseo_vhi_bern_plot_data.csv
data/swisseo_vhi_bern_stats.csv
data/swisseo_vhi_bern_crop_YYYY-MM-DD.tif
vignettes/drought_2026.qmd
The Quarto document loads the processed datasets from data/ and generates all figures during rendering.
This includes:
- PCWD seasonal cycle figure
- CWD seasonal cycle figure
- swissEO Vegetation Health Index map
The document also incorporates summary statistics directly into the text and provides the written drought assessment.
With below code the blog can be updated:
cd ~/GitHub/geco-bern/drought_switzerland_blog
Rscript analysis/05_Update_data.R
git commit -am "Update data $(date +%F)"
quarto publish vignettes/drought_2026.qmd
# alternatively do it from R:
# renv::restore()
# quarto::quarto_render("vignettes/drought_2026.qmd")
# quarto::quarto_publish_site("vignettes/drought_2026.qmd")
To render the article locally without updating the blog:
renv::restore()
quarto::quarto_render("vignettes/drought_2026.qmd")The Quarto document automatically generates all figures from the processed datasets stored in data/.
data/
Examples:
- Bern_pcwd_daily.csv
- swisseo_vhi_bern_plot_data.csv
- swisseo_vhi_bern_stats.csv
- swisseo_vhi_bern_crop_YYYY-MM-DD.tif
Rendered Quarto outputs are written to:
vignettes/
All figures are generated dynamically during rendering from the processed datasets stored in data/.
Outputs may be available as:
- HTML
here
readr
dplyr
ggplot2
lubridate
purrr
SPEI
httr2
jsonlite
terra
sf
patchwork
scales
quartorenv::init()
renv::snapshot()Include the generated renv.lock file in the repository.
- GDAL
- PROJ
- GEOS
Required by:
sf
terraA recent installation of Quarto is required for rendering the drought blog.