Monthly Rainfall Trends at Four Irish Weather Stations (1850-2014)

Author

Megan Herbert-Valentine

Published

January 14, 2026

1. Introduction

The purpose of this blog is to exhibit monthly rainfall time series on a dygraph from the Irish weather stations at Belfast, Dublin Airport, Cork Airport, and University College Galway. The inclusion of the RangeSelector control has been added to provide a straightforward interface for panning and zooming on the dygraph. This allows for a more precise analysis of the monthly rainfall for the four stations. The analysis will be done through the application of a rainfall data set and be accomplished by using R coding software.

2. Methodology📈

Data

The data set used throughout is known as Rainfall.RData . This data set is made up of 25 Irish Weather Stations. There is no missing values, with the dates running from 1850-2014 by month. The data set consists of four headings: Year, Month, Rainfall and Station The four stations which will be examined in this report are as follows:

  • Belfast

  • Dublin Airport

  • Cork Airport

  • University College Galway

Loading Data

This is the first step required when looking to analyse a data set. It involves setting up the respective working directory needed to complete the analysis. This is then followed by loading in Rainfall.RData into R.

setwd("C:/Users/megan/OneDrive/Documents/Class Materials-20260113")

load('rainfall.RData')

Loading the Required Libraries

This step is required to load in the packages that are required to analyse the rainfall data set accordingly.

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.1.4     ✔ readr     2.1.6
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.1     ✔ tibble    3.3.0
✔ lubridate 1.9.4     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── 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(magrittr)

Attaching package: 'magrittr'

The following object is masked from 'package:purrr':

    set_names

The following object is masked from 'package:tidyr':

    extract
library(dygraphs)
library(RColorBrewer)

Grouping the Data

The rainfall data needs to be grouped using the command group_by . The individual rainfall observations are merged to a total monthly rainfall value, and the rainfall data is combined to concentrate on Year and Month. The rainfall data set is first ungrouped into a single rainfall variable before being transformed into a monthly time series with a frequency of 12(months in a year) starting in January 1850. window() function extracts an exact subset of the time series, isolating January 1850 till December 1850. The window() function was used on the 4 weather station isolating the data to only the required stations.

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.
dubbelcorkgal_ts <- cbind(dub_ts,bel_ts,cork_ts,gal_ts)
window(dubbelcorkgal_ts,c(1850,1),c(1850,12))
         dub_ts bel_ts cork_ts gal_ts
Jan 1850   75.8  115.7   155.3  108.9
Feb 1850   47.8  120.5    92.6  131.5
Mar 1850   18.5   56.8    56.0   56.6
Apr 1850   97.5  142.6   207.2  120.5
May 1850   58.6   57.9    35.3   69.8
Jun 1850   43.6   62.0    11.4   74.7
Jul 1850   66.0   96.3   179.0   89.1
Aug 1850   41.2  110.4    46.5  136.8
Sep 1850   54.2   65.8    40.7   85.2
Oct 1850   40.4   87.6    53.8   90.7
Nov 1850   60.0  104.4   153.2  131.3
Dec 1850   81.1   57.6   169.4   90.6

Combining the 4 Weather Stations

The command cbind was applied to the unique subset of the data of the weather stations:

  • Belfast

  • Dublin Airport

  • Cork Airport

  • University College Galway

This was also done above when using the window() command to bring the 4 weather stations together. For Dygraph 1 and 2 below the cbind command is applied.

Dygraph

Dygraph 1: multivariate time series

The subset which was created of the 4 combined weather stations is plotted below for analysis. The dygraph includes a dyRangeSelector command which allows the interpretation of a specific time periods, if the need to focus in on a particular time period from the subdata set. This is helpful as it can be difficult to scan and analysis all 4 weather stations from 1850-2014. The dygraph demonstrates a rolling mean through the control called dyRoller. Below the dygraph demonstates the rainfall level data for the combined stations of Dublin Airport, Belfast, Cork Airport and University College Galway. The dygraph is set between the period of 1850-2014.

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

Dygraph 2: Enhanced multivariate time series

To enhance the dygraph adding in the library(RColorBrewer) variable, to alter the colour palette. Along with adding the colnames(bdc_ts) so that it is clear to identify the weather station names. This helps to enhance the dygraph, along with adding xlab and ylab to illustrate the data.

library(dygraphs)
library(RColorBrewer)

bdc_ts <- cbind(bel_ts, dub_ts, cork_ts, gal_ts)
colnames(bdc_ts) <- c("Belfast", "Dublin", "Cork", "Galway")

bdc_ts %>%
  dygraph(main = "Monthly Rainfall at Four Irish Weather Stations", width = 900, height = 450, xlab = "Year", ylab = "Monthly Rainfall (mm)") %>%
  dyOptions(colors = brewer.pal(4, "Dark2"),
    strokeWidth = 2 ) %>%
  dyRangeSelector() %>%
  dyRoller()

Dygraph 3: Rolling Mean

The dyRoller(rollPeriod=) is used to select a roll period, which allows for the 600 choosen values of data to be placed on a dygraph. This shrinks the amount of values being seen in the dygraph, so that it can smoothen out the noisy data on the long term period being illustrated.

