This code uses CSV files output from Seabird CTD data processing software. Only downcasts are shown here. Screenshots of the process are below. Data are not binned using seabird, instead this code evaluates the profiles, extrapolates to 100 points using approx, and trims individual profiles that do not start at the shallowest depth (some CTD casts first went down to 4 m, went back up, and then did the donwmcast).

report here: https://rpubs.com/HailaSchultz/field_CTD-profiles

load packages

library(tidyverse)
library(dplyr)

Seabird Processing

CTD Profile Processing

import data

import unedited CTD downcasts into one file

#set working directory to folder with CTD files
setwd("/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-unedited")

CTDCombine <-
    list.files(pattern = "*.csv") %>% 
    map_df(~read_csv(.))

prep data

replace NA with 0 and rename columns

CTDCombine <- CTDCombine %>% replace(is.na(.), 0)
CTDCombine$Time<-CTDCombine$"timeS:"
CTDCombine$Depth<-CTDCombine$"depSM:"+CTDCombine$"depSM:...6"
CTDCombine$Oxygen<-CTDCombine$"sbeox0Mg/L:"+CTDCombine$"sbeox0Mg/L:...11"
CTDCombine$Temp<-CTDCombine$"tv290C:"+CTDCombine$"t090C:"
CTDCombine$pH<-CTDCombine$"ph:"
CTDCombine$fluorescence<-CTDCombine$"flECO-AFL:"
CTDCombine$salinity<-CTDCombine$"sal00:"

subset to just a few variables

myvars <- c("Station", "Time","Depth", "Oxygen", "Temp", "pH", "fluorescence","salinity")
CTDCombined_subset <- CTDCombine[myvars]
CTDCombined_subset$Depth<-as.numeric(CTDCombined_subset$Depth)
CTDCombined_subset$fluorescence<-as.numeric(CTDCombined_subset$fluorescence)

Plot profiles

remove stations that didn’t get full water column profile due to low battery or some other reason

CTDCombined_subset<-subset(CTDCombined_subset, ! Station %in% c("Budd1a","Budd2s","Budd3a","Budd4a","Eld1b","Eld2b","Eld3b","QM1b","QM2b","QM3b","QM4b","QM5b","QM6b","Gig4a"))

get unique station names

unique(CTDCombined_subset$Station)
##  [1] "2020_BUDD2s"    "BUDD1"          "BUDD1s"         "BUDD2a"        
##  [5] "BUDD3"          "BUDD3s"         "BUDD4"          "BUDD4s"        
##  [9] "Budd5-scrapped" "BUDD5"          "BUDD6"          "BUDD7"         
## [13] "Case1"          "Case2"          "Case3"          "Eld1"          
## [17] "Eld1s"          "Eld2"           "Eld2s"          "Eld3"          
## [21] "Eld3s"          "Eld4"           "Eld4s"          "Eld5"          
## [25] "Gig1"           "Gig1a"          "Gig2"           "Gig2a"         
## [29] "Gig3"           "Gig4"           "QM10"           "QM11"          
## [33] "QM12"           "QM1a"           "QM1c"           "QM2a"          
## [37] "QM2c"           "QM3a"           "QM3c"           "QM4a"          
## [41] "QM4c"           "QM5a"           "QM5c"           "QM6c"          
## [45] "QM7a"           "QM8_8-23-21"    "QM8a"           "QM9"           
## [49] "SC10"           "SC11"           "SC12"           "SC14"          
## [53] "SC16"           "SC17"           "SC2c"           "SC3c"          
## [57] "SC4c"           "SC5a"           "SC5c"           "SC6c"          
## [61] "SC7"            "SC8"            "Totten"

Fluorescense

2020_BUDD2s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="2020_BUDD2s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 11.38064
#remove negative depths at the beginning
Sub<-Sub[-(1:202),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/2020_BUDD2s.csv", row.names = FALSE)

BUDD1

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD1")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 5.291129
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:2321),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD1.csv", row.names = FALSE)

BUDD1s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD1s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 5.015198
#remove negative depths at the beginning
Sub<-Sub[-(1:42),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD1s.csv", row.names = FALSE)

BUDD2a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD2a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 7.127296
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:1677),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD2a.csv", row.names = FALSE)

