Monthly Rainfall Time Series for Belfast, Dublin Airport, University College Galway and Cork Airport

Author

Gráinne Sheehan

Published

January 7, 2026

1. Introduction

This blog demonstrates how to create a dygraph of the weather stations at Belfast, Dublin Airport, University College Galway, and Cork Airport. It shows the time series of rainfall on a monthly basis that also includes a RangeSelector control that simultaneously changes the time window on the four time series. The analysis uses historical monthly rainfall data and visualises the time series using an interactive dygraph. The purpose of this dygraph is to allow comparison of rainfall variability across these stations and to explore changes over time using an interactive window.

2. Data used

The data used in this blog are monthly rainfall observations from Irish weather stations. The data is loaded from the rainfall.RData which contains rainfall measurements of the year, month and station from January 1850 to 2014. Belfast, Dublin Airport, University College Galway and Cork Airport are the weather stations chosen for this analysis.

3. Code used

# 
library(tidyverse)  
Warning: package 'ggplot2' was built under R version 4.5.2
Warning: package 'dplyr' was built under R version 4.5.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.5
✔ forcats   1.0.1     ✔ stringr   1.5.2
✔ ggplot2   4.0.1     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.1
✔ purrr     1.1.0     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(sp)
library(RColorBrewer) 
load("rainfall.RData")
rain %>%  group_by(Year,Month) %>% 
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% 
  ts(start=c(1850,1),freq=12) -> rain_ts
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
rain_ts %>% window(c(1870,1),c(1871,12))
        Jan    Feb    Mar    Apr    May    Jun    Jul    Aug    Sep    Oct
1870 2666.2 1975.3 1500.5 1024.8 1862.8  789.2 1038.6 1510.5 2045.5 5177.6
1871 3148.3 2343.7 1731.7 2654.5  657.6 2040.1 3705.0 1869.9 2083.4 2774.3
        Nov    Dec
1870 1733.2 1902.2
1871 2000.1 1902.0
library(dygraphs) 
Warning: package 'dygraphs' was built under R version 4.5.2
rain %>%  group_by(Year,Month) %>% filter(Station=="Dublin Airport") %>%
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>%
  ts(start=c(1850,1),freq=12) ->  dub_ts
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
rain %>%  group_by(Year,Month) %>% filter(Station=="Belfast") %>%
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>%
  ts(start=c(1850,1),freq=12) ->  bel_ts
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
rain %>%  group_by(Year,Month) %>% filter(Station=="Cork Airport") %>%
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>%
  ts(start=c(1850,1),freq=12) ->  cork_ts 
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
rain %>%  group_by(Year,Month) %>% filter(Station=="University College Galway") %>%
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>%
  ts(start=c(1850,1),freq=12) ->  gal_ts 
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
bdc_ts <- cbind(bel_ts,dub_ts,cork_ts, gal_ts) 
bdc_ts %>% 
  dygraph(width=800,height=450) %>% 
  dySeries("bel_ts", color = "red") %>% 
  dyRangeSelector() %>% 
  dyRoller() 

4. Code explanation

Initial load up of some libraries and data The libraries tidyverse, sp, RColorBrewer and dygraphs are loaded. Tidyverse allows one to pipeline data frames through operations and modify them as a result, the sp package allows us to handle spatial data, RColorBrewer provides colour palettes for data visualisation and dygraph is used to create interactive time series plots in R. The rainfall data is loaded in also.

library(tidyverse)  
library(sp)
library(RColorBrewer) 
load("rainfall.RData")

A monthly rainfall timeseries is created by using the full rainfall dataset. A small timeframe, 1870-1871, is used to check that the time series was successfully created.

rain %>%  group_by(Year,Month) %>% 
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% 
  ts(start=c(1850,1),freq=12) -> rain_ts
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.
rain_ts %>% window(c(1870,1),c(1871,12))
        Jan    Feb    Mar    Apr    May    Jun    Jul    Aug    Sep    Oct
1870 2666.2 1975.3 1500.5 1024.8 1862.8  789.2 1038.6 1510.5 2045.5 5177.6
1871 3148.3 2343.7 1731.7 2654.5  657.6 2040.1 3705.0 1869.9 2083.4 2774.3
        Nov    Dec
1870 1733.2 1902.2
1871 2000.1 1902.0

A monthly rainfall timeseries was created for Dublin airport first. The Rain variable was filtered to only select the rainfall that was collected at Dublin Airport station. The group_by(Year,Month) filtered the data so that all rainfall from the same year and month were combined which then summarised the rainfall values for each year-month group. This was conducted for the other weather stations Belfast, University College Galway and Cork Airport.

rain %>%  group_by(Year,Month) %>% filter(Station=="Dublin Airport") %>%
  summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>%
  ts(start=c(1850,1),freq=12) ->  dub_ts
`summarise()` has grouped output by 'Year'. You can override using the
`.groups` argument.

The four time series were then converted into a single object, bdc_ts. An interactive dygraph depicting the four time series was then plotted. The dyRangeSelector added an interactive range selector below the graph, allowing the user to change the time window displayed. The dyRoller() adds a control that allows a rolling average to be applied to the time series, helping to smooth short-term variability. The Belfast station was coloured red so that it was visually distinguishable from the other stations.

bdc_ts <- cbind(bel_ts,dub_ts,cork_ts, gal_ts) 
bdc_ts %>% 
  dygraph(width=800,height=450) %>% 
  dySeries("bel_ts", color = "red") %>% 
  dyRangeSelector() %>% 
  dyRoller()

5. Discussion of Patterns that have been identified.

There are clear distinctions of rainfall patterns between the different weather stations represented in the dygraph. Cork Airport (south) and University College Galway (west) weather stations typically exhibit a higher rolling average of rainfall weather patterns relative to the Dublin Airport station. This reflects the wetter weather conditions in the west and south of the country in comparison to the east. Dublin Airport tends to have lower rainfall patterns in comparison to the other weather stations, and the University College Galway station generally represents the highest. The weather station at Belfast generally represents mid-range rainfall values in contrast to the other stations.