A map of Ireland’s January median rainfal color coded across 25 weather stations for 164 years (1850-2014)

Author

Okello Simon

Data source

Ireland weather data of 164 years (1850-2014) providing long view of rainfall patterns. Data contains files for weather stations names,locations (longitudes & latitudes), elevations. It was saved in Rbinary to allow easy loading into Rstudio. Data was supplied by Prof. Conor Murphy and Dr. Simon Noone.

Running Code

Installed packages

To prepare the R environment with all necessary tools for spatial data analysis, data manipulation, and mapping.

# Install package and set working directory
if (!require("tmap")) install.packages("tmap", dependencies = TRUE)
Loading required package: tmap
Warning: package 'tmap' was built under R version 4.4.2
Breaking News: tmap 3.x is retiring. Please test v4, e.g. with
remotes::install_github('r-tmap/tmap')
if (!require("sf")) install.packages("sf", dependencies = TRUE)
Loading required package: sf
Linking to GEOS 3.12.1, GDAL 3.8.4, PROJ 9.3.1; sf_use_s2() is TRUE
if (!require("dplyr")) install.packages("dplyr", dependencies = TRUE)
Loading required package: dplyr
Warning: package 'dplyr' was built under R version 4.4.2

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
#
library(tmap)
library(sf)
library(dplyr)
library(RColorBrewer)
library(sp)
library(tidyverse) 
Warning: package 'tidyverse' was built under R version 4.4.2
Warning: package 'tidyr' was built under R version 4.4.2
Warning: package 'readr' was built under R version 4.4.2
Warning: package 'lubridate' was built under R version 4.4.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats   1.0.0     ✔ readr     2.1.5
✔ ggplot2   3.5.1     ✔ stringr   1.5.1
✔ lubridate 1.9.3     ✔ tibble    3.2.1
✔ purrr     1.0.2     ✔ tidyr     1.3.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

Set directory

Providing the default folder where R looks for files to read and where it saves output files

setwd("D:/Masters D info/GY672/Class Materials-20241106")

Load and explore data

The code is for loading and exploring the datasets to: Confirm successful data loading, understand the structure and content of the rain and stations objects, get a quick overview of the data’s beginning and end for validation.

load('rainfall.RData')

str(rain)
tibble [49,500 × 4] (S3: tbl_df/tbl/data.frame)
 $ Year    : num [1:49500] 1850 1851 1852 1853 1854 ...
 $ Month   : Factor w/ 12 levels "Jan","Feb","Mar",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ Rainfall: num [1:49500] 169 236 250 209 188 ...
 $ Station : Named chr [1:49500] "Ardara" "Ardara" "Ardara" "Ardara" ...
  ..- attr(*, "names")= chr [1:49500] "Ardara" "Ardara" "Ardara" "Ardara" ...
str(stations)
tibble [25 × 9] (S3: tbl_df/tbl/data.frame)
 $ Station     : chr [1:25] "Athboy" "Foulksmills" "Mullingar" "Portlaw" ...
 $ Elevation   : int [1:25] 87 71 112 8 131 49 14 45 15 62 ...
 $ Easting     : num [1:25] 270400 284100 241780 246600 319700 ...
 $ Northing    : num [1:25] 261700 118400 247765 115200 186000 ...
 $ Lat         : num [1:25] 53.6 52.3 53.5 52.3 52.9 ...
 $ Long        : num [1:25] -6.93 -6.77 -7.37 -7.31 -6.22 -8.1 -9.06 -8 -8.29 -6.64 ...
 $ County      : chr [1:25] "Meath" "Wexford" "Westmeath" "Waterford" ...
 $ Abbreviation: chr [1:25] "AB" "F" "M" "P" ...
 $ Source      : chr [1:25] "Met Eireann" "Met Eireann" "Met Eireann" "Met Eireann" ...
