Data taken from NOAA site for Boston Harbor: https://tidesandcurrents.noaa.gov/sltrends/sltrends_station.shtml?stnid=8443970
setwd("\\\\psf/Home/Dropbox (Personal)")
get# Assemble data into one dataframe
## function (x, pos = -1L, envir = as.environment(pos), mode = "any",
## inherits = TRUE)
## .Internal(get(x, envir, mode, inherits))
## <bytecode: 0x0336075c>
## <environment: namespace:base>
options(stringsAsFactors=FALSE)
tides <- read.csv("\\\\psf/Home/Dropbox (Personal)/MysticDB/Rcode/Sandbox/Andy/Climate/Boston_meantrend.csv", strip.white=TRUE)
tides$Date <- mdy(tides$Date)
tides$Month_f <- factor(tides$Month, levels = c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
#Monthly averages by year, with line of best fit
g <- ggplot(tides, aes(Date, Monthly_MSL , ymin=0)) +
geom_smooth(method = 'lm', col = "red")
#g + geom_line() + geom_area() + facet_grid(parameter~Station, scales = "free_y")
g + geom_line()
setwd("\\\\psf/Home/Dropbox (Personal)")
# Assemble data into one dataframe
options(stringsAsFactors=FALSE)
tides <- read.csv("\\\\psf/Home/Dropbox (Personal)/MysticDB/Rcode/Sandbox/Andy/Climate/Boston_meantrend.csv", strip.white=TRUE)
tides$Month_f <- factor(tides$Month, levels = c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
#Monthly averages by year, with line of best fit
g <- ggplot(tides, aes(Year, Monthly_MSL , ymin=0)) +
geom_smooth(method = 'lm', col = "red", formula = y~x)
#g + geom_line() + geom_area() + facet_grid(parameter~Station, scales = "free_y")
g + geom_line() + geom_point() + facet_wrap( ~ Month_f) + theme_bw()
setwd("\\\\psf/Home/Dropbox (Personal)/")
# Assemble data into one dataframe
options(stringsAsFactors=FALSE)
tides_recent <- read.csv("\\\\psf/Home/Dropbox (Personal)/MysticDB/Rcode/Sandbox/Andy/Climate/Boston_meantrend.csv", strip.white=TRUE)%>%
filter(Year > 1969)
tides_recent$Month_f <- factor(tides_recent$Month, levels = c("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"))
# Monthly averages by month, with line of best fit
g <- ggplot(tides_recent, aes(Year, Monthly_MSL , ymin=0)) +
geom_smooth(method = 'lm', col = "red", formula = y~x)
g + geom_line() + geom_point() + facet_wrap( ~ Month_f)
## Variability by month
# load monthly data with linear trend removed
intannvar <- read.csv("\\\\psf/Home/Dropbox (Personal)/MysticDB/Rcode/Sandbox/Andy/Climate/Boston_intannvar.csv", strip.white=TRUE)
g <- ggplot(data = intannvar, aes(factor(Month), Interannual_Variation), group_by = Month)
g + geom_boxplot() + theme_bw()
# load monthly data with linear trend removed
minmax<- read.csv("\\\\psf/Home/Dropbox (Personal)/MysticDB/Rcode/Sandbox/Andy/Climate/BosHarMinMax.csv", strip.white=TRUE)
minmax$Max.Date <- ymd(minmax$Max.Date)
minmax$Min.Date <- ymd(minmax$Min.Date)
tides <- read.csv("/MysticDB/Rcode/Sandbox/Andy/Climate/Boston_meantrend.csv", strip.white=TRUE)
tides$Date <- mdy(tides$Date)
tides$Monthly_MSLft <- (tides$Monthly_MSL*3.28 + 8.73)
g <- ggplot(minmax, aes(Max.Date, Max.WL, ymin=0)) +
geom_smooth(method = 'lm', col = "red", formula = y~x)
#g + geom_line() + geom_area() + facet_grid(parameter~Station, scales = "free_y")
g + geom_line() + geom_line(data = tides, aes(x= Date, y= Monthly_MSLft)) +
geom_line(data=minmax, aes(Min.Date, Min.WL))
setwd("\\\\psf/Home/Dropbox (Personal)/")
minmax$high <- (ifelse(minmax$Max.WL >16, 1, 0))
# Monthly averages by month, with line of best fit
g <- ggplot(minmax, aes(Max.Date, Max.WL, color=high))
#geom_smooth(method = 'lm', col = "red", formula = y~x)
g + geom_point() + facet_wrap( ~ factor(Month))