Background
Wetlands are incredibly valuable ecosystems that are under threat. Wetlands provide important ecosystem services such as nutrient and sediment retention, flood protection, groundwater recharge, and recreational opportunities (e.g. wildlife viewing, hunting, hiking). The United States has lost over 50% of its pre-colonization wetland resources, mostly through conversion to agriculture.
We know that wetland hydrology governs the biology, chemistry, and geomorphology of wetlands, thus hydrology is the key indicator to examine when we need to understand how wetlands are recovering from disturbance.
I am part of a collaborative project researching the recovery of wetlands. Our team of scientists studies the hydrology, water quality, and biological communities of wetlands restored from agricultural uses. We want to understand how well the wetlands are functioning after restoration and ,based on our research, we want to make recommendations for future restoration projects.
This is what a restored wetland looks like. This wetland was farmed about 10 years ago. Since then, the wetland has been allowed to flood from the nearby river and is now supporting a growing forest
Our study are is located in western Kentucky (A). We are studying 9 restored, 2 degraded, and 3 reference wetlands along three tributaries to the Mississippi River (B)
The project below walks through insights generated from ~1 million water-level measurements collected with HOBO data loggers deployed continuously for two years at 14 wetland sites.
Load libraries
library(tidyverse) #data wrangling
library(knitr) #formatting HTML document
library(lubridate) #working with dates
library(ggridges) #ridgeline plot
library(hrbrthemes) #theme ipsum
library(zoo) #calculate rolling average
library(plotly) #interactive plotLoad data set
HOBO <- read.csv("Data/HOBO.csv")kable(head(HOBO))| Site | Date | Temp | Depth |
|---|---|---|---|
| 1 | 8/29/2018 | 26.585 | 1.188924 |
| 1 | 8/29/2018 | 26.683 | 1.187910 |
| 1 | 8/29/2018 | 26.781 | 1.187099 |
| 1 | 8/29/2018 | 26.879 | 1.186597 |
| 1 | 8/29/2018 | 26.879 | 1.187620 |
| 1 | 8/29/2018 | 26.977 | 1.187731 |
There are 914194 rows of data
Clean data set
Convert all values that are less than 5 cm to 0. These extremely low measurements, including negative values, were taken when the wetlands were dry and the HOBOs were exposed to air.
HOBO[HOBO<0.05]<-0Convert date to date format that will be readable by ggplot2
HOBO$Date<-mdy(HOBO$Date)Extract “Month”, “Day”, and Year" for plotting purposes
HOBO$Month<-month(HOBO$Date, label=TRUE)
HOBO$Day<-day(HOBO$Date)
HOBO$Year<-year(HOBO$Date)Round the depth and temperature measurements
HOBO$Depth<-round(HOBO$Depth, digits=2)
HOBO$Temp<-round(HOBO$Temp, digits=1)
kable(head(HOBO))| Site | Date | Temp | Depth | Month | Day | Year |
|---|---|---|---|---|---|---|
| 1 | 2018-08-29 | 26.6 | 1.19 | Aug | 29 | 2018 |
| 1 | 2018-08-29 | 26.7 | 1.19 | Aug | 29 | 2018 |
| 1 | 2018-08-29 | 26.8 | 1.19 | Aug | 29 | 2018 |
| 1 | 2018-08-29 | 26.9 | 1.19 | Aug | 29 | 2018 |
| 1 | 2018-08-29 | 26.9 | 1.19 | Aug | 29 | 2018 |
| 1 | 2018-08-29 | 27.0 | 1.19 | Aug | 29 | 2018 |
Summarize data
site_summary<-HOBO %>%
group_by(Site) %>%
summarize(N = n(),
MeanD=mean(Depth, na.rm=TRUE),
MaxD=max(Depth, na.rm=TRUE),
MinD=min(Depth, na.rm=TRUE),
StartDate=min(Date),
EndDate=max(Date))
kable(site_summary)| Site | N | MeanD | MaxD | MinD | StartDate | EndDate |
|---|---|---|---|---|---|---|
| 1 | 69267 | 1.0284359 | 2.01 | 0.33 | 2018-08-29 | 2020-08-27 |
| 2 | 73631 | 0.3261868 | 1.24 | 0.00 | 2018-08-29 | 2020-10-07 |
| 3 | 73346 | 2.3342509 | 7.17 | 0.00 | 2018-08-29 | 2020-10-07 |
| 4 | 73824 | 1.3585992 | 5.56 | 0.00 | 2018-08-29 | 2020-10-07 |
| 5 | 55845 | 0.7011100 | 1.04 | 0.52 | 2019-03-05 | 2020-10-07 |
| 6 | 73882 | 0.8703874 | 3.40 | 0.00 | 2018-08-29 | 2020-10-07 |
| 7 | 50210 | 0.2200466 | 1.61 | 0.00 | 2018-08-29 | 2020-10-07 |
| 8 | 73899 | 0.6302184 | 3.65 | 0.22 | 2018-08-29 | 2020-10-07 |
| 9 | 67492 | 0.4376857 | 1.38 | 0.00 | 2018-09-12 | 2020-10-09 |
| 10 | 68131 | 0.6897538 | 1.62 | 0.26 | 2018-09-12 | 2020-10-09 |
| 11 | 72768 | 0.2547476 | 1.75 | 0.00 | 2018-09-12 | 2020-10-09 |
| 12 | 72753 | 0.4483590 | 2.34 | 0.15 | 2018-09-12 | 2020-10-09 |
| 13 | 69959 | 0.3170816 | 1.99 | 0.00 | 2018-10-11 | 2020-10-09 |
| 14 | 19187 | 0.5674879 | 1.41 | 0.13 | 2020-03-23 | 2020-10-09 |
When looking at MaxD, it is becoming obvious that two wetlands achieve really deep maximum depths, upwards of 5 meters.
Plot
I wanted to see what the water fluctuations look like at just one wetland site over time. I also made this graph interactive so that I can hover my mouse over it and see the depth changes
sample_plot<-filter(HOBO, Site=="7") %>%
ggplot(aes(x=Date, y=Depth)) +
geom_line(color = "#175f72") +
scale_y_continuous(limits = c(0, NA),
expand = expansion(mult = c(0, 0.1))) +
theme_classic() +
scale_x_date(date_breaks="1 month", date_labels="%b %Y") +
theme(axis.text.x = element_text(angle=45, hjust = 1)) +
ylab("Depth (cm)")
ggplotly(sample_plot)The hydrograph is showing the expected, seasonal wetting and drying cycle. Wetlands are wettest in the winter months and dry in the fall.
I want to visualize all 14 sites together on one graph so that I can compare their seasonal changes. First, I order the sites based on the heights of the hydrographs so that they do not overlap each other on the graph
HOBO$Site <- factor(HOBO$Site ,
levels=c("9", "11", "12", "5", "2",
"10", "14", "13", "7", "1",
"6", "8", "4", "3"))Then I plot all of the sites on a ridgeline plot
filter(HOBO, !is.na(Depth)) %>%
ggplot(aes(y=Site, x=Date, height=Depth, fill=Site)) +
geom_ridgeline(alpha=0.4) +
scale_color_brewer(palette="Spectral") +
scale_x_date(date_breaks="1 month", date_labels="%b %Y") +
theme_ipsum() +
theme_ridges(grid = FALSE) +
theme(legend.position="none",
axis.text.x = element_text(angle=45, hjust = 1),
axis.text.y = element_blank(),
axis.title = element_text(size=12),
axis.title.y = element_blank())All of the wetlands are exhibiting the same wetting and drying cycle, although some are more pronounced than others.
The daily fluctuations are making it difficult to view and interpret the hydrographs. I will calculate a rolling average of the depths and see if that makes the graph easier to read
HOBO<-HOBO %>%
group_by(Site) %>%
mutate(Av999=rollmean(Depth, k=999, fill=NA)) %>%
ungroup()The rolling average, averages 1,000 measurements
filter(HOBO, !is.na(Depth)) %>%
ggplot(aes(y=Site, x=Date, height=Av999, fill=Site)) +
geom_ridgeline(alpha=0.4) +
scale_color_brewer(palette="Spectral") +
scale_x_date(date_breaks="1 month", date_labels="%b %Y") +
theme_ipsum() +
theme_ridges(grid = FALSE) +
theme(legend.position="none",
axis.text.x = element_text(angle=45, hjust = 1),
axis.text.y = element_blank(),
axis.title = element_text(size=12),
axis.title.y = element_blank()) The rolling average smooths out the hydrograph and makes it more obvious that the top two wetlands flood extremely deeply. After further analysis of or biological data (plants, fish, invertebrates, turtles, birds) we found distinct differences in biotic communities between the very deeply flooding wetlands (which were next to the Mississippi River) and all the other wetlands. The deeply flooding wetlands support biological communities that are specifically adapted to this type of seasonal hydrology.
A final, annotated plot, highlights the hydrologic differences that we observed
filter(HOBO, Date >=as.Date("2018-10-01") & Date <= as.Date("2020-10-01")) %>%
ggplot(aes(y=Site, x=Date, height=Av999, fill=Site)) +
geom_ridgeline(alpha=0.4) +
scale_fill_manual(values = c("#c5c5c5", "#c5c5c5", "#c5c5c5", "#c5c5c5","#c5c5c5", "#c5c5c5", "#c5c5c5","#c5c5c5","#c5c5c5", "#c5c5c5", "#c5c5c5", "#c5c5c5", "#e1599e" ,"#e1599e")) +
annotate(geom = "curve",
x=as.Date("2020-07-20"),
y = 20,
xend = as.Date("2020-04-15"),
yend = 18,
curvature = .3,
arrow = arrow(length = unit(2, "mm"))) +
annotate(geom="text",
label = "Close to\nMississippi River",
x=as.Date("2020-08-01"),
y=20,
size=3,
lineheight = 0.8,
hjust=0)+
scale_x_date(date_breaks="1 month", date_labels="%b %Y") +
theme_ipsum()+
theme_ridges(grid = FALSE) +
theme(legend.position="none",
axis.text.x = element_text(angle=45, hjust = 1),
axis.text.y = element_blank(),
axis.title = element_text(size=12),
axis.title.y = element_blank()) +
labs(title = "Water-level changes over 2 years in Kentucky floodplain wetlands",
subtitle = "Wetlands close to the Mississippi River experience deep flooding\nand have a different wildlife community")Based on our research, we recommend that restoration practitioners incorporate the clear differences between wetlands close to the Mississippi River and wetlands farther inland, into their restoration plans. Deeply flooding wetlands are healthy and diverse, but their function and structure cannot be compared to inland wetlands.