Featured · Climate data analysis
Three decades of weather in the Vallès Occidental
What has actually changed in the local climate around Sabadell and Vacarisses? An end-to-end analysis of Meteocat observations, from raw downloads to trend tests and a neural network that reconstructs the daily temperature curve.
- Stations
- 3Sabadell ×2, Vacarisses
- Longest record
- 1996–2026Vacarisses · 30-min
- Daily observations
- 23,852calendar days, all stations
- Best ML RMSE
- 1.18 °C30-min curve from daily data
Overview
A local climate record, analysed from scratch
The project downloads observations from three stations of the Servei Meteorològic de Catalunya, cleans and merges them, and studies them from several angles: precipitation regimes, day and night temperatures, drought (SPEI), correlations between variables, and statistical downscaling with machine learning.
Question
Is there a detectable trend in temperature, heat extremes and rainfall at station level over the last 15–30 years?
Approach
Quality-controlled daily and 30-min series, non-parametric trend tests, LOESS smoothing, and a comparison of ML models against a physical baseline.
Output
Seven analysis notebooks, a reusable statistics module with unit tests, a Dash dashboard, and this interactive page.
Geographical context
Two towns, three stations, different records
Sabadell Nord sits at the agricultural park on the edge of the city; Sabadell Centre is an urban site with daily data only; Vacarisses, 343 m up on the western side of the comarca, has the longest record. Select a station to see its record and how complete each variable is.
Sabadell Nord · Parc Agrari
- Meteocat code
- XF
- Record
- 2008-10-24 → 2026-04-01
- Resolution
- 30 min
- Altitude
- 259 m
- Position
- 41.5657° N, 2.0696° E
Variables · daily-data coverage
- Mean temperature100%
- Daily maximum temperature100%
- Daily minimum temperature100%
- Precipitation100%
- Relative humidity100%
- Surface pressure100%
Data exploration
Explore the series
Choose a variable, compare stations and zoom into any period. Values are aggregated from the cleaned daily files in the repository.
Monthly values require ≥ 80 % of days, annual values ≥ 90 % of the calendar year; gaps in the record are shown as gaps. Temperatures are means of daily values. Drag on the overview to zoom.
Mean seasonal cycle
Monthly mean temperature (°C) · full record
Trend analysis
What the trend tests say, and what they don't
Each cell is a Theil–Sen slope on the annual series; the dot marks a Mann-Kendall p-value below 0.05. Select one to see the series, its LOESS curve and the slope confidence interval.
Sen's slope per decade · select a cell
| Station | T mean | T max | T min | Rain | Hot days | Trop. nights | Frost days |
|---|---|---|---|---|---|---|---|
| Sbd Nord | |||||||
| Sbd Centre | |||||||
| Vacarisses |
Sbd Nord · Mean temperature
Annual mean of daily values · 2009–2025
- Sen's slope
- +0.80°C / decade
- 95 % CI
- +0.35 … +1.30°C / decade
- Kendall τ
- 0.529p = 0.003
- Change over record
- +1.27°C · n = 17 yrs
Reading the results
- Both Sabadell stations show a warming of mean temperature of about +0.8 °C per decade (Sbd Nord, p = 0.003) and +0.8 °C (Sbd Centre, p = 0.008) over 2009–2025.
- At Vacarisses, over a longer 1997–2025 window, only the minimum temperature trend is significant (+0.41 °C/decade, p = 0.002); mean (p = 0.120) and maximum (p = 0.752) are not.
- Tropical nights increase at the urban Sabadell Centre site (+16.9 per decade, p = 0.019) but the trend at Sabadell Nord does not reach significance (p = 0.082).
- No station shows a significant trend in annual precipitation: year-to-year variability is far larger than any drift over these record lengths.
Limitations
- The Sabadell records cover 15–17 complete years, so slopes are sensitive to the first and last years. They describe this period, not a long-term climate trend.
- The Mann-Kendall test used here does not correct for serial autocorrelation, which can overstate significance.
- Station siting matters: an urban site and a peri-urban site in the same town are not directly comparable.
- Figures on this page are recomputed from annual aggregates (years with ≥ 90 % daily coverage). The notebooks also include seasonal Mann-Kendall, Pettitt change-point tests and SPEI drought indices.
Machine learning
Reconstructing a day's temperature curve from daily data
Sabadell Centre only reports daily values. The aim was to estimate its 30-minute temperature curve using a model trained where both resolutions exist. The task: predict the 48-value (30-min) temperature curve of a day from its daily aggregates.
Input → target
Real 30-min observations at Sabadell Nord · 2023-07-19 (UTC)
Dashed lines are what the model sees (daily aggregates, plus humidity, rain, pressure and calendar features). The cyan curve, 48 values per day, is what it has to reconstruct.
Model comparison
Held-out test set · 3,832 days · 2021-01 → 2026-04
- Sinusoidal fitbaseline1.468 °C
Physical baseline (oracle: A and φ fitted to the true day)
- K-Nearest Neighbours1.454 °C
k = 10, Manhattan, distance-weighted
- Random Forest1.266 °C
300 trees, max depth 20
- Multilayer Perceptron1.177 °C
(256, 128), lr 0.01, α 0.001
- XGBoostnot scored
Implemented in the pipeline but not installed in the executed run, so it has no reported score.
Axis truncated to 1.0–1.5 °C to make differences visible. Lower is better.
The baseline is physical: a sinusoid whose amplitude and phase are fitted to each real day, which is already an optimistic reference. The MLP improves on it from 1.47 to 1.18°C RMSE without seeing the day's curve, using a strictly temporal split so no future information leaks into training.
The MLP trained on Sabadell Nord was used to generate a synthetic 30-min temperature series for Sabadell Centre (2008–2026), which only has daily data. Validation RMSE on the Sbd Nord test set: 1.149 °C.
Features (12)
Train 13,238 days · 1996-02 → 2020-12 · Test 3,832 days · 2021-01 → 2026-04 · 5-fold GridSearchCV on the training set.
Methodology
From API calls to conclusions
Collect
01Download 30-min and daily observations from the Meteocat API, logging failed dates so gaps are known rather than silent.
Clean
02Merge, deduplicate and type the series; build daily aggregates; keep gaps explicit instead of interpolating.
Explore
03Seasonal cycles, hourly rainfall patterns, intensity distributions, and Pearson/Spearman correlations between variables.
Test
04Mann-Kendall, Sen's slope, Pettitt change-point and seasonal Mann-Kendall, implemented in a reusable module with pytest tests.
Model
05Feature engineering, temporal train/test split, grid-searched KNN, Random Forest and MLP against a sinusoidal baseline.
Communicate
06A Dash dashboard for rain, temperature and wind, and this page for a public overview.
Technical implementation
Tools and repository
Analysis
- Python 3.10+
- Pandas · NumPy
- SciPy
- Matplotlib
- Jupyter
Modelling & testing
- scikit-learn
- GridSearchCV
- spei (drought indices)
- pytest
Delivery
- Dash · Plotly dashboard
- This page: Next.js, D3 scales, Leaflet
- Data build script: Pandas + statsmodels LOESS
Repository
github.com/DavidDDRC99/VO-evolution
Notebooks, scripts, dashboard and tests. Documentation in Catalan.
Data: Servei Meteorològic de Catalunya (Meteocat), open data. Station coordinates for XF and D2 from Meteocat station metadata.