setwd("C:/GIS517")
Project goal:
I am interested in using historic aerial imagery to identify
potential vernal pools in the Talladega National Forest. I downloaded
daily precipitation data from NOAA to determine what the wettest
leaf-off month was between 2005 and 2019. Ideally, using this
information will increase the likelihood of choosing imagery where
seasonal wetlands are present.
Library the necessary packages.
suppressPackageStartupMessages(library(knitr))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(ggplot2))
suppressPackageStartupMessages(library(tidyr))
suppressPackageStartupMessages(library(lubridate))
Import the precipitation data.
This is 15 years of precipitation data sourced from NOAA. Station
USC00013775 is located within the Talladega National Forest.
prcp <- read.csv("C:/GIS517/Final Project/tall_prcp.csv", header = TRUE)
Save the table as a data frame using as.data.frame().
prcp1 = as.data.frame(prcp)
Data Manipulation
Omit NA values that could interfere with analysis.
prcp1 <- na.omit(prcp1)
Since I am only interested in precipitation that occured during
leaf-off months (November - March), I need to subset months of interest
and save them to a new data frame. A subset of the data frame is made
with the filter() function and saved as a new variable. Next, I need to
convert daily precipitation values into monthy sums for each year. This
is achieved by grouping the values first by year, then by month. Once
grouped with group_by(), monthly sums area calculated with summarise().
Piping operators can be used to simplify the code chunk because all the
functions used are from dplyr.
sums <- as.data.frame(prcp1 %>%
filter(MONTH == 1:3| MONTH == 11 | MONTH == 12) %>%
group_by(YEAR, MONTH) %>%
summarize(sum = sum(PRCP)))
## Warning in MONTH == 1:3: longer object length is not a multiple of shorter
## object length
## `summarise()` has grouped output by 'YEAR'. You can override using the
## `.groups` argument.
To create more readable plots, I want to make a new colum to serve
as my x-axis. Currently, date data is saved as integers in three
seperate columns. Leaf-off months will be my x-axis. However, I dont
want month integers as the axis ticks. I would rather have the axis
display character abbreviations for each month. I create a new column
using mutate() that is called, ‘MONTH2’. In ‘MONTH2’, integers from
‘MONTH’ are assigned three letter abbreviations for their corresponding
month names. Abbreviations are assigned with month.abb[].
sums <- sums %>%
mutate(MONTH2 = month.abb[MONTH])
Plot the data.
Bar charts are made for each year using geom_bar() from
ggplot2. Each chart plots precitation (cm) on the
y-axis and leaf-off months on the x-axis.
pbars <- ggplot(sums, aes(x = MONTH2, y = sum)) +
geom_bar(stat='identity', fill = "deepskyblue1") +
facet_grid(~ YEAR) +
ggtitle("Monthly Precipitation Sums in the Talladega National Forest (2005-2014)") +
xlab("Month (Leaf-Off)") +
ylab("Total Precipitation (cm)") +
theme(axis.text.x = element_text(size=8, angle=45))+
scale_x_discrete(limits = c("Jan", "Feb", "Mar", "Nov", "Dec"))
pbars

Conclusions:
Unfortunately, this data had a substantial amount of NULL values.
This resulted in a substantially smaller dataset than I originally
wanted to use for this analysis. However, from the data that remained
after na.omit(), I can determine that December of 2009 was the wettest
leaf-off month. This would be a good date range to source historic
imagery for. This project is easily repeatable with similar data, so I
plan to source more complete data and re-run a similar analysis to try
and find a more current date range.