About this case study. This independently developed case study illustrates XpertScientific’s approach to focused scientific data-analysis projects. It demonstrates source verification, data preparation, statistically robust trend estimation, uncertainty quantification, sensitivity analysis, scientific visualisation, and technical reporting.
The analysis is presented as an example of our scientific consulting capabilities rather than as a comprehensive or peer-reviewed assessment of climate change in Barcelona. The source data are publicly available, whereas the analytical code and associated workflow are proprietary to XpertScientific.

For current services, see our Science Consulting and Modelling Projects pages.

Related interactive tool: Explore the Barcelona Temperature Tracker, which compares recent daily mean temperatures at Fabra Observatory with historical ranges and selectable 30-year climatological baselines.

Cite as

Ross O.N. (2026). Long-term temperature and precipitation trends in the reconstructed Barcelona climate series (1780–2025). XpertScientific Scientific Data Analysis Case Study. Barcelona: XpertScientific. DOI: 10.5281/zenodo.21683119. Available from: https://xpertscientific.com/barcelona-climate-data-analysis-case-study/.

Download PDF version of this case study

Abstract

Barcelona has unusually long reconstructed and homogenised climate records, with monthly temperature data extending back to 1780 and precipitation data to 1786. Annual observations through 2025 were analysed using ordinary least-squares regression, with Newey–West heteroscedasticity- and autocorrelation-consistent estimates used to quantify uncertainty. Recent multidecadal trends were also compared with historical-reference distributions derived from detrended observations ending in 1949 by means of a moving-block bootstrap. In addition, the temperature analysis was repeated across a range of regression-window lengths to assess how strongly the estimated trends depended on the chosen timescale. Mean annual temperature rose by 0.09°C per decade over 1780–2025, compared with 0.67°C per decade over 2000–2025. For the latest 51-year period, 1975–2025, the estimated warming rate was 0.50°C per decade and lay above the historical-reference limits for every block length examined. The full-record precipitation trend was positive, although this result was strongly affected by exceptionally dry conditions in the early nineteenth century. More recent precipitation trends were negative, but their confidence intervals included zero. The results therefore provide clear evidence of strong recent warming in Barcelona, whereas the direction of recent long-term precipitation change remains uncertain.

Keywords: Barcelona climate; homogenised climate series; temperature trends; precipitation variability; time-series analysis; Newey–West covariance; moving-block bootstrap.

Introduction

Long instrumental records are particularly valuable because they allow recent climatic changes to be viewed against a much wider background of interannual and multidecadal variability. Barcelona has reconstructed and homogenised monthly records of mean temperature beginning in 1780 and precipitation beginning in 1786. These are composite urban series assembled from observations collected at several sites, by different institutions and observers, rather than uninterrupted measurements from a single meteorological station (Prohom Duran et al., 2012; Prohom et al., 2016; Meteocat, 2026).

The Barcelona record also needs to be considered within the broader warming observed across Spain, Europe, and the world. According to the Spanish State Meteorological Agency (AEMET), mean annual temperature in Spain increased by 1.75°C between 1961 and 2025 (AEMET, 2026). Over roughly the past three decades, Europe has warmed at about 0.56°C per decade, more than twice the corresponding global rate of approximately 0.27°C per decade (C3S/ECMWF and WMO, 2026). Globally, the years 2015–2025 were the 11 warmest in the instrumental record, and the mean surface temperature in 2025 was approximately 1.43°C above the 1850–1900 average (WMO, 2026). These figures cannot be compared directly because they refer to different periods, geographical scales, baselines, and statistical measures. Taken together, however, they show that warming in Spain and Europe is part of a persistent global trend, with a particularly strong signal over European land.

Further warming is expected over the coming decades. For 2041–2060, the IPCC gives best estimates of approximately 1.6–2.4°C above the 1850–1900 mean across its five illustrative emissions scenarios (IPCC, 2021). In the Mediterranean region, annual warming is projected to exceed the global annual mean by about 20%, and summer warming by about 50%. Precipitation is also expected to decrease across much of the region, although the magnitude and seasonal pattern of that decline depend on future emissions (Ali et al., 2022).

