\(Historical\) \(Spatial\) \(Analysis\) \(Mapping\) \(Median\) \(January\) \(Rainfall\) \(Across\) \(Ireland\) \((1850–2014)\)

\(Introduction:\) So here we are. It s January in Ireland and look out the window what do you see rain Usually it s just a wet foggy day but sometimes it s a real one I had to stop just complaining about the weather for my Geocomputation project, actually make a map about it My simple idea, take the middle rain fall for January from 25 stations across the country and make it look good on a map I wanted to see if the Wets Wet thing really is true when you look at the hard facts from 1850 all the way to 2014.

\(Data\) \(behind\) \(scenes\) \((the data):\) before I even think pretty colours or maps I had to do deal with the data I used data set called rainfall.RData this is a giant data set honestly it has thousands of row of monthly rainfall totals I didn ’ t need all of it all I cared about was January why January? well it’s usually the high point of the winter blues and the wettest start to the year I had to use R to talk to this data I filtered out any thing that was not January then I used a function to find the median I chose median instead of the average (mean) because rainfall in Ireland can be crazy one year you got a monster flood next year it is dry the median is better because it is not as tricked by those crazy storms that come once every ten years or so it gives you a more honest picture of what a normal January is like after I got those numbers I had to add them together with the actual location of the 25 stations the latitude and longitude of each one because if you don ’ t do this right your map puts a weather station in the middle of the ocean which it never does.

#Required Libraries
library(tidyverse)
library(leaflet)
library(sf)
library(ggplot2)

#Load the data
load("rainfall.RData")

\(How\) \(I\) \(did\) \(the\) \(map\) \((The Code bit):\) It was the most bad but best bit to do. I used library called leaflet. I didn not just want some boring picture; I wanted one you could zoom in on and click on.

First I had to choose a colour scheme. i was with rdylbu red, yellow and blue. In my head blue was water (rain) and red was dryer (well dry Ireland). I reversed the colours so the wettest places like Killarney are in dark blue.

I added some little bits to make it look more like a real mapmaker. I put a 250m black hollow buffer round each station. It is a little thing. But it makes the points sharp. I also got the north arrow and the bar for the scale bar to work without having to use another link in case the internet went down in the time of showing the map. I even put my name and student id on the map so there can be no question as to who made it.

# To create new summary table for January Rainfall
jan_rainfall <- rain %>% 
  filter(Month == "Jan") %>% 
  group_by(Station) %>% 
  summarise(Median_Jan = median(Rainfall))

# This code joins the rainfall math with the station locations (Lat/Long)
stations_with_data <- stations %>% 
  left_join(jan_rainfall, by = "Station")

# Sample outcome
head(stations_with_data)
## # A tibble: 6 × 10
##   Station     Elevation Easting Northing   Lat  Long County  Abbreviation Source
##   <chr>           <int>   <dbl>    <dbl> <dbl> <dbl> <chr>   <chr>        <chr> 
## 1 Athboy             87  270400   261700  53.6 -6.93 Meath   AB           Met E…
## 2 Foulksmills        71  284100   118400  52.3 -6.77 Wexford F            Met E…
## 3 Mullingar         112  241780   247765  53.5 -7.37 Westme… M            Met E…
## 4 Portlaw             8  246600   115200  52.3 -7.31 Waterf… P            Met E…
## 5 Rathdrum          131  319700   186000  52.9 -6.22 Wicklow RD           Met E…
## 6 Strokestown        49  194500   279100  53.8 -8.1  Roscom… S            Met E…
## # ℹ 1 more variable: Median_Jan <dbl>
# Setting colors to the map
pal <- colorNumeric(palette = "RdYlBu", domain = stations_with_data$Median_Jan, reverse = TRUE)

# Building the Leaflet Map
leaflet(data = stations_with_data) %>% 
  addProviderTiles(providers$CartoDB.Positron) %>%
  
# Hollow 250m Buffers
  addCircles(lng = ~Long, lat = ~Lat, radius = 250, 
             color = "black", weight = 1.5, fill = FALSE, group = "250m Buffers") %>%

  # Station Markers (The colored centers)
  addCircleMarkers(
    lng = ~Long, lat = ~Lat,
    fillColor = ~pal(Median_Jan), color = "black", weight = 1, radius = 10, fillOpacity = 0.9,
    popup = ~paste0("<b>Station: </b>", Station, 
                   "<br><b>Median Jan Rainfall: </b>", Median_Jan, " mm"),
    group = "Stations"
  ) %>%
  
  # Add Scale Bar
  addScaleBar(position = "bottomleft") %>%
  
  # Add North Arrow
  addControl(html = "<div style='font-size:25px; color:black; font-weight:bold; text-align:center;'>
                      <span style='display:block; line-height:0.8;'>N</span>
                      <span style='display:block; font-size:30px; margin-top:-5px;'>&#8593;</span>
                    </div>", 
             position = "topright") %>%
  
  # Add Map Title and Credentials
  addControl(html = "<b>Ireland Median Jan Rainfall (1850-2014)</b><br>Authored by: Keerthika Kaliyan (Id: 25250253)", 
             position = "topleft") %>%
  
  # Add Legend
  addLegend("bottomright", pal = pal, values = ~Median_Jan,
            title = "Jan Median Rainfall", labFormat = labelFormat(suffix = " mm"), opacity = 1)

\(What\) \(do\) \(the\) \(numbers\) \(really\) \(say?\) When I put the map togeter and it popped on my screen, it was plain as day. The West coast is geting beat up by the East.

Check the markers all round the Atlantic side, like Galway or the stations down in Kerry, they glow that dark blue. Some of them are getting 150mm or more of rain in the middle. Now look at Dublin Airport on the East coast, it’s much lighter, almost a red, not far off yellow. That’s a big gap.

I also made a bar chart to sort them out, just to be sure. Viewing the stations sequentially from Wettest to Driest effectively emphasizes this point. The mountains in the West suck up all that moist air comng off the Atlantic. By the time the clouds get to Dublin, they are mostly done. That is how the rain works. It’s called orographic rain, but just mean the West gets the worst off in January.

# Create a ranking chart
ggplot(stations_with_data, aes(x = reorder(Station, Median_Jan), y = Median_Jan, fill = Median_Jan)) +
  geom_bar(stat = "identity", color = "black", size = 0.2) +
  coord_flip() + 
  scale_fill_distiller(palette = "RdYlBu", direction = 1) +
  theme_minimal() +
  labs(title = "Ranking of Irish Stations: January Median Rainfall (1850–2014)",
       subtitle = "Authored by: Keerthika Kaliyan (Id: 25250253)",
       x = "Weather Station", 
       y = "Median Rainfall (mm)",
       fill = "Rainfall")
## Warning in geom_bar(stat = "identity", color = "black", size = 0.2): Ignoring
## unknown parameters: `size`

\(Last\) \(Thoughts:\) This project was a tiny pain for me in the beginning, It was difficult for me to get the code to run without crashing or bugging out. But after I saw the final HTML blog with a map I could actually click and interact with was pretty cool to see. Something like saying it rains a lot in Ireland is one thing, but having 150 years of data showing you exactly where it rains in Dublin is another. It will make you wish the sun shone more on Dublin.