The purpose of this assignment is to create a time series of precipitation on a monthly basis for Irish weather stations at Dublin Airport, Belfast, Cork Airport and University College Galway from 1850-2014. To post to Rpubs I will use R Markdown through the programming software Rstudio, and visualise the data through a set of graphs using dygraph to analyse the precipitation. For this assignment I will also make use of dyRangeSelector to provide the ability to simultaneously change the viewing window across the four time series to be analysed. This blog will discuss the patterns of the stations mentioned above in the following graphs, accompanied by the code which generated these findings.
As previously mentioned, R Markdown through the use of Rstudio is used for this assignment. Rstudio utilises the R programming language for the use of statistics, graphics and data analysis (Cran. R, 2020a).
Along with temperature, precipitation/rainfall is an important aspect in defining climate. precipitation data can be used to understand the affects climate change has on our past and future hydrologic system (Met, Eireann, 2020a). The data analysed for this assignment derives from Dr. Conor Murphy and Dr. Simon Noone of the Irish Climate Analysis and Research Unit at Maynooth University, with Prof. Chris Brunsdon supplying this data directly to us via our module’s page on Moodle.
To write in blog format in RStudio, first I went to file, new file and then chose R Markdown, followed by choosing the appropriate output format of HTML. I then downloaded all the necessary packages I will be using throughout the assignment and uploaded them. These include dplyr and dygraphs.
dplyr is a package used to provide further options to manipulate data (dplyr, 2021).dplyr packages provides the %>%command, which is an alternative option to insert R code, and will be used throughout this assignment.dygraphs is a package which provides easy visualisation of data to analyse (RStudio, 2021c).knitr package provides functions for dynamic visual reports (r-project, 2021).library(dplyr)
library(dygraphs)
library(knitr)
Following on from this, I need to upload the necessary precipitation data required to carry out the analysis. This was downloaded from Moodle as mentioned above, and placed in the required working directory folder for accessible upload to RStudio.
rainfall.RData file.setwd('/Users/geoffbarron/Documents/MSc/Analysing Spatial and Temporal data/RStudio/Week 7')
load('rainfall.RData')
stations including nine variables which provides information on the location of the twenty five weather stations in this dataset.rain, including four variables highlighting the date, volume of precipitation/rainfall(mm) and the station the data derived from.In order to analyse the four stations required for this assignment, I need to filter each required station from the rain dataframe. I also need to convert the data into a time series to allow for visualisation through the dygraphs function, which will allow for optimum simultaneous analysis of the four stations.
group_by function.filter function is used as seen below.sum of precipitation/rainfall for each month.ungroup function to avoid any unnecessary errors as a result of grouping.transmute function was used to add the new variables requested and drop existing ones in the dataframe.ts function to convert the numeric vector into an R time series object. This includes the total monthly precipitation/rainfall data of the filtered station from 1850-2014, reading in a frequency of 12 months, so to display the data on an annual basis.rain %>% group_by(Year, Month) %>% filter(Station == 'Dublin Airport') %>% summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% ts(start = c(1850,1), frequency = 12) -> Dublin
rain %>% group_by(Year, Month) %>% filter(Station == 'Belfast') %>% summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% ts(start = c(1850,1), frequency = 12) -> Belfast
rain %>% group_by(Year, Month) %>% filter(Station == 'Cork Airport') %>% summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% ts(start = c(1850,1), frequency = 12) -> Cork
rain %>% group_by(Year, Month) %>% filter(Station == 'University College Galway') %>% summarise(Rainfall=sum(Rainfall)) %>% ungroup() %>% transmute(Rainfall) %>% ts(start = c(1850,1), frequency = 12) -> Galway
A time series for all the four weather stations: Dublin Airport, Belfast, Cork Airport and University College Galway were created, allowing for visualisation through the dygraph function.
Before visualising the data on graphs, I need to combine the four time series together through the cbind function. This creates a new dataframe but as a time series object, which provides the possibility to visualise all four stations on the one graph, as will be seen in the results section below. In addition, this also provides the opportunity to utilise the potential of dyRangeSelector and dyRoller functions on the same graph. Making it easy to read and compare the four stations simultaneously.
beldubcorkgal_ts <- cbind(Dublin,Belfast,Cork,Galway)
The following section includes graphs representing the precipitation data across the four weather stations, with a brief description and interpretation of trends or patterns identified in the graphs.
First, I will display the previously combined time series of the four stations on the same graph.
dygraph function is used here in order to display the required stations on the same graph.dygraph also permits the ability to pick a point on the graph, which displays the date and the total value of precipitation/rainfall in each station for that month chosen. This provides straight forward comparison of all four stations on the same date.width and height dimension are specified in order to suit the range of the time period and data on the one graph.dyUnzoom inputs a reset zoom button to refresh the graph.dyCrosshair provides clear analysis on the graph with the addition of a vertical line.dyRangeSelector function provides the ability for the interface to zoom in and out of the graph, by either increasing or decreasing the range on the X axis (RStudio, 2021a).beldubcorkgal_ts %>% dygraph(width = 800, height = 360, main="Precipitation Time Series") %>% dyAxis("y", label = "Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyUnzoom() %>% dyCrosshair(direction = "vertical") %>% dyRangeSelector()
From the outset it is clear the overall precipitation across the four stations follow a consistent and steady trend, but through this graph it is difficult to determine whether the stations are increasing or decreasing over the time period. This will be analysed further on.
However, the Cork Airport station does stand out on many occasions compared to the other stations. Most notably in November of 1899, which recorded a precipitation reading of 460.5mm, compared to Belfast’s 133.4mm, Dublin Airport’s 93.7mm and University College Galway’s 153.1mm of the same month. University College Galway also stands out quite regularly with the highest monthly total. As seen from the graph, it is clear there is a pattern as Cork Airport and University College Galway seem to record the highest readings for monthly precipitation. This could perhaps be explained as both stations are respectively located on the south and west coast of Ireland, thus being more susceptible to the North Atlantic Drift’s associated westerly winds (Met Eireann, 2020b) and being exposed to more precipitation explaining the larger number of anomalies. In comparison to the stations on the east of the country in Dublin Airport and Belfast, which are shown to display the lower monthly readings.
dyroller.dyRoller function allows you to smooth out the display of the time series, as the Y axis values are averaged over the specified number in the box provided on the bottom left of the graph (rdrr, 2021).rollPeriod function which accompanies dyRoller gives the ability to specify the desired average rolling period from the outset, for ease of use this can be adjusted in the bottom-left corner of the graph (RStudio, 2021b).beldubcorkgal_ts %>% dygraph(width = 800, height = 460, main="Precipitation Time Series") %>% dyAxis("y", label = "Mean Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyUnzoom() %>% dyCrosshair(direction = "vertical") %>% dyRangeSelector() %>% dyRoller(rollPeriod = 120)
The dyRoller function allows for a more clear comparison between the four stations. Depending on the desired rollPeriod specified by the user, I have chosen 120 which equates to a 10 year rolling average. This provides for easy interpretation and a steady trend is displayed. Under these circumstances, Dublin Airport, Belfast and University College Galway precipitation levels seem to increase over the time period, with Cork Airport fluctuating the most, but also steadily increasing.
On the default rollPeriod of 120, this graph clearly highlights a steady trend from the 1880s up to the mid 1940s. From 1950 onward there is a clear increase up to 2014, the only exception is a dip from the mid 1970s, regardless on average the total amount of precipitation has increased from 1850-2014.
There also appears to be inconsistencies with the precipitation data from 1850 - 1852, this could be due to lack of efficient recording equipment meaning less data available, or also the Great Irish Famine incurring obstacles which occurred from 1845-1852.
Next is the main aspect of the assignment.
dyRangeSelector function to provide the ability to increase or decrease the range.dyRangeSelector function is entered among the bottom time series, to allow for ease of use as I want to increase or decrease the range of the X axis on all four charts simultaneously.group function for each station. When using the dygraph function, it’s possible to use the group function on two or more graphs to link them together, this allows the possibility to view all the linked graphs under the same group name to be displayed together while also providing the ability to change each individual graph simultaneously, as displayed here through the dyRangeSelector function.Dublin %>% dygraph(width = 800, height = 270, group = "fourstation", main = 'Dublin Airport') %>% dyAxis("y", label = "Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyUnzoom() %>% dyCrosshair(direction = "vertical")
This graph highlights the total monthly precipitation data from 1850 - 2014. The precipitation levels are seen to remain relatively consistent through this time period but with a slight increase, while also with the lowest values compared to the other stations. There were only two readings in Dublin Airport which reached a monthly level of 200mm, this is in stark contrast the other stations as will be seen below. It is clear when comparing the levels of Dublin Airport, they are consistently lower than the other stations. As the Atlantic ocean influences the Irish climate (Met Eireann, 2021b), Dublin Airport is protected in its location on the east coast, as majority of precipitation can be seen falling in Cork Airport and University College Galway.
From 1850-1950, Dublin Airport experienced 17 months exceeding 150mm, but from 1950-2014 this station recorded 13 months exceeding 150mm. Although the number of months are less, it is a much shorter time period, with 7 of these months occurring in 14 years. The rate of occurrence is seen to be increasing as the average number of months exceeding 150mm in Dublin Airport across 1950-2014 is 0.20 months per year, while in contrast to the 100 year period of 1850-1950 reading an average of 0.17 months per year.
Belfast %>% dygraph(width = 800, height = 270, group = "fourstation", main = 'Belfast') %>% dyAxis("y", label = "Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyUnzoom() %>% dyCrosshair(direction = "vertical")
The graph above displays total monthly precipitation data from the period 1850 - 2014. In the second half of the century there seems to be a slight increase in precipitation levels, potentially due to climate change. A large peak is seen in December 1978 reaching 329.5mm, the second highest peak for Belfast was seen in October 1870 at 306.2mm. The third highest monthly average for this station reached 271.8mm in the month of December of 1876. With two out of the three highest peaks in the 19th century, it’s possible to suggest such precipitation extremes are less frequent, with one standing out in 1978, although as mentioned above it seems precipitation levels are increasing in the second half of the twentieth century.
In analysing Belfast from 1950-2014 there were 16 months exceeding 200mm, with 10 of those months occurring since the year 2000. In comparison to a period of 100 years from 1850-1950 there were 13 months exceeding 200mm. Across 1950-2014 the average amount of months exceeding 200mm was 0.15, while across 1850-1950 it worked out to be 0.13 months per year.
Cork %>% dygraph(width = 800, height = 270, group = "fourstation", main = 'Cork Airport') %>% dyAxis("y", label = "Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyUnzoom() %>% dyCrosshair(direction = "vertical")
The graph above highlights the monthly precipitation data for the years 1850 - 2014. Overall the precipitation levels have remained steady throughout this period with a slight increase, although there have been a large number of months reaching the 300mm mark. In comparison to Belfast where only two months which recording a reading of precipitation greater than 300mm, Cork Airport reached the 300mm mark on twelve occasions. Demonstrating more extreme events have occurred in Cork in comparison to Belfast, and Dublin which recorded zero months reaching the 300mm level. Although this last extreme was January 1974 at 342.7mm, more than 50 years have passed since the last monthly total reached the 300mm mark. The highest peak for Cork Airport was reached in November 1899, reading at 460.5mm.
Although going against the trend of the other three stations and quite interesting to note, Cork Airport recorded 81 months exceeding 200mm from 1850-1950, while from 1950-2014 there were 51 months. Although the difference of occurrence for these two readings are quite small, with the period of 1950-2014 recording an average of 0.79 months per year exceeding 200mm, and from 1850-1950 recording an average of 0.81 months per year exceeding 200mm.
Galway %>% dygraph(width = 800, height = 270, group = "fourstation", main = 'University College Galway') %>% dyAxis("y", label = "Precipitation (mm)") %>% dyAxis("x", label = "Year") %>% dyRangeSelector() %>% dyUnzoom() %>% dyCrosshair(direction = "vertical")
The graph above shows the total monthly level of precipitation recorded for the period 1850 - 2014. It seems there is a rise in precipitation levels from 1950 onward, as a large number of months are recording precipitation levels of 200mm or more, in comparison to 1850 - 1950. This could be interpreted as a result of climate change, with a warmer atmosphere increasing the capacity to store larger amounts of water vapour (Trenberth, 2011), thus increasing precipitation levels over the west coast of Ireland, as the Atlantic Ocean has a major influence on the Irish climate (Met Eireann, 2020b). In addition there are only three months reaching a level of over 300mm total monthly precipitation, way below Cork Airport which reached this number over twelve times. The highest recording for University College Galway was in November 2009, reaching a level of 329.4mm.
Again while looking at University College Galway, there were 35 months exceeding the 200mm mark from 1850-1950, while from 1950-2014 there were 37 months, 13 of these since the year 2000. From 1950-2014 the average number of months exceeding 200mm worked out to be 0.57 months per year, while across 1850-1950 this worked out to be 0.35 months per year.
Below I ran simple summary and sum functions to calculate the total amount, minimum, median, mean, maximum and the 25th and 75th percentile range of precipitation recorded for each station. This provides easy interpretation of each station’s recordings.
kable function is utilised here in order to create a visual table for straight forward comparisons between the four stations.summary(beldubcorkgal_ts) ->fourstationsummary
knitr::kable(fourstationsummary, caption = "Summary of Precipitation (mm)")
| Dublin | Belfast | Cork | Galway | |
|---|---|---|---|---|
| Min. : 1.50 | Min. : 1.80 | Min. : 0.6 | Min. : 0.40 | |
| 1st Qu.: 37.30 | 1st Qu.: 55.60 | 1st Qu.: 54.4 | 1st Qu.: 65.25 | |
| Median : 56.00 | Median : 82.10 | Median : 90.0 | Median : 95.65 | |
| Mean : 61.43 | Mean : 87.11 | Mean :100.0 | Mean :101.43 | |
| 3rd Qu.: 79.72 | 3rd Qu.:113.72 | 3rd Qu.:133.9 | 3rd Qu.:131.90 | |
| Max. :217.00 | Max. :329.50 | Max. :460.5 | Max. :329.40 |
Total_rain<-rain %>% group_by(Station) %>% filter(Station== c('Dublin Airport','Belfast','University College Galway','Cork Airport'))%>% summarise("Total Precipitation (mm)"=sum(Rainfall))
knitr::kable(Total_rain, caption = "Total Precipitation")
| Station | Total Precipitation (mm) |
|---|---|
| Belfast | 43319.24 |
| Cork Airport | 49763.50 |
| Dublin Airport | 30667.00 |
| University College Galway | 50625.35 |
From the detailed analysis above, it is clear there is a consistent trend of precipitation levels in Ireland from 1850 - 2014. But with deeper analysis, there are different trends among the four stations. Dublin Airport is seen to be the station with the lowest monthly precipitation value, with Belfast third, followed by Cork Airport. University College Galway was the station which had the highest precipitation. Although there was a larger amount of precipitation in University College Galway, there were more months reaching 300mm or more in Cork Airport, occurring on twelve occasions compared to University College Galway’s three. Thus, suggesting more severe precipitation on the south coast of Ireland.
Interestingly as seen from section 4.4, although Cork Airport and University College Galway both recorded the highest maximum monthly precipitation and the highest monthly average, they also recorded the lowest monthly precipitation value, University College Galway at 0.40mm in April 1938 which occurred during the longest absolute drought in Ireland (Met Eireann, 2021c). Cork Airport’s record monthly low occurred in June 1921 at 0.60mm. This coincided with a 2 year drought period in Ireland (Noone, et al., 2017). Dublin Airport’s lowest reading was 1.50mm which occurred surprisingly during the winter of January 1891, when the highest reading for this station was also in the winter month of December 1978 at 217mm, although the low level of precipitation in 1891 was due to a prolonged drought (Noone & Murphy 2020). Another drought coincided with Belfast’s lowest monthly reading of 1.8mm in August 1894 (Noone and Murphy 2020).
When analysing each graph individually from section 4.3 and reviewing the number of months exceeding 200mm, there is a definite increase across three of the four stations when comparing 1850-1950 and 1950-2014, with Cork Airport the smallest margin of decrease. Notably University College Galway had the highest rate of increase from an average of 0.35 months per year to exceed 200mm across the 1850-1950 period, increasing to an average of 0.57 months per year from 1950-2014. In addition, while analysing the occurrences of the lowest monthly values, they have all occurred from 1938 and before. Also to note that all three stations bar Cork Airport recorded their highest reading from 1978 onward.
As the 20th century has progressed, there has been an increase of greenhouse gases, with average global surface temperature anomalies steadily increasing since the 1950s (Lindsey & Dahlman, 2020), along with sea surface temperatures rising at 0.13°C every decade for the past hundred years (IUCN, 2021). Thus, further heating up the atmosphere and subsequently increasing the water holding capacity of air by roughly 7% per 1°C of warming (Trenberth, 2011). An increase in sea surface temperature also leads to an increase in moisture content in the atmosphere over oceans (IPCC, 2013). With this increase in water vapour in the atmosphere, leading to increased moisture and precipitation, our findings among the four stations with such low precipitation values all occurring before 1939, show proof of an ever increasing changing climate.
From the analysis of section 4.2 above, each station is seen to have increasing levels of precipitation from 2000-2012, most notably Dublin Airport, Belfast and University College Galway, studies have correlated with this increase, that from 2006-2015 is noted as the wettest decade across a 300-year annual series (Murphy, et al. 2018). Further research has also highlighted a change in the North Atlantic Oscillation (NAO) around 1975. This increases westerly airflow circulation in the Atlantic, thus resulting in a wetter climate for Ireland (Kiely, 1999). The increase in the four stations occurring after 1975 as seen in section 4.2, corresponds with Kiely’s (1999) study, where he also highlighted a 10% increase since 1975 on the west coast of Ireland. In short, these studies correlate with the findings from the results section above.
This assignment set the task of analysing monthly precipitation data from four weather stations in Ireland through the use of RStudio and the function dygraph. From the discussion and analysis above, it is evident that while Ireland is a small country, precipitation levels are unevenly distributed, with the highest levels in the west and the south of the country, while the lowest occurs in the east. There is a noticeable trend of increased precipitation as the twentieth century comes to an end, this is seen when comparing the time periods of 1850-1950 and 1950-2014, in addition to the timing of the record lows among each station being detected are all occurring in 1938 and before. The above analysis is seen to highlight a correlation of an increase in average global surface temperature anomalies, an increase in sea surface temperatures, a change in the NAO, all resulting in an increase in precipitation levels in Ireland, pointing towards a changing climate.
Cran.R (2021a) R Language definition [online]. Availabe at: https://cran.r-project.org/doc/manuals/r-devel/R-lang.html#Introduction (accessed 18 January 2021).
dplyr, (2021) Overview [online]. Available at: https://dplyr.tidyverse.org/(accessed 18 January 2021).
IPCC (Intergovernmental Panel on Climate Change) (2013) Climate change 2013: The physical science basis. Working Group I contribution to the IPCC Fifth Assessment Report [online]. Cambridge, United Kingdom: Cambridge University Press. Available at: www.ipcc.ch/report/ar5/wg1 (accessed 18 January 2021)
IUCN (2020) Ocean warming [online]. Available at: https://www.iucn.org/resources/issues-briefs/ocean-warming#:~:text=Data%20from%20the%20US%20National,over%20the%20past%20100%20years (accessed 18 January 2021).
Kiely, G. (1999) Climate change in Ireland from precipitation and stream¯ow observations. Advances in Water Resources [online]. 23, 141-151. Available at: https://www.ucc.ie/en/media/research/hydromet/1-s2.0-S0309170899000184-main.pdf (accessed 18 January 2021).
Lindsey, R. & Dahlman, L. (2020) Climate Change: Global Temperature [online]. Available at: https://www.climate.gov/news-features/understanding-climate/climate-change-global-temperature (accessed 18 January 2021).
Met Eireann (2021a) Rainfall Climate of Ireland [online]. Available at: https://www.met.ie/climate/what-we-measure/rainfall (accessed 18 January 2021).
Met Eireann (2021b) Climate of Ireland [online]. Available at: https://www.met.ie/climate/climate-of-ireland (accessed 12 January 2021).
Met Eireann (2021c) Weather Extreme Records for Ireland [online]. Available at: https://www.met.ie/climate/weather-extreme-records (accessed 18 January 2021).
Murphy, C. et al. (2018) A 305-year continuous monthly rainfall series for the island of Ireland (1711–2016). Climate of the Past [online]. 14, 413-440. Available at: https://doi.org/10.5194/cp-14-413-2018 (accessed 18 January 2021).
Noone, S., & Murphy, C. (2020) Reconstruction of hydrological drought in Irish catchments (1850–2015). Proceedings of the Royal Irish Academy: Archaeology, Culture, History, Literature [online]. 1-26. Available at: doi:10.3318/priac.2020.120.11 (accessed 18 January 2021).
Noone, S., et al. (2017) A 250-year drought catalogue for the island of Ireland (1765-2015). International Journal of Climatology [online]. 37 (1), 239-254. Available at: http://mural.maynoothuniversity.ie/10973/1/Noone_et_al-2017-International_Journal_of_Climatology.pdf (accessed 18 January 2021).
rdrr (2021) dyRoller: dygraph rolling average period text box [online]. Available at:https://rdrr.io/github/rstudio/dygraphs/man/dyRoller.html (accessed 18 January 2021).
r-project (2021) knitr [online]. Availabe at: https://www.r-project.org/nosvn/pandoc/knitr.html (accessed 18 January 2021).
RStudio (2021a) Range Selector [online]. Available at: https://rstudio.github.io/dygraphs/gallery-range-selector.html (accessed 18 January 2021).
RStudio (2021b) Roll Periods [online]. Available at: https://rstudio.github.io/dygraphs/gallery-roll-periods.html (accessed 18 January 2021).
RStudio (2021c) dygraphs for R [online]. Available at: https://rstudio.github.io/dygraphs/index.html (accessed 18 January 2021).
Trenberth, K.E. (2011) Changes in precipitation with climate change. Climate Research [online]. (47), 123-138. Available at: https://doi.org/10.3354/cr00953 (accessed 17 January 2021).