Here, annual temperature and precipitation were analysed to quantify complete-record and recent trends, evaluate the uncertainty of the resulting estimates, compare recent multidecadal trends with a historical reference distribution, and examine the sensitivity of estimated temperature trends to regression-window length.

Methods

Climate data and annual aggregation

Monthly temperature and precipitation observations through 2025 were taken from the reconstructed and homogenised historical climate series for Barcelona published by Meteocat (Meteocat, 2026). Annual mean temperature and total annual precipitation were calculated only when all 12 monthly observations were available. Before publication, the source series had undergone data rescue, quality control, reconstruction, and relative homogenisation to reduce discontinuities associated with changes in site, instrumentation, units, exposure, and observation practice (Prohom Duran et al., 2012; Prohom et al., 2016).

Trend estimation and uncertainty

Ordinary least-squares regressions with an intercept were fitted to the complete records and separately to 2000–2025. The year variable was centred before fitting to improve numerical conditioning, and the resulting slopes were multiplied by 10 so that all trends could be reported per decade. Regression uncertainty was estimated using Newey–West heteroscedasticity- and autocorrelation-consistent (HAC) covariance matrices (Newey and West, 1987; Newey and West, 1994). No prewhitening was applied. Bartlett weights were used, with the truncation lag defined as L = ⌊4(n/100)2/9⌋, subject to a minimum of 1 and a maximum of n − 1, where n is the number of annual observations. The covariance matrices were multiplied by the finite-sample correction n/(n − 2). The lag rule yielded L = 4 for the complete records, L = 2 for the 2000–2025 regressions, and L = 3 for each 51-year regression. Asymptotic 95% confidence intervals and two-sided Wald tests of a zero-trend null hypothesis were calculated using standard-normal critical values.

Changes over multidecadal timescales were examined with trailing 51-year regressions. Each slope was assigned to the final year of the interval from which it was calculated. Thus, the value plotted for 2025 represents the trend over 1975–2025. Pointwise 95% Newey–West HAC confidence intervals were obtained for each trailing estimate using the same procedure as for the fixed-period regressions.

Historical-reference bootstrap

Historical-reference distributions were constructed separately for temperature and precipitation using annual observations through 1949. A linear trend was first removed from each reference series, after which the residuals were centred on zero. The cutoff at 1949 was chosen to provide a pre-1950 baseline while excluding most of the stronger warming that occurred later in the record.

A moving-block bootstrap was used to retain temporal dependence within the historical residuals (Künsch, 1989). Overlapping blocks of consecutive observations were sampled uniformly with replacement and joined together until a synthetic 51-year series had been formed; any excess observations were then discarded. This procedure was repeated 10,000 times for each of three block lengths: 5, 7, and 10 years. The range was chosen to test the sensitivity of the results to the preservation of dependence over multiannual to approximately decadal timescales, while keeping the blocks substantially shorter than the 51-year analysis window. The selected lengths were not intended to correspond to, or test for, specific climatic cycles.

A linear slope was fitted to every synthetic series. For each block length, the 2.5th and 97.5th percentiles of the resulting slope distribution defined the 95% historical-reference interval. Because there was no clear basis for selecting one block length as preferable, the plotted sensitivity envelope was defined by the lowest lower limit and the highest upper limit obtained from the three bootstrap analyses.

To make the bootstrap output repeatable, the calculations used a fixed Mersenne Twister base seed of 20260724. Separate deterministic seeds were assigned to each variable and block length. For temperature, the seed was the base value plus the block length; for precipitation, it was the base value plus 1000 and the block length.

Regression-window sensitivity analysis

A separate analysis assessed the influence of regression-window length on the estimated temperature trend. Trailing regressions were calculated for every odd-numbered window from 21 to 61 years, including the 31- and 51-year windows. As in the 51-year analysis, each estimate was assigned to the final year of its regression interval. The resulting slopes were displayed as a heat map showing their direction and magnitude; the heat map does not indicate statistical significance.

