Recently Published

Document
Quantidade de trafos faturados de janeiro de 2024 até setembro de 2025 (20 meses) por Região no Brasil
isotrees_1_16
AQHI Report
Monthly, run around 15:30 on 1/16/26
Bank Selection into Emergency Lending Facilities: Extensive Margin Analysis
Final Models Extensive and Temporal Dynamics
Document
Rainfall Map of Irish Weather Stations Representing Median January Rainfall 1850-2014
This Blog highlights a interactive map of 25 weather stations across Ireland. This map displays median January rainfall levels from 1850-2014. Each weather station in the map displays the median January rainfall levels. Later in the blog I will discuss the trends found in these results. For the ease of interpretation, I have included a minimap and a legend. Packages I used to create this map were Leaflet, Dplyr, Tmap, rmarkdown, mapview and leafpop. Code used: Below I have listed the code used to create this map. Step 1: load('rainfall.RData') library(dplyr) rain %>% arrange(Year,Month) -> rain2 rain2 Step 2: This step allocates a filename for each weather station. library(leaflet) > library(mapview) > library(leafpop) > > stations %>% mutate(Filename=file.path(getwd(),paste0(Station,'.png'))) -> files > files %>% select(Station,Filename) Step 3: This step created the first map which I could then further embellish library(sf) library(tmap) st_read('counties.geojson',quiet=TRUE) %>% st_transform(4326) -> counties # leaflet objects must be long/lat (epsg 4326) tmap_mode('view') tm_start <- tm_shape(counties) + tm_borders() Step 4: adding further graphics to the map tmap_leaflet(tm_start) %>% addPolygons(data=counties, color = NA, popup = popupImage('test.png', embed = TRUE)) Step 5: Generating a monthplot for each station for (i in 1:nrow(files)) with(files, { png(Filename[i],width=400,height=300) local_monthplot(Station[i],rain2) dev.off()} ) Step 6: Making each month a popup files %>% mutate(Popup=paste0('<img src="',Filename,'">')) -> files files %>% select(Station,Popup) *I used the function View(files) to generate an excel spreadsheet so that I could verify the Stations were all present and correct. Step 7: Linking popups to station rain %>% group_by(Station) %>% summarise(mrain=mean(Rainfall)) %>% left_join(files) %>% select(Station,Long,Lat,mrain,Filename) %>% st_as_sf(coords=c('Long','Lat'),crs=4326) -> station_means station_means Step 8: Adding pop-ups to the map tmap_leaflet(tm_start) %>% addCircleMarkers(data=station_means, popup=popupImage( station_means$Filename, embed=TRUE)) Step 9: Further embellishment, adding month plots to each point on map. tm_start2 <- tm_shape(station_means) + tm_dots(col='mrain',popup.vars=FALSE,scale=1.5) tmap_leaflet(tm_start2) %>% addCircleMarkers(data=station_means, stroke = NA, popup=popupImage( station_means$Filename, embed=TRUE)) Step 10: Generating Final Map using leaflet and adding January median values. library(leaflet) > > final_map <- leaflet(station_means) %>% + addProviderTiles(providers$CartoDB.Positron) %>% + addCircleMarkers( + radius = 6, + stroke = FALSE, + fillOpacity = 0.8, + color = ~colorNumeric("viridis", jan_median)(jan_median), + popup = ~paste0( + "<strong>", Station, "</strong><br>", + "Median January rainfall: ", + round(jan_median, 1), + " mm" + ) + ) > > final_map Step 11: Adding Mini-Map ) %>% addLegend( pal = pal, values = ~jan_median, title = "Median January rainfall (mm)", opacity = 1 ) %>% addMiniMap(zoomLevelOffset = -3) Step 12: Adding a Legend ( %>% addLegend( pal = pal, values = ~jan_median, title = "Median January rainfall (mm)", opacity = 1 ) Data Used: To create this map I used multiple files. The first file I used was a geojson file named weather_stations.geojson. This included the longitude and Latitude of the 25 weather stations spanning 1850-2014. Each record includes spatial data such as county, coastal distance and elevation. this files includes 25 stations covering 165 years of data × 12 months. This file allowed me to plot he location of the weather stations on the map. The next file was a R file named rainfall.RData. This file contains rainfall data from 1850-2014 from each weather station. As the file is an R workspace file, it can only be used within the R environment. I also another file named counties.geojson. This file included the boundaries of counties in Ireland which allowed for plotting onto my map. I also used a variety of R packages such as Leaflet and Tmap. The final file named rain_jan80 was an excel file which contained 25 coastal and rainfall values. This file helped to populate my legend and show median January rainfall values in popups. Analysis of Results: This map includes a legend with lighter blues representing less median January rainfall, and darker blues representing higher levels of rainfall. A noticeable trend in this map is that coastal weather stations have significantly higher january median rainfall values. Weather stations in Kerry have seen some of the highest January rainfall in the country with Killarney's median January rainfall reaching 177.7 mm. This is likely a result of exposure to coastal rainfall and the effect of the prevailing southwesterly winds carrying high amounts of water vapour. As expected weather stations in the midlands in counties such as Offaly and Westmeath experience significantly less rainfall with levels falling on the lower end of the 60 - 99 mm per year category. Weather stations in the South-East experience moderate levels of rainfall generally placing within the lower end of the 120-140 mm per year category. The Lowest rainfall is found at the weather station in Dublin Airport at 63mm.