{r}
bdc_ts <- cbind(bel_ts,dub_ts,cork_ts,gal_ts)
bdc_ts %>% dygraph(main = "Rolling Mean for the  4 station between 1850 till 2014", width = 900, height = 450, xlab = "Year", ylab = "Monthly Rainfall (mm)") %>%
  dyAxis("y", label = "Rainfall (mm)") %>% dyRangeSelector %>% dyRoller(rollPeriod = 600)

Dygraph 4: 4 Irish Weather Station time series

The code for dygraph 3, is to create 4 aligned dygraphs, for the weather stations. This means that they are displayed seperately on their own dygraph but aligned together. the dub_belf_cork_gal is the group identifier. The group argument allows the chosen identifer to be shared on a multiple dygraph, as they share the same values (x-axis). If the groupis removed each dygraph would be displayed seperately. This means the dyRangeSelector would only apply to belfast; were below it is connected to all 4 dygraphs. dyOption(colour=) was added so that each weather station has its own unique colour.

dub_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="Dublin Airport")%>% 
  dyOptions(colors = "blue")
cork_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="Cork Airport")%>% 
  dyOptions(colors = "red")
dub_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="University College Galway")%>% 
  dyOptions(colors = "green")
bel_ts %>% dygraph(width=800,height=170,group="dub_belf_cork_gal",main="Belfast") %>% dyOptions(colors = "purple") %>% dyRangeSelector

3. Results📊

Dygraph 1:

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

Dygraph 2:

library(dygraphs)
library(RColorBrewer)

bdc_ts <- cbind(bel_ts, dub_ts, cork_ts, gal_ts)
colnames(bdc_ts) <- c("Belfast", "Dublin", "Cork", "Galway")

bdc_ts %>%
  dygraph(main = 
            "Monthly Rainfall at Four Irish Weather Stations", 
          width = 900, height = 450, xlab = "Year", ylab = "Monthly Rainfall (mm)") %>%
  dyOptions(colors = brewer.pal(4, "Dark2"),
    strokeWidth = 2 ) %>%
  dyRangeSelector() %>%
  dyRoller()

Dygraph 3:

bdc_ts <- cbind(bel_ts,dub_ts,cork_ts,gal_ts)
bdc_ts %>% dygraph(main = "Rolling Mean for the  4 station between 1850 till 2014", width = 900, height = 450, xlab = "Year", ylab = "Monthly Rainfall (mm)") %>%
  dyAxis("y", label = "Rainfall (mm)") %>% dyRangeSelector %>% dyRoller(rollPeriod = 600)

Dygraph 4:

dub_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="Dublin Airport")%>% 
  dyOptions(colors = "blue")
cork_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="Cork Airport")%>% 
  dyOptions(colors = "red")
dub_ts %>% dygraph(width=800,height=130,group="dub_belf_cork_gal",main="University College Galway")%>% 
  dyOptions(colors = "green")
bel_ts %>% dygraph(width=800,height=170,group="dub_belf_cork_gal",main="Belfast") %>% dyOptions(colors = "purple") %>% dyRangeSelector

4. Discussion📄

Combined four time series that is seen above, displays a singular multivariate time series. All four series fluctuate from one time to the next. There is a lot of overlapping indicating that levels are similar across the weather stations. Seen as both Dygraph 1 and 2 are the same, it is evident on both that November 1899 shows the highest peak in rainfall across the four stations being in Cork Airport, at 460.5mm levels. Cork Airport and University College Galway has showed highest levels of rainfall across the all dygraphs seen in the results .

Dygraph 3 shows that prior to 1860 there was greater fluctuation in the rainfall data recorded. The variable values is much greater at the beginning of the dygraph 3. After 1860 each of the stations remain to have a steady across the years.

Dygraph 4 (4 Irish Weather Station Time Series) is easier if you want to view the data seperately which can visuably be clear to see each weather stations. Dygraph 4, has shown high variability across the four stations on a month to month basis. It has allowed to individually analysis each station and the RangeSelector has allowed to view were the dygraphs stations has their own peaks. University College Galway reached high peak at 329.4 mm in November 2009. Belfast reached a peak in December 1978 at 329.5 mm. For Dublin Airport the rainfall has stayed below 200 mm across the entire period from 1850 - 2014. While Dublin Airport remains low, Cork Airport rainfall data has experienced a greater fluctuation.

5. Conclusion

This blog show how to create a dygraph of weather stations and including a RangeSelector control which has simultaneously changed the time window on the four weather station series. Dygraph can be improved by adding library(RColorBrewer) or giving it a xlab and ylab to help make the dygraphs clearer. Many different functions and commands can be tried to help analysis the weather stations rainfall levels better. Dygraph are interactive and has allowed the four Irish weather station data to be clearly displayed. It has easily allowed to identify by looking at the dygraphs when peak rainfall was experienced for weather stations such as Cork Airport.

Thank You💻

Thank you for reading this blog, now it is time to practice the functions yourself!