Exploring Patterns · Lesson 5 of 5
Spatial Patterns
~15 min
The Concept
One final view of the Bluewater Basin data before any formal modelling: plot every well's average nitrate as a dot on the basin map, sized and coloured by concentration. The pattern is immediate and stark: the four highest-nitrate wells all sit within 500 metres of the agricultural zone's eastern boundary, downslope from the main fertilised fields. Two of the lowest-nitrate wells sit in the wetland buffer, immediately downstream from the same zone.
No statistical model told you this. No correlation coefficient showed it. A map did. And now you know exactly where to focus the regression analysis in Mission 06.
Spatial patterns are patterns in how measurements vary across geography rather than across time. Environmental processes almost always have spatial structure: pollution sources are localised, geology drives groundwater chemistry zone by zone, land cover transitions create gradients in runoff.
Visualising data spatially, plotting measurements on a map rather than a chart, is one of the most powerful exploratory tools in environmental science. It connects abstract numbers to the physical processes that generate them, and it can reveal structure that time-series and correlation analysis completely misses.
The Analogy
It is like the famous story of a doctor in London who marked every cholera case on a street map during an outbreak, and saw the cases cluster tightly around one water pump. A list of addresses and case counts would never have shown that. The map made the invisible pattern impossible to miss.
Try It
Explore Bluewater Basin's nitrate measurements mapped spatially, select a variable and see how concentrations distribute across the watershed.
Hover any well to see its reading. Notice how nitrate concentrations are highest near the agricultural zone (northeast), while dissolved oxygen is lowest there — a classic signature of nutrient contamination.
Code (optional)
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
# Load well locations and their average nitrate
wells = gpd.read_file("bluewater_wells.geojson")
nitrate_avg = pd.read_csv("nitrate_well_averages.csv")
wells = wells.merge(nitrate_avg, on="sensor_id")
# Load basin boundary and land cover for context
basin = gpd.read_file("bluewater_boundary.geojson")
landcover = gpd.read_file("bluewater_landcover.geojson")
fig, ax = plt.subplots(figsize=(10, 8))
landcover.plot(ax=ax, column="land_type", alpha=0.4, legend=True)
basin.boundary.plot(ax=ax, color="#1D6E73", linewidth=1.5)
# Bubble plot: location, size, and colour all encode nitrate
wells.plot(
ax=ax,
column="nitrate_avg_mgL",
markersize=wells["nitrate_avg_mgL"] * 3,
cmap="YlOrRd",
legend=True,
legend_kwds={"label": "Mean nitrate (mg/L)"},
)
ax.set_title("Mean nitrate by well, Bluewater Basin")
plt.savefig("spatial_nitrate_eda.png", dpi=150)Line by line
- We use geopandas, which handles spatial data the same way pandas handles tabular data, to merge well locations with their computed nitrate averages.
- Plotting land cover as a base layer provides the visual context for where agricultural zones, wetlands, and forests sit.
- wells.plot with both column (colour) and markersize (size) encoding nitrate creates a bubble map, two visual channels for the same variable reinforces high-value locations.
- This plot goes into the EDA section of the eventual paper, before any modelling results appear.
Why Real Researchers Care
Spatial EDA is the foundation of the geostatistical analysis in Mission 08. The spatial patterns you identify here, clusters of high values, gradients, barriers, directly inform variogram modelling and kriging in later missions. Real geostatisticians always look at the spatial distribution of data before fitting any model.
Quick Check
Q1. You find that the four highest-nitrate wells cluster near the agricultural zone's eastern boundary. What does this spatial pattern suggest?
Your Goal
Based on what you've found in this mission's EDA, distributions, time series, correlations, and spatial patterns, write a one-paragraph summary of what Bluewater Basin's nitrate data is telling you before any formal statistical testing. What do you now believe, and what do you still need to confirm?
Hint: Reference the spring seasonal peak, the long-term trend, the correlation with rainfall, and the spatial clustering near the agricultural zone.
Teach It Back
Explain why spatial EDA is a separate, essential step from time-series and correlation EDA, what kind of pattern would the latter two completely miss?