head(rain)
# A tibble: 6 × 4
   Year Month Rainfall Station
  <dbl> <fct>    <dbl> <chr>  
1  1850 Jan      169   Ardara 
2  1851 Jan      236.  Ardara 
3  1852 Jan      250.  Ardara 
4  1853 Jan      209.  Ardara 
5  1854 Jan      188.  Ardara 
6  1855 Jan       32.3 Ardara 
tail(rain)
# A tibble: 6 × 4
   Year Month Rainfall Station  
  <dbl> <fct>    <dbl> <chr>    
1  2009 Dec       99.9 Waterford
2  2010 Dec       70.2 Waterford
3  2011 Dec       80.7 Waterford
4  2012 Dec      114.  Waterford
5  2013 Dec      136.  Waterford
6  2014 Dec       28.7 Waterford

Calculating median rainfall for January

The code calculates the median rainfall for each weather station in January. This is useful for summarizing large datasets to avoid the influence of outliers.

january_medians <- rain %>%
  filter(Month == 'Jan') %>%
  group_by(Station) %>%
  summarize(median_rainfall = median(Rainfall, na.rm = TRUE))

Adding the stations to the median rainfall for January

The code combines spatial information about weather stations with their corresponding median January rainfall data:To create a unified dataset that links weather station details with their median January rainfall values.

stations_medians <- stations %>%
  left_join(january_medians, by = "Station")

Code used to create the map 

This code creates an interactive map that visualizes the median January rainfall for weather stations. Weather stations are represented as bubbles, with size and color indicating median January rainfall. You can zoom and pan to explore the spatial distribution of rainfall across regions.

stations_sf <- stations_medians %>%
  st_as_sf(coords = c('Long', 'Lat'), crs = 4326)

tmap_mode("view")
tmap mode set to interactive viewing
tm_shape(stations_sf) +
  tm_bubbles(size = 0.8, col = "median_rainfall",
             palette = "Reds",
             title.col = "Median January Rainfall (mm)") +
  tm_basemap("OpenStreetMap")

Discussions of patterns

Observation on extreme values show Killarney (177.7 mm) records the highest median rainfall and Dublin Airport (63.0 mm) records the lowest rainfall. Dublin Airport location on the eastern seaboard and relative shelter from Atlantic systems may have contributed to this.

Context on regional disparities show, The west and southwest experience high rainfall probably due to their exposure to Atlantic weather systems and topographical influences and the east and midlands are drier because they lie further from the Atlantic.

An observation on geographical locations show west of Ireland (e.g., Valentia: 166.0 mm, Ardara: 171.6 mm, Killarney: 177.7 mm) recording the highest median rainfall. This appears to be consistent with the influence of the Atlantic Ocean, which brings moist air and frequent rain to the western regions. Stations in the east (e.g., Dublin Airport: 63.0 mm, Phoenix Park: 67.6 mm, Armagh: 75.0 mm) record much lower rainfall. Stations in central Ireland (e.g., Mullingar: 80.6 mm, Birr: 77.5 mm) also have relatively low rainfall compared to coastal areas, likely due to their distance from the Atlantic.

It’s also interesting to note that, stations in urban centers record some of the lowest rainfall for instance Dublin Airport (63.0 mm) and Phoenix Park(67.6 mm), compared to Rural locations like Killarney(177.7 mm) and Valentia (166.0 mm) generally have higher rainfall, likely due to their proximity to natural features like forests, which promote precipitation.

Seasonal context indicate that, January is a typically wet month in Ireland due to the dominance of Atlantic depressions. The data reflects this, but it also highlights that local geography and position relative to the prevailing winds significantly influence rainfall patterns.

Conclusion

The patterns in the data vividly show wetter conditions in the west, drier in the east, with coastal areas receiving more rainfall than inland regions. This align with Ireland’s climatic characteristics. Notably, this variability underscores the importance of geographical factors like proximity to the Atlantic, topography, and urbanization in shaping rainfall distribution.