BUDD3

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD3")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 15.63191
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:4682),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD3.csv", row.names = FALSE)

BUDD3s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD3s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 10.11172
#remove negative depths at the beginning
Sub<-Sub[-(1:8),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD3s.csv", row.names = FALSE)

BUDD4

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD4")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 2.742937
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:2561),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD4.csv", row.names = FALSE)

BUDD4s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD4s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 8.202818
#remove negative depths at the beginning
Sub<-Sub[-(1:5),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD4s.csv", row.names = FALSE)

BUDD5

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD5")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.755962
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD5.csv", row.names = FALSE)

BUDD6

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD6")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 24.5614
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD6.csv", row.names = FALSE)

BUDD7

#subset to station
Sub<- subset(CTDCombined_subset, Station =="BUDD7")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.858741
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:3295),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/BUDD7.csv", row.names = FALSE)

Eld1

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld1")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 10.07205
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:1168),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld1.csv", row.names = FALSE)

Eld1s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld1s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.616252
#remove negative depths at the beginning
Sub<-Sub[-(1:243),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld1s.csv", row.names = FALSE)

Eld2

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld2")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 9.332147
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:2924),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld2.csv", row.names = FALSE)

Eld2s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld2s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 12.12546
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:378),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld2s.csv", row.names = FALSE)

Eld3

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld3")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.69884
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:1848),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld3.csv", row.names = FALSE)

Eld3s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld3s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 6.335974
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:102),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld3s.csv", row.names = FALSE)

Eld4

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld4")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 32.22994
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:1399),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld4.csv", row.names = FALSE)

Eld4s

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld4s")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 5.364249
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:121),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld4s.csv", row.names = FALSE)

Eld5

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Eld5")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 18.01329
#remove dip to the bottom at the beginning
Sub<-Sub[-(1:1425),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Eld5.csv", row.names = FALSE)

Gig1

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig1")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.806711
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:49),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig1.csv", row.names = FALSE)

Gig1a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig1a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.125993
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:241),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig1a.csv", row.names = FALSE)

Gig2

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig2")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.206477
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:70),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig2.csv", row.names = FALSE)

Gig2a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig2a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.286847
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig2a.csv", row.names = FALSE)

Gig3

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig3")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.831888
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:110),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig3.csv", row.names = FALSE)

Gig4 *needs to be trimmed?

#subset to station
Sub<- subset(CTDCombined_subset, Station =="Gig4")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 0.6459549
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:251),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/Gig4.csv", row.names = FALSE)

