Main Lake results alone, August 28-31, 2015
g <- ggplot(UPL2, aes(Datetime, ResultValue))
g + geom_line() + facet_wrap( ~ CharacteristicID, ncol= 2, scale = "free_y") +theme_bw() + theme(axis.text.x = element_text(angle = 45, hjust = 1))
library(dplyr)
library(ggplot2)
library(reshape2)
library(lubridate)
library(tidyr)
library(ggmap)
library(RODBC)
setwd("\\\\psf/Home/Dropbox/")
#setwd("c:/Users/Katrina/Dropbox/")
# GET UPL_D0_1 data
# User: fill in location, date(s), file names; report will get relevant data
DeployID = "20150828"
VerticalSurveyID = "20150828"
#load Deployment table exported from Access
UPL1 <- read.csv(
"MysticDB/Conversion/sonde/testing_20150828/Deployment_export_test.csv",
strip.white=TRUE, header = TRUE, as.is=TRUE)
# parse date and specify time zone
UPL1 <- UPL1 %>%
mutate(Datetime = mdy_hm(Datetime, tz="UTC")) %>%
mutate(Datetime = with_tz(Datetime, tzone="US/Eastern"))
#filter for desired parameters
UPL2 <- UPL1 %>%
filter(DeploymentID == DeployID) %>%
filter(CharacteristicID == "DO" | CharacteristicID == "DO_SAT" |
CharacteristicID == "CHLA" | CharacteristicID == "SPCOND" |
CharacteristicID == "TEMP_WATER" | CharacteristicID == "DEPTH")
#load Surveys table of vertical profiles exported from Access
profUPL <- read.csv(
"MysticDB/Conversion/sonde/testing_20150828/Survey_export_test.csv",
strip.white=TRUE, header = TRUE, as.is=TRUE)
# parse date and filter for id
profUPL2 <- profUPL %>%
filter(SurveyID == VerticalSurveyID) %>%
mutate(Datetime = mdy_hms(Datetime, tz="UTC")) %>% #need time to the sec to uniquely id
mutate(Datetime = with_tz(Datetime, tzone="US/Eastern"))
profUPL2 <- unique( profUPL2[ , 1:8 ]) #handheld creates duplicate records; remove
#GET UPLUPL forebay data
DeployID2 = "20150807"
VerticalSurveyID2 = "20150807"
#load Deployment table exported from Access
forebay1 <- read.csv(
"MysticDB/Conversion/sonde/testing_20150828/Deployment_export_test.csv",
strip.white=TRUE, header = TRUE, as.is=TRUE)
# parse date and specify time zone
forebay1 <- forebay1 %>%
mutate(Datetime = mdy_hm(Datetime, tz="UTC")) %>%
mutate(Datetime = with_tz(Datetime, tzone="US/Eastern"))
#filter for desired parameters
forebay2 <- forebay1 %>%
filter(DeploymentID == DeployID2) %>%
filter(CharacteristicID == "DO" | CharacteristicID == "DO_SAT" |
CharacteristicID == "CHLA" | CharacteristicID == "SPCOND" |
CharacteristicID == "TEMP_WATER" | CharacteristicID == "DEPTH")
#load Surveys table of vertical profiles exported from Access
profforebay <- read.csv(
"MysticDB/Conversion/sonde/testing_20150828/Survey_export_test.csv",
strip.white=TRUE, header = TRUE, as.is=TRUE)
# parse date and filter for id
profforebay2 <- profforebay %>%
filter(SurveyID == VerticalSurveyID2) %>%
mutate(Datetime = mdy_hms(Datetime, tz="UTC")) %>% #need time to the sec to uniquely id
mutate(Datetime = with_tz(Datetime, tzone="US/Eastern"))
profforebay2 <- unique( profforebay2[ , 1:8 ]) #handheld creates duplicate records; remove
UPLboth <- rbind(UPL2,forebay2)
g <- ggplot(UPLboth, aes(Datetime, ResultValue, color = LocationID))
g + geom_line() + facet_wrap( ~ CharacteristicID, ncol= 2, scale = "free_y") +theme_bw() + theme(axis.text.x = element_text(angle = 45, hjust = 1))
g <- ggplot(UPL2, aes(Datetime, ResultValue))
g + geom_line() + facet_wrap( ~ CharacteristicID, ncol= 2, scale = "free_y") +theme_bw() + theme(axis.text.x = element_text(angle = 45, hjust = 1))
g <- ggplot(forebay2, aes(Datetime, ResultValue))
g + geom_line() + facet_wrap( ~ CharacteristicID, ncol= 2, scale = "free_y") +theme_bw() + theme(axis.text.x = element_text(angle = 45, hjust = 1))
August 31, ~5 pm
# Shape Access data and plot
# spread data for scatterplots
profUPLplot <- profUPL2 %>%
#spread(CharacteristicID, ResultValue)
dcast(Datetime ~ CharacteristicID, value.var = "ResultValue")
profUPLplot <- left_join(profUPL2, profUPLplot) %>%
filter(CharacteristicID == "CHLA" | CharacteristicID == "DO" |
CharacteristicID == "DO_SAT" |
CharacteristicID == "SPCOND" |CharacteristicID == "DEPTH"
|CharacteristicID == "TEMP_WATER")
g <- ggplot(arrange(profUPLplot, DEPTH), aes(ResultValue, DEPTH))
g + facet_wrap( ~ CharacteristicID, ncol= 3, scale = "free_x") + theme_bw() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_y_reverse() + ylab("Depth (m)") +
geom_path(aes(color = DEPTH), size = 1) +
scale_color_gradient(low = "gray94", high = "gray37") +
guides(color = guide_colorbar(reverse=T)) + geom_point()
August 7, ~3 pm Note: measured depth of forebay less than 2 meters; water level apparently low compared to historical levels because of dam management practices. Bathymetry map below probably overestimates current depth.
profforebayplot <- profforebay2 %>%
#spread(CharacteristicID, ResultValue)
dcast(Datetime ~ CharacteristicID, value.var = "ResultValue")
profforebayplot <- left_join(profforebay2, profforebayplot) %>%
filter(CharacteristicID == "CHLA" | CharacteristicID == "DO" |
CharacteristicID == "DO_SAT" |
CharacteristicID == "SPCOND" |CharacteristicID == "DEPTH"
|CharacteristicID == "TEMP_WATER")
g <- ggplot(arrange(profforebayplot, DEPTH), aes(ResultValue, DEPTH))
g + facet_wrap( ~ CharacteristicID, ncol= 3, scale = "free_x") + theme_bw() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_y_reverse() + ylab("Depth (m)") +
geom_path(aes(color = DEPTH), size = 1) +
scale_color_gradient(low = "gray94", high = "gray37") +
guides(color = guide_colorbar(reverse=T)) + geom_point()
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=42.43996,-71.14638&zoom=15&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false
## Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=42.44296,-71.14638&zoom=15&size=640x640&scale=2&maptype=roadmap&language=en-EN&sensor=false