In this project I focused on analyzing rainfall data for January in Ireland, emphasizing spatial distribution patterns through an interactive map. Rainfall, a fundamental element of Ireland’s climate, plays a significant role in agriculture, water management, and climate monitoring. Leveraging rainfall data from weather stations across Ireland, In this project I visualizes rainfall intensity and categorizes it into distinct intervals for enhanced understanding. By using an interactive map, users can explore trends, identifying regions with higher or lower precipitation and relating these trends to geographic features like elevation.
This analysis integrates two datasets:
station data and rainfall data
I combined the dataset to present a comprehensive view of rainfall distribution in Ireland.
1. Station Data
The station dataset provides metadata about weather stations:
Station: Name of the weather station.
Latitude (Lat) and Longitude (Long): Geographic coordinates for mapping station locations.
Elevation: Height above sea level, enabling analysis of altitude’s impact on rainfall.
2. Rainfall Data
This dataset records:
Station: Corresponding station names.
Rainfall: Total rainfall in millimeters for January.
Rainfall Variability:
Identify regions with high rainfall (e.g., elevated areas) and those with less precipitation.
Geographic Patterns:
Observe clustering of rainfall intensities in coastal or inland areas.
Elevation Influence:
Understand how altitude affects rainfall, often leading to increased precipitation in higher regions.
# Inspect loaded objects
loaded_objects <- ls()
print(loaded_objects)
## [1] "rain" "stations"
# Check the structure of the datasets
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" ...
Data Cleaning and Merging
Cleaning Steps
Ensure station names match exactly in both datasets by removing extra spaces:
## stations$Station <- trimws(stations$Station)
## rain$Station <- trimws(rain$Station)
Combine stations and rain datasets by the Station column:
## merged_data <- stations %>%
## inner_join(rain, by = "Station")
Display the first few rows to verify the merge:
## head(merged_data)
In This process integrates the data, ensuring it is clean, accurate, and ready for further analysis, such as mapping and visualization.
# Clean column names
stations$Station <- trimws(stations$Station)
rain$Station <- trimws(rain$Station)
# Merge datasets on the 'Station' column
merged_data <- stations %>%
inner_join(rain, by = "Station")
# Preview the merged dataset
head(merged_data)
## # A tibble: 6 Ă— 12
## 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 Eireann
## 2 Athboy 87 270400 261700 53.6 -6.93 Meath AB Met Eireann
## 3 Athboy 87 270400 261700 53.6 -6.93 Meath AB Met Eireann
## 4 Athboy 87 270400 261700 53.6 -6.93 Meath AB Met Eireann
## 5 Athboy 87 270400 261700 53.6 -6.93 Meath AB Met Eireann
## 6 Athboy 87 270400 261700 53.6 -6.93 Meath AB Met Eireann
## # ℹ 3 more variables: Year <dbl>, Month <fct>, Rainfall <dbl>
Coastal regions, especially along the western seaboard, experience higher rainfall due to moist Atlantic air. Westerly winds play a significant role in transporting moisture.
Elevated regions, such as mountains, often record higher rainfall due to the orographic effect, where air cools and condenses as it rises over terrain.
Eastern and midland regions typically receive less rainfall, partly due to mountains blocking moist air.
High rainfall clusters are observed in areas with steep elevation changes, while flatter regions exhibit lower values.
# Define a vibrant color palette
pal <- colorNumeric(palette = "Spectral", domain = merged_data$Rainfall)
# Generate the interactive map
rainfall_map <- leaflet(data = merged_data) %>%
addTiles() %>% # Add base map tiles
addCircleMarkers(
~Long, ~Lat, # Longitude and Latitude
radius = 8, # Set a fixed radius for markers
color = ~pal(Rainfall), # Apply color based on rainfall intensity
popup = ~paste( # Add interactive popups
"<strong>Station:</strong>", Station,
"<br><strong>Rainfall:</strong>", Rainfall, "mm",
"<br><strong>Elevation:</strong>", Elevation, "m"
),
stroke = TRUE, # Add borders to markers
weight = 1, # Set border thickness
fillOpacity = 0.9 # Adjust marker transparency
) %>%
addLegend(
"bottomright", # Position the legend
pal = pal, # Use the defined color palette
values = ~Rainfall, # Scale legend by rainfall values
title = "Rainfall (mm)" # Add legend title
) %>%
addScaleBar(
position = "bottomleft", # Position the scale bar
options = scaleBarOptions(metric = TRUE) # Use metric units
)
# Display the map
rainfall_map
The interactive map visualizes rainfall distribution across Ireland in January, offering an engaging and intuitive exploration of precipitation patterns. Each weather station is represented by a circle marker, providing detailed information when clicked, such as the station name, rainfall amount (in millimeters), and elevation above sea level. The rainfall intensity is color-coded using a vibrant gradient, making it easy to identify regions with higher or lower precipitation levels at a glance. A legend is included to explain the color scale, ensuring clarity for users, while a scale bar adds spatial context, helping users gauge distances between locations. This map effectively highlights how geographic features, such as elevation and proximity to the coast, influence rainfall patterns. It serves as a valuable tool for researchers, policymakers, and planners in fields like water management, agriculture, and climate analysis.
This analysis effectively visualizes rainfall distribution in Ireland during January. By combining rainfall measurements with geographic attributes, the interactive map highlights the influence of coastal proximity and elevation on precipitation patterns. Insights include:
Coastal and elevated regions consistently record higher rainfall.
Lowland and inland areas experience comparatively lower precipitation.
The interactive map provides an intuitive way to explore these trends, aiding in applications like water resource management, flood risk analysis, and agricultural planning.
Future improvements could involve:
Incorporating seasonal or multi-year data for trend analysis.
Adding other climatic variables (e.g., temperature, wind) for a holistic view.
This project demonstrates the utility of geospatial visualization in understanding and communicating complex environmental data effectively.