library(dplyr)
library(sf)
library(leaflet)
library(viridisLite)
#1) Load The Rainfall Data
load("rainfall.RData")
#2)Median January Rainfall For Each Station
jan_medians<- rain|>
filter(Month=="Jan")|>
group_by(Station)|>
summarise(median_jan_mm= median(Rainfall, na.rm= TRUE), .groups="drop")
#3) Load Station Points And Convert To WGS84 For leaflet
stations <- st_read("weather_stations.geojson", quiet = TRUE) |>
st_transform(4326)
#4) As GeoJSON Contains Repeats, Ensure Only One Point Is Kept Per Station
stations_unique <- stations |>
distinct(Station, .keep_all = TRUE)
#5) Join Medians Onto The Station Locations
stations_map <- inner_join(stations_unique, jan_medians, by = "Station")
#6) Colour Scale
pal<- colorNumeric(palette=viridis(256), domain = stations_map$median_jan_mm)
#7 Interactive Map
leaflet(stations_map) |> addProviderTiles("CartoDB.Positron") |> addCircleMarkers(radius=6, stroke=TRUE, weight=1, color="#222222", fillColor=~pal(median_jan_mm), fillOpacity=0.9, popup=~paste0("<b>",Station,"</b><br/>","Median January rainfall: ",round(median_jan_mm,1)," mm")) |> addLegend(position="bottomright", pal=pal, values=~median_jan_mm, title="Median January rainfall (mm)", opacity=1)The Median January Rainfall In Ireland (1850-2014)
Introduction
The aim of this blog is to examine the variation in January rainfall across Ireland with data collected from 25 weather stations.
These stations were colour coded according to the median January rainfall and displayed on an interactive map to allow for inspection of the stations name and specific median value.
Median was chosen to represent the data as mean rainfall data values can become skewed by extreme events such as storms, therefore the median allowed for a more accurate representation of January conditions.
Data
This analysis is comprised of two files:
Dataset 1 -‘rainfall.RData’which is comprised of historical monthly rainfall values covering 1850-2014. Included in each record is the year, month, rainfall total (mm) and the station name where each value was recorded. For this analysis, only the January observations were used and themedian rainfall was calculated for each station, representing typical conditions. Dataset 2 -’weather_stations.geojson’ contains the geographic locations of each station. These stations are stored as a point feature with name and coordinate attributes. The data is originally provided in Irish Grid (TM65) coordinate system and was transfromed to WGS84 to be displayed correctly using Leaflet.
These datasets were linked using the staton name identifier as this GeoJson file contains repeating rows, just one geometry is retained for each weather station before being joined. The result is a dataset with 25 weather stations with an accurate location and median January rainfall value which is visible on the interactive map.
Code & Interactive Map
Discussion
The Interactive map showcases the observable variation in median January rainfal across the weather stations. Those stations located in the west and southwest recorded higher median rainfall than stations in the east and southeast. This disparity between east and west is a well recognised pattern of Ireland’s climate and can be clearly observed with the relatively small network of stations.
The increased rainfall values in the west of Ireland can be explained as a result of prevailing Atlantic weather systems, as they bring moist air and frontal rainfall during winter months in particular. The Easterly stations are protected from these systems and thus experience lower rainfall values.
Each stations elevation and proximity to the coast appear to have had an effect on rainfall patterns,unsurprisingly the weather stations located in the midlands have lower values than those located on the coast. However, when observing the cluster of weather stations on the southeast of the island, weather stations which are further inland have recorded higher rainfall values than neighbouring stations which are closer to the coast, for example Roches Point and Cork Airport.
As median rather than mean was chosen to represent the January rainfall data, the influence of unusually dry or wet years is minimized, reflecting more accurate January conditions at each weather station. However, this analysis is only comprised of data from 25 weather stations, limiting this blog from capturing finer-scale spatial variability and potential local extremes. With this limitation, the interactive map still provides a clear view of broad historical rainfall patterns across Ireland during the month of January.