QM10

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM10")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 6.744373
#remove negative depths at the beginning, including anamalous values above 40
Sub<-Sub[-(1:2686),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM10.csv", row.names = FALSE)

QM11

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM11")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.795363
#remove negative depths at the beginning
Sub<-Sub[-(1:4364),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM11.csv", row.names = FALSE)

QM12

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM12")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 6.451486
#remove negative depths at the beginning
Sub<-Sub[-(1:3450),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM12.csv", row.names = FALSE)

QM1a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM1a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 9.630731
#remove negative depths at the beginning
Sub<-Sub[-(1:1733),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM1a.csv", row.names = FALSE)

QM1c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM1c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 5.982861
#remove negative depths at the beginning
Sub<-Sub[-(1:2635),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM1c.csv", row.names = FALSE)

QM2a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM2a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 10.49711
#remove negative depths at the beginning
Sub<-Sub[-(1:1714),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM2a.csv", row.names = FALSE)

QM2c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM2c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 7.145806
#remove negative depths at the beginning
Sub<-Sub[-(1:4000),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM2c.csv", row.names = FALSE)

QM3a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM3a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 10.22886
#remove negative depths at the beginning
Sub<-Sub[-(1:1964),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM3a.csv", row.names = FALSE)

QM3c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM3c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 8.855939
#remove negative depths at the beginning
Sub<-Sub[-(1:2282),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM3c.csv", row.names = FALSE)

QM4a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM4a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 11.86922
#remove negative depths at the beginning
Sub<-Sub[-(1:1460),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM4a.csv", row.names = FALSE)

QM4c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM4c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 6.5239
#remove negative depths at the beginning
Sub<-Sub[-(1:3521),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM4c.csv", row.names = FALSE)

QM5a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM5a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 9.932612
#remove negative depths at the beginning
Sub<-Sub[-(1:1096),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM5a.csv", row.names = FALSE)

QM5c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM5c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 8.205199
#remove negative depths at the beginning
Sub<-Sub[-(1:2755),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM5c.csv", row.names = FALSE)

QM6c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM6c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 7.032696
#remove negative depths at the beginning
Sub<-Sub[-(1:3585),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM6c.csv", row.names = FALSE)

QM7a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM7a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 12.29751
#remove negative depths at the beginning
Sub<-Sub[-(1:1143),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM7a.csv", row.names = FALSE)

QM8_8-23-21

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM8_8-23-21")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.0507
#remove negative depths at the beginning
Sub<-Sub[-(1:13),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM8_8-23-21.csv", row.names = FALSE)

QM8a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM8a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.059136
#remove negative depths at the beginning
Sub<-Sub[-(1:2232),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM8a.csv", row.names = FALSE)

QM9

#subset to station
Sub<- subset(CTDCombined_subset, Station =="QM9")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 3.155945
#remove negative depths at the beginning
Sub<-Sub[-(1:2535),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/QM9.csv", row.names = FALSE)

SC10

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC10")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 8.190672
#remove negative depths at the beginning
Sub<-Sub[-(1:5356),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC10.csv", row.names = FALSE)

SC11

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC11")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 7.042164
#remove negative depths at the beginning
Sub<-Sub[-(1:2462),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC11.csv", row.names = FALSE)

SC12

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC12")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 1.801365
#remove negative depths at the beginning
Sub<-Sub[-(1:1774),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC12.csv", row.names = FALSE)

SC14

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC14")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 5.393394
#remove negative depths at the beginning
Sub<-Sub[-(1:2129),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC14.csv", row.names = FALSE)

SC16

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC16")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 4.689953
#remove negative depths at the beginning
Sub<-Sub[-(1:2299),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC16.csv", row.names = FALSE)

SC17

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC17")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 1.461634
#remove negative depths at the beginning
Sub<-Sub[-(1:1993),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC17.csv", row.names = FALSE)

SC2c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC2c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 13.5099
#remove negative depths at the beginning
Sub<-Sub[-(1:3600),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC2c.csv", row.names = FALSE)

SC3c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC3c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 10.57866
#remove negative depths at the beginning
Sub<-Sub[-(1:3122),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC3c.csv", row.names = FALSE)

SC4c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC4c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 2.022514
#remove negative depths at the beginning
Sub<-Sub[-(1:4949),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC4c.csv", row.names = FALSE)

SC5a

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC5a")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 7.024193
#remove negative depths at the beginning
Sub<-Sub[-(1:172),]
#small boat calibration
Sub$fluorescence<-(Sub$fluorescence*0.91)+4.6
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC5a.csv", row.names = FALSE)

SC5c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC5c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 9.927959
#remove negative depths at the beginning
Sub<-Sub[-(1:3840),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC5c.csv", row.names = FALSE)

SC6c

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC6c")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 13.77656
#remove negative depths at the beginning
Sub<-Sub[-(1:3099),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC6c.csv", row.names = FALSE)

SC7

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC7")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 8.291089
#remove negative depths at the beginning
Sub<-Sub[-(1:2982),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC7.csv", row.names = FALSE)

SC8

#subset to station
Sub<- subset(CTDCombined_subset, Station =="SC8")
#raw profile
ggplot(Sub, aes(x=fluorescence, y=Depth)) + geom_point()

#interpolated profile
table<-approx(x=Sub$Depth, y=Sub$fluorescence, method="linear", n=100)
df<-as.data.frame(table)
ggplot(df, aes(y,x)) + geom_point()

mean(df$y)
## [1] 1.952421
#remove negative depths at the beginning
Sub<-Sub[-(1:3060),]
#write dataframe to CSV
write.csv(Sub,"/Users/hailaschultz/Dropbox/Other studies/Aurelia project/Data Analysis/data/current_data/CTD/CTD_Downcasts-edited/SC8.csv", row.names = FALSE)