Results

Fixed-period temperature and precipitation trends

Mean annual temperature increased by 0.09°C per decade over the full 1780–2025 record (HAC standard error, 0.01°C per decade; 95% confidence interval, +0.06 to +0.11°C per decade; p<0.001) (Figure 1). The trend estimated for 2000–2025 was much steeper, at 0.67°C per decade (HAC standard error, 0.17°C per decade; 95% confidence interval, +0.34 to +1.00°C per decade; p<0.001). Most of the highest annual values occurred towards the end of the series. The recent period therefore shows substantially faster warming than the complete-record average, although no formal test was carried out to determine whether the two slopes differ significantly.

Annual Barcelona temperature and precipitation records with complete-period and 2000–2025 linear trends and confidence intervals.
Annual mean temperature and annual precipitation in the reconstructed and homogenised historical climate series of Barcelona. Annual mean temperature is shown for 1780–2025 and annual precipitation for 1787–2025. Linear regressions were fitted to the complete records and to 2000–2025. Shaded regions surrounding the fitted lines indicate pointwise asymptotic 95% confidence intervals calculated using Newey–West heteroscedasticity- and autocorrelation-consistent covariance estimates. Trends are expressed per decade. The HAC confidence intervals for the 2000–2025 regressions are asymptotic estimates based on a relatively short interval and should therefore be interpreted cautiously.

Annual precipitation exhibited pronounced interannual variability (Figure 1). Across 1787–2025, the estimated trend was +3.7 mm per decade (HAC standard error, 1.6 mm per decade; 95% confidence interval, +0.6 to +6.8 mm per decade; p=0.021). This positive slope does not represent a steady increase throughout the record. It is strongly influenced by exceptionally dry conditions in the first half of the nineteenth century, including the prolonged drought of approximately 1808–1835 (Prohom et al., 2016). For 2000–2025, the estimated trend was −26.9 mm per decade, but the uncertainty was substantial (HAC standard error, 49.3 mm per decade; 95% confidence interval, −123.5 to +69.8 mm per decade; p=0.586). The estimate was therefore not statistically distinguishable from zero. This is consistent with the original precipitation study, which attributed the significant full-period increase to the low values recorded in the early nineteenth century and found no significant trends from the mid-nineteenth century onward (Prohom et al., 2016).

Trailing 51-year trends and historical-reference comparison

The trailing 51-year temperature trends moved between periods of warming and cooling over much of the record (Figure 2). For the latest interval, 1975–2025, the estimated trend was +0.50°C per decade (HAC standard error, 0.06°C per decade; 95% confidence interval, +0.38 to +0.61°C per decade; p<0.001). This value lay above the upper 95% bootstrap limit for all three block lengths. The conclusion that the latest 51-year warming trend is unusually large relative to the detrended pre-1950 reference series was therefore unchanged across the tested block-length choices.

Trailing 51-year Barcelona temperature and precipitation trends with pointwise confidence intervals and bootstrap sensitivity envelopes.
Trailing 51-year temperature and precipitation trends in Barcelona. Each value represents the linear trend over the preceding 51 years and is assigned to the final year of the regression interval. Coloured shading surrounding each trend line indicates its pointwise 95% Newey–West HAC confidence interval. Grey bands show conservative historical-reference envelopes derived from 10,000 moving-block bootstrap series for each of three block lengths: 5, 7, and 10 years. The displayed envelope spans the most extreme lower and upper limits obtained across the three analyses.

For precipitation, the corresponding 1975–2025 trend was −24.1 mm per decade (HAC standard error, 13.6 mm per decade; 95% confidence interval, −50.8 to +2.6 mm per decade; p=0.077). The estimate remained inside the bootstrap envelope for each block length. In view of the broad confidence interval, the pronounced year-to-year variability, and the absence of a statistically significant trend, there is no strong evidence that recent multidecadal precipitation change falls outside the range represented by the historical reference series.

Sensitivity to regression-window length

The estimated temperature trend also depended on the length of the regression window (Figure 3). Short windows produced larger and more rapidly changing positive and negative slopes, while longer windows smoothed much of this variation and highlighted lower-frequency change. As a result, the timing and magnitude of individual peaks, pauses, and reversals varied with the selected timescale. Even so, relatively strong positive trends appeared near the end of the record across a wide range of window lengths.

Heat map showing Barcelona temperature trends by final year and regression-window length from 21 to 61 years.
Sensitivity of estimated temperature trends to regression-window length. Colours represent trailing temperature trends calculated over windows ranging from 21 to 61 years. Each cell shows the trend over the preceding interval indicated on the y-axis, ending in the year shown on the x-axis. Dashed contours mark zero trend, and horizontal reference lines indicate the 31- and 51-year windows. The heat map displays trend magnitude rather than statistical significance.

Discussion

Temperature trends in context

The reconstructed Barcelona temperature series shows clear evidence of pronounced recent warming. Over the complete record, the estimated trend of +0.09°C per decade is close to the +0.07°C per decade reported by Prohom Duran et al. (2012) for 1780–2011. Extending the series through 2025 adds several exceptionally warm recent years and produces a slightly higher full-period estimate. The result is also comparable in magnitude to the mean trend of +0.10°C per decade reported for mainland Spain over 1850–2005, although the two estimates refer to different periods, geographical scales, and observational datasets (Brunet et al., 2007). The strongest evidence comes from the latest 51-year interval: the 1975–2025 trend was positive, statistically significant, and above the historical-reference envelope for every bootstrap block length tested.

The multi-window analysis demonstrates that the detailed temporal evolution of the estimated warming rate depends on the timescale considered. Shorter regressions are more responsive to multidecadal fluctuations and to the observations entering or leaving the ends of the window, whereas longer regressions provide more stable but more strongly smoothed estimates. Individual peaks, pauses, or reversals in one trailing-trend curve should therefore not be interpreted as unique climatic change points. The robust result is the persistence of strong recent warming across a wide range of window lengths.

Interpretation of precipitation trends

The precipitation results are less conclusive. The positive slope over the complete record is strongly shaped by the exceptional drought of the early nineteenth century, and the original source study found no significant annual trend over later subperiods (Prohom et al., 2016). Although the estimates for both 2000–2025 and 1975–2025 were negative, their confidence intervals included zero. The latest 51-year trend also remained within every bootstrap envelope examined. The precipitation series therefore points to substantial temporal variability, but it does not provide clear evidence of a resolved recent long-term trend.

Limitations

Several limitations affect the interpretation of these results. The source data are a reconstructed and homogenised urban composite assembled from observations made at different locations and under changing instrumental and observational conditions. Homogenisation can reduce such discontinuities, but it cannot remove all associated uncertainty. This is especially relevant before approximately 1840, when suitable neighbouring reference series are sparse (Prohom Duran et al., 2012).

From 1913 onward, the temperature series is based on observations from Fabra Observatory. Its stable setting and elevated location, approximately 412 m above sea level and outside the densely built city centre, make it less likely that the recent warming signal is primarily an artefact of local urbanisation. Residual local environmental influences cannot, however, be ruled out entirely.

The statistical analysis also has limitations. Linear regression provides an average rate of change over a selected interval and does not describe every feature of the underlying trajectory. Adjacent trailing windows overlap extensively and are therefore not statistically independent. Their confidence intervals are pointwise and do not account for multiple comparisons across years or window lengths. The bootstrap envelope likewise depends on the chosen reference period, detrending model, and block lengths, as well as on the assumption that the dependence structure of the historical residuals remains relevant later in the record. The results should therefore be regarded as a descriptive analysis of the Barcelona series rather than as a formal exercise in climatic detection, attribution, or regionalisation.

Data availability

Monthly mean temperature and monthly accumulated precipitation data were obtained from the Meteocat historical climate series for Barcelona (Meteocat, 2026) and accessed in July 2026. The source data are publicly available under the Creative Commons Attribution 4.0 International licence. The present analysis used observations through December 2025.

Analysis software and code availability

Annual aggregation, linear trend estimation, Newey–West uncertainty calculations, moving-block bootstrap analyses, and graphical output were produced in MATLAB R2025a. The analytical code and associated workflow are proprietary to XpertScientific and are not publicly distributed. The methods and parameter settings are described in sufficient detail to permit independent implementation and evaluation of the analysis.

Suggested citation:
Ross O.N. (2026). Long-term temperature and precipitation trends in the reconstructed Barcelona climate series (1780–2025). XpertScientific Scientific Data Analysis Case Study. Barcelona: XpertScientific. DOI: 10.5281/zenodo.21683119.
Available from https://xpertscientific.com/barcelona-climate-data-analysis-case-study/.

References

  • AEMET. (2026). "Informe sobre el estado del clima de España 2025." Retrieved July, 2026, from https://www.aemet.es/es/conocermas/recursos_en_linea/publicaciones_y_estudios/publicaciones/detalles/informe_estado_clima.
  • Ali, E., Cramer, W., Carnicer, J., Georgopoulou, E., Hilmi, N. J. M., Le Cozannet, G. and Lionello, P. (2022). "Cross-Chapter Paper 4: Mediterranean Region". Climate Change 2022: Impacts, Adaptation and Vulnerability. H.-O. Pörtner, D. C. Roberts, M. Tignor et al., Eds. Cambridge, United Kingdom and New York, NY, USA, Cambridge University Press: 2233-2272. DOI: 10.1017/9781009325844.021.
  • Brunet, M., Jones, P. D., Sigró, J., Saladié, O., Aguilar, E., Moberg, A., Della-Marta, P. M., Lister, D., Walther, A. and López, D. (2007). "Temporal and spatial temperature variability and change over Spain during 1850–2005." Journal of Geophysical Research: Atmospheres 112(D12):D12117. DOI: 10.1029/2006JD008249.
  • C3S/ECMWF and WMO (2026). "C3S-WMO European State of the Climate 2025." DOI: 10.24381/zy93-sb27.
  • IPCC (2021). "Climate Change 2021: The Physical Science Basis." Contribution of Working Group I to the Sixth Assessment Report of the Intergovernmental Panel on Climate Change. Cambridge University Press, Cambridge, United Kingdom and New York, NY, USA. DOI: 10.1017/9781009157896.
  • Künsch, H. R. (1989). "The Jackknife and the Bootstrap for General Stationary Observations." The Annals of Statistics 17(3):1217-1241. DOI: 10.1214/aos/1176347265.
  • Meteocat. (2026). "Serie climatica de Barcelona des de 1780." Retrieved July, 2026, from: https://www.meteo.cat/wpweb/climatologia/dades-i-productes-climatics/serie-climatica-de-barcelona-des-de-1780/.
  • Newey, W. K. and West, K. D. (1987). "A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix." Econometrica 55(3):703-708. DOI: 10.2307/1913610.
  • Newey, W. K. and West, K. D. (1994). "Automatic Lag Selection in Covariance Matrix Estimation." The Review of Economic Studies 61(4):631-653. DOI: 10.2307/2297912.
  • Prohom Duran, M., Barriendos Vallvé, M., Aguilar Anfrons, E. and Ripoll Pi, R. (2012). "Recuperación y análisis de la serie de temperatura diaria de Barcelona, 1780-2011." Cambio Climático. Extremos e Impactos, Asociación Española de Climatología, Serie A 8:207-217.
  • Prohom, M., Barriendos, M. and Sanchez-Lorenzo, A. (2016). "Reconstruction and homogenization of the longest instrumental precipitation series in the Iberian Peninsula (Barcelona, 1786-2014)." International Journal of Climatology 36(8):3072-3087. DOI: 10.1002/joc.4537.
  • WMO (2026). "State of the Global Climate 2025." World Meteorological Organization, Geneva, Switzerland. DOI: 10.59327/WMO/S/CRI/SOC/1.