Last updated: 2020-04-21
Checks: 7 0
Knit directory: BloomSail/
This reproducible R Markdown analysis was created with workflowr (version 1.6.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20191021)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version a82b4fe. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: data/Finnmaid_2018/
Ignored: data/GETM/
Ignored: data/Maps/
Ignored: data/Ostergarnsholm/
Ignored: data/TinaV/
Ignored: data/_merged_data_files/
Ignored: data/_summarized_data_files/
Untracked files:
Untracked: output/Plots/Figures_publication/
Unstaged changes:
Deleted: analysis/license.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/CT_dynamics.Rmd
) and HTML (docs/CT_dynamics.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | 69c301c | jens-daniel-mueller | 2020-04-21 | Build site. |
html | c9549ee | jens-daniel-mueller | 2020-04-19 | Build site. |
Rmd | f8fcf50 | jens-daniel-mueller | 2020-04-19 | created pub figures for time series |
html | f8fcf50 | jens-daniel-mueller | 2020-04-19 | created pub figures for time series |
html | 6810175 | jens-daniel-mueller | 2020-04-17 | Build site. |
Rmd | 864596a | jens-daniel-mueller | 2020-04-17 | plotted all profiles |
html | 4054ba1 | jens-daniel-mueller | 2020-04-17 | Build site. |
Rmd | acc1379 | jens-daniel-mueller | 2020-04-17 | calculate AT sd |
html | 729b4c6 | jens-daniel-mueller | 2020-04-17 | Build site. |
Rmd | 2edd18d | jens-daniel-mueller | 2020-04-17 | included bottle CT AT from 180723 |
html | bf6384a | jens-daniel-mueller | 2020-04-17 | Build site. |
Rmd | d0eb264 | jens-daniel-mueller | 2020-04-17 | all stations on map |
html | cc2baf3 | jens-daniel-mueller | 2020-04-16 | Build site. |
Rmd | 13436a3 | jens-daniel-mueller | 2020-04-16 | worked on map |
html | 5e8f8e1 | jens-daniel-mueller | 2020-04-16 | Build site. |
Rmd | 86b0833 | jens-daniel-mueller | 2020-04-16 | New fixed integration depth 12m |
html | 4ac8782 | jens-daniel-mueller | 2020-04-16 | Build site. |
Rmd | 95380d4 | jens-daniel-mueller | 2020-04-16 | Cumulative temperature distribution on July 23 |
html | 48631ee | jens-daniel-mueller | 2020-04-09 | Build site. |
Rmd | 4e9464f | jens-daniel-mueller | 2020-04-09 | corrected na approx function |
html | 849e990 | jens-daniel-mueller | 2020-04-01 | Build site. |
Rmd | c199200 | jens-daniel-mueller | 2020-04-01 | included BloomSail data to Finnmaid analysis |
html | f4a27b8 | jens-daniel-mueller | 2020-04-01 | Build site. |
Rmd | b1613b7 | jens-daniel-mueller | 2020-04-01 | re-calculated MLD, renamed objects and structured site |
html | 6302994 | jens-daniel-mueller | 2020-03-31 | Build site. |
Rmd | 50ab313 | jens-daniel-mueller | 2020-03-31 | implemented temperature reconstruction |
html | a6c4c22 | jens-daniel-mueller | 2020-03-30 | Build site. |
Rmd | d8120b3 | jens-daniel-mueller | 2020-03-30 | reconstruction BloomSail surface started, merging MLD and DT approach |
html | 80c78b3 | jens-daniel-mueller | 2020-03-30 | Build site. |
html | 70dbfbe | jens-daniel-mueller | 2020-03-30 | Build site. |
Rmd | e69d1f0 | jens-daniel-mueller | 2020-03-30 | cleaned object names |
html | 431a56a | jens-daniel-mueller | 2020-03-30 | Build site. |
Rmd | 9edf20d | jens-daniel-mueller | 2020-03-30 | flux and mixing correction revised |
html | f8ad4ff | jens-daniel-mueller | 2020-03-30 | Build site. |
Rmd | 265e568 | jens-daniel-mueller | 2020-03-30 | NCP calculation finished |
html | 2ade511 | jens-daniel-mueller | 2020-03-27 | Build site. |
Rmd | 858e01f | jens-daniel-mueller | 2020-03-27 | iCT flux correction applied |
html | a22daa8 | jens-daniel-mueller | 2020-03-27 | Build site. |
Rmd | 9118b70 | jens-daniel-mueller | 2020-03-27 | iCT flux correction applied |
html | 2d358fb | jens-daniel-mueller | 2020-03-27 | Build site. |
Rmd | d17a2b0 | jens-daniel-mueller | 2020-03-27 | Added air sea CO2 fluxes |
html | 43da055 | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 6afdea9 | jens-daniel-mueller | 2020-03-26 | selected iCT time series for NCP |
html | 1d7eebc | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 4d734a1 | jens-daniel-mueller | 2020-03-26 | Started NCP estimation |
html | 57e3e73 | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 275b061 | jens-daniel-mueller | 2020-03-26 | renamed NCP correctly als iCT |
html | 30d5b10 | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 0405651 | jens-daniel-mueller | 2020-03-26 | Restructure MLD iCT chapter |
html | 90633b8 | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | baa81d6 | jens-daniel-mueller | 2020-03-26 | heigth surface timeseries reduced |
html | f139cbd | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 1b8a11e | jens-daniel-mueller | 2020-03-26 | restructured NCP chapter, and renamed as iCT |
html | c2b128e | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 6ec4005 | jens-daniel-mueller | 2020-03-26 | added interpretation notes |
html | 63909fc | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 069600c | jens-daniel-mueller | 2020-03-26 | theme_bw |
html | 5011448 | jens-daniel-mueller | 2020-03-26 | Build site. |
Rmd | 69ec53e | jens-daniel-mueller | 2020-03-26 | Comparison iCT estimates |
html | b6e6117 | jens-daniel-mueller | 2020-03-25 | Build site. |
Rmd | 07690b6 | jens-daniel-mueller | 2020-03-25 | NCP MLD approach implmented |
html | a667be1 | jens-daniel-mueller | 2020-03-25 | Build site. |
Rmd | 93800e0 | jens-daniel-mueller | 2020-03-25 | NCP MLD approach implmented |
html | b8d7014 | jens-daniel-mueller | 2020-03-25 | Build site. |
Rmd | a13c901 | jens-daniel-mueller | 2020-03-25 | NCP fixed depth, new variable names, ref dates introduced |
html | b589daf | jens-daniel-mueller | 2020-03-24 | Build site. |
Rmd | 90979bb | jens-daniel-mueller | 2020-03-24 | nameing convention and NCP approaches list |
html | d0d5c9e | jens-daniel-mueller | 2020-03-24 | Build site. |
Rmd | 1e2508a | jens-daniel-mueller | 2020-03-24 | harmonized starting dates |
html | 5f8ca30 | jens-daniel-mueller | 2020-03-20 | Build site. |
html | 2a20453 | jens-daniel-mueller | 2020-03-20 | Build site. |
html | 473ab25 | jens-daniel-mueller | 2020-03-19 | Build site. |
html | e9d33a7 | jens-daniel-mueller | 2020-03-19 | Build site. |
Rmd | ff79dbe | jens-daniel-mueller | 2020-03-19 | remoced errorbars in ts plot |
html | 4766353 | jens-daniel-mueller | 2020-03-19 | Build site. |
Rmd | 0d90486 | jens-daniel-mueller | 2020-03-19 | Hovmoeller daily changes |
html | 592f3b5 | jens-daniel-mueller | 2020-03-19 | Build site. |
Rmd | 4103279 | jens-daniel-mueller | 2020-03-19 | CT: removed coastal, added errorbars and hovmoeller |
html | 81f022e | jens-daniel-mueller | 2020-03-18 | Build site. |
html | 18a74d1 | jens-daniel-mueller | 2020-03-18 | Build site. |
Rmd | b839b18 | jens-daniel-mueller | 2020-03-18 | CT vs tem changes implemented |
html | 1e39d85 | jens-daniel-mueller | 2020-03-18 | Build site. |
html | 2105236 | jens-daniel-mueller | 2020-03-18 | Build site. |
html | 4858097 | jens-daniel-mueller | 2020-03-18 | Build site. |
Rmd | f0233c2 | jens-daniel-mueller | 2020-03-18 | MLD and NCP penetration depth |
html | 05b9bdc | jens-daniel-mueller | 2020-03-17 | Build site. |
html | 943cd6b | jens-daniel-mueller | 2020-03-17 | Build site. |
Rmd | 859c4a4 | jens-daniel-mueller | 2020-03-17 | corrected gas exchange calculation |
html | 26bc407 | jens-daniel-mueller | 2020-03-17 | Build site. |
Rmd | 7be14e4 | jens-daniel-mueller | 2020-03-17 | corrected CT cum timeseries, used exact mean dates |
html | cb196d8 | jens-daniel-mueller | 2020-03-17 | Build site. |
Rmd | 7c10336 | jens-daniel-mueller | 2020-03-17 | corrected CT cum timeseries, used exact mean dates |
html | 0202742 | jens-daniel-mueller | 2020-03-16 | Build site. |
html | 7508d11 | jens-daniel-mueller | 2020-03-16 | Build site. |
Rmd | 53ee423 | jens-daniel-mueller | 2020-03-16 | gas exchange calculation completed |
html | 9f0c30b | jens-daniel-mueller | 2020-03-16 | Build site. |
Rmd | 1c60add | jens-daniel-mueller | 2020-03-16 | incremental CT changes timeseries + raw pCO2 profiles plotted |
html | 4150817 | jens-daniel-mueller | 2020-03-13 | Build site. |
Rmd | 94e12d8 | jens-daniel-mueller | 2020-03-13 | final cleaning |
html | 443d9a1 | jens-daniel-mueller | 2020-03-13 | Build site. |
Rmd | 39b841d | jens-daniel-mueller | 2020-03-13 | all profiles pdfs included |
html | ff22d6f | jens-daniel-mueller | 2020-03-13 | Build site. |
Rmd | f49ce78 | jens-daniel-mueller | 2020-03-13 | cumulative changes per depth |
html | e404359 | jens-daniel-mueller | 2020-03-12 | Build site. |
Rmd | e9725fe | jens-daniel-mueller | 2020-03-12 | Clean CT dynamics |
html | 8e83afd | jens-daniel-mueller | 2020-03-12 | Build site. |
Rmd | 3c17c46 | jens-daniel-mueller | 2020-03-12 | update CT cynamics |
html | a3ddea4 | jens-daniel-mueller | 2020-03-12 | Build site. |
Rmd | 97355fa | jens-daniel-mueller | 2020-03-12 | CT calculations and plots |
library(tidyverse)
library(patchwork)
library(seacarb)
library(marelac)
library(metR)
library(scico)
library(lubridate)
library(zoo)
Profile data are prepared by:
Please note that:
ts <-
read_csv(here::here("data/_merged_data_files",
"BloomSail_CTD_HydroC_track_RT.csv"),
col_types = cols(ID = col_character(),
pCO2_analog = col_double(),
pCO2 = col_double(),
Zero = col_character(),
Flush = col_character(),
mixing = col_character(),
Zero_ID = col_integer(),
deployment = col_integer(),
lon = col_double(),
lat = col_double(),
pCO2_RT = col_double()))
# Filter relevant rows and columns
ts_profiles <- ts %>%
filter(type == "P",
Flush == "0",
Zero == "0",
!ID %in% c("180616","180820"),
!(station %in% c("PX1", "PX2"))) %>%
select(date_time, ID, station, lat, lon, dep, sal, tem, pCO2_raw = pCO2, pCO2 = pCO2_RT_mean, duration)
stations <- ts_profiles %>%
group_by(station) %>%
summarise(lat = mean(lat),
lon = mean(lon)) %>%
ungroup()
ts_profiles <- ts_profiles %>%
filter(!(station %in% c("P14", "P13", "P01")))
# Assign meta information
ts_profiles <- ts_profiles %>%
group_by(ID, station) %>%
mutate(duration = as.numeric(date_time - min(date_time))) %>%
arrange(date_time) %>%
ungroup()
meta <- read_csv(here::here("Data/_summarized_data_files",
"Tina_V_Sensor_meta.csv"),
col_types = cols(ID = col_character()))
meta <- meta %>%
filter(!ID %in% c("180616","180820"),
!(station %in% c("PX1", "PX2", "P14", "P13", "P01")))
ts_profiles <- full_join(ts_profiles, meta)
rm(meta)
# creating descriptive variables
ts_profiles <- ts_profiles %>%
mutate(phase = "standby",
phase = if_else(duration >= start & duration < down & !is.na(down) & !is.na(start),
"down", phase),
phase = if_else(duration >= down & duration < lift & !is.na(lift) & !is.na(down ),
"low", phase),
phase = if_else(duration >= lift & duration < up & !is.na(up ) & !is.na(lift ),
"mid", phase),
phase = if_else(duration >= up & duration < end & !is.na(end ) & !is.na(up ),
"up", phase))
ts_profiles <- ts_profiles %>%
select(-c(start, down, lift, up, end, comment, p_type, duration))
# select downcasst only
ts_profiles <- ts_profiles %>%
filter(phase == "down") %>%
select(-phase)
# ts_profiles_highres <- ts_profiles
# grid observation to 1m depth intervals
ts_profiles <- ts_profiles %>%
mutate(dep_grid = as.numeric(as.character( cut(dep, seq(0,40,1), seq(0.5,39.5,1))))) %>%
group_by(ID, station, dep_grid) %>%
summarise_all("mean", na.rm = TRUE) %>%
ungroup() %>%
select(-dep, dep=dep_grid)
# subset complete profiles
profiles_in <- ts_profiles %>%
filter(dep < 20) %>%
group_by(ID, station) %>%
summarise(nr = n()) %>%
mutate(select = if_else(nr > 18 | station == "P14", "in", "out")) %>%
select(-nr) %>%
ungroup()
ts_profiles <- full_join(ts_profiles, profiles_in)
rm(profiles_in)
ts_profiles %>%
arrange(date_time) %>%
ggplot(aes(pCO2, dep, col=select))+
geom_hline(yintercept = 25)+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_x_continuous(breaks = c(0, 600), labels = c(0, 600))+
scale_color_brewer(palette = "Set1", direction = -1)+
coord_cartesian(xlim = c(0,600))+
facet_grid(ID~station)
ts_profiles <- ts_profiles %>%
filter(select == "in") %>%
select(-select) %>%
filter(dep < 25)
# assign mean date_time stamp
cruise_dates <- ts_profiles %>%
group_by(ID) %>%
summarise(date_time_ID = mean(date_time),
date_ID = format(as.Date(date_time_ID), "%b %d")) %>%
ungroup()
# inner_join remove P14 observations lacking date_time_ID
ts_profiles <- inner_join(cruise_dates, ts_profiles)
lat_lo <- 57.25
lat_hi <- 57.6
lon_lo <- 18.6
lon_hi <- 19.7
map <- read_csv(here::here("data/Maps","Bathymetry_Gotland_east_small.csv")) %>%
filter(lat < lat_hi, lat > lat_lo,
lon < lon_hi, lon > lon_lo)
map_low_res <- map %>%
mutate(lat = cut(lat,
breaks = seq(57,58,0.01),
labels = seq(57.005,57.995,0.01)),
lon = cut(lon,
breaks = seq(18,22,0.01),
labels = seq(18.005,21.995,0.01))) %>%
group_by(lat,lon) %>%
summarise_all(mean, na.rm=TRUE) %>%
ungroup() %>%
mutate(lat = as.numeric(as.character(lat)),
lon = as.numeric(as.character(lon)))
ggplot()+
geom_contour_fill(data = map_low_res,
aes(x=lon, y=lat, z=-elev),
na.fill = TRUE,
breaks = seq(0,300,20))+
geom_raster(data=map %>% filter(is.na(elev)),
aes(lon, lat), fill="black")+
geom_label(data = stations %>% filter(!(station %in% c("P14", "P13", "P01"))),
aes(lon, lat, label=station), col="red")+
geom_label(data = stations %>% filter(station %in% c("P14", "P13", "P01")),
aes(lon, lat, label=station), col="grey")+
coord_quickmap(expand = 0)+
scale_fill_scico(palette = "oslo", na.value = "grey",
name="Depth [m]", direction = -1,
breaks = seq(0,160,20),
guide = "colorstrip")
rm(map, map_low_res, lat_hi, lat_lo, lon_hi, lon_lo)
cover <- ts_profiles %>%
group_by(ID, station) %>%
summarise(date = mean(date_time),
date_time_ID = mean(date_time_ID)) %>%
ungroup()
cover %>%
ggplot(aes(date, station, fill=ID))+
geom_vline(aes(xintercept = date_time_ID, col=ID))+
geom_point(shape=21)+
scale_color_viridis_d()+
scale_fill_viridis_d()
rm(cover)
At stations P07 and P10 discrete samples for lab measurments of CT and AT were collected. Please note that - in contrast to the pCO2 profiles - samples were taken on June 16, but removed here for harmonization of results.
tb <-
read_csv(here::here("Data/_summarized_data_files", "Tina_V_Bottle_CO2_lab.csv"),
col_types = cols(ID = col_character()))
tb <- tb %>%
filter(station %in% c("P07", "P10")) %>%
select(-pH_Mosley) %>%
mutate(CT_AT_ratio = CT/AT,
ID = if_else(ID == "180722", "180723", ID))
tb <- inner_join(tb, cruise_dates)
tb_long <- tb %>%
pivot_longer(4:7, names_to = "var", values_to = "value")
tb_long %>%
ggplot(aes(value, dep))+
geom_path(aes(col=ID))+
geom_point(aes(fill=ID), shape=21)+
scale_y_reverse()+
scale_fill_viridis_d(labels = cruise_dates$date_ID)+
scale_color_viridis_d(labels = cruise_dates$date_ID)+
facet_grid(station~var, scales = "free_x")+
theme(legend.position = "bottom",
legend.title = element_blank())
Important notes: - Spatio-temporal variation of AT is small, which jusitfies conversion of pCO2 to CT based on a fixed mean AT - On July 31 we see a drop in surface salinity, associated with a rise in AT, clearly pointing at exchange of water masses, presumably later
0-10m
tb_surface <- tb_long %>%
filter(dep<11) %>%
group_by(ID, date_time_ID, var, station) %>%
summarise(value = mean(value, na.rm = TRUE)) %>%
ungroup()
rm(tb_long)
tb_surface %>%
ggplot(aes(date_time_ID, value, col=station))+
#geom_point(aes(lubridate::ymd(ID), value, col=station))+
geom_point()+
geom_path()+
scale_fill_viridis_d()+
scale_color_brewer(palette = "Set1")+
facet_grid(var~., scales = "free_y")+
labs(x="Mean transect date")
AT_mean <- tb %>%
filter(dep <= 20) %>%
summarise(AT = mean(AT, na.rm = TRUE)) %>%
pull()
tb_surface %>%
filter(var == "CT_AT_ratio") %>%
ggplot(aes(date_time_ID, value*AT_mean, col=station))+
geom_point()+
geom_path()+
scale_fill_viridis_d()+
scale_color_brewer(palette = "Set1")+
labs(x="Mean transect date", y="CT-AT-ratio * mean AT")
Important notes: - CT drop and temporal patterns observed in the CT/AT time series agrees well with those found in the CT time series derived from pCO2 measurements
In order to derive CT from measured pCO2 profiles, the alkalinity mean + sd in the upper 20 m and both stations was calculated as:
AT_mean
[1] 1718.872
AT_sd <- tb %>%
filter(dep <= 20) %>%
summarise(AT = sd(AT, na.rm = TRUE)) %>%
pull()
AT_sd
[1] 26.23092
rm(AT_sd)
Likewise, the mean salinity amounts to:
sal_mean <- tb %>%
filter(dep <= 20) %>%
summarise(sal = mean(sal, na.rm = TRUE)) %>%
pull()
sal_mean
[1] 6.907083
bind_cols(start = min(ts_profiles$date_time),
end = max(ts_profiles$date_time),
AT = AT_mean,
sal = sal_mean) %>%
write_csv(here::here("Data/_summarized_data_files", "tb_fix.csv"))
rm(tb, tb_surface)
CT profiles were calculated from sensor pCO2 and T profiles, and constant salinity and alkalinity values. Note that the impact of fixed vs. measured salinity has only a negligible impact on CT profiles.
ts_profiles <- ts_profiles %>%
drop_na()
ts_profiles <- ts_profiles %>%
filter(pCO2 > 0)
ts_profiles <- ts_profiles %>%
mutate(CT = carb(24, var1=pCO2, var2=1720*1e-6,
S=sal_mean, T=tem, P=dep/10, k1k2="m10", kf="dg", ks="d",
gas="insitu")[,16]*1e6)
rm(sal_mean, AT_mean)
ts_profiles %>%
write_csv(here::here("Data/_merged_data_files", "ts_profiles.csv"))
ts_profiles <- ts_profiles %>%
arrange(date_time_ID)
p_tem <-
ts_profiles %>%
ggplot(aes(tem, dep, col=ID, group = interaction(station, ID)))+
geom_path()+
scale_y_reverse(expand = c(0,0))+
labs(x = "Temperature (\u00B0C)",
y = "Depth (m)")+
scale_color_viridis_d(guide = FALSE)
p_pCO2 <-
ts_profiles %>%
ggplot(aes(pCO2, dep, col=ID, group = interaction(station, ID)))+
geom_path()+
scale_y_reverse(expand = c(0,0))+
labs(x = expression(pCO[2]~(µatm)))+
scale_color_viridis_d(guide = FALSE)+
theme(axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.ticks.y = element_blank())
p_CT <-
ts_profiles %>%
ggplot(aes(CT, dep, col=ID, group = interaction(station, ID)))+
geom_path()+
scale_y_reverse(expand = c(0,0))+
labs(x = expression(nC[T]~(µmol~kg^{-1})))+
scale_color_viridis_d(labels = cruise_dates$date_ID)+
theme(legend.title = element_blank(),
axis.text.y = element_blank(),
axis.ticks.y = element_blank(),
axis.title.y = element_blank())
p_tem + p_pCO2 + p_CT
ggsave(here::here("output/Plots/Figures_publication/article", "profiles_all.pdf"),
width = 180, height = 80, dpi = 300, units = "mm")
rm( p_tem, p_pCO2, p_CT)
Mean vertical profiles were calculated for each cruise day (ID).
ts_profiles_ID_mean <- ts_profiles %>%
select(-c(station,lat, lon, pCO2_raw, date_time)) %>%
group_by(ID, date_time_ID, dep) %>%
summarise_all(list(mean), na.rm=TRUE) %>%
ungroup()
ts_profiles_ID_sd <- ts_profiles %>%
select(-c(station,lat, lon, pCO2_raw, date_time)) %>%
group_by(ID, date_time_ID, dep) %>%
summarise_all(list(sd), na.rm=TRUE) %>%
ungroup()
ts_profiles_ID_sd_long <- ts_profiles_ID_sd %>%
pivot_longer(sal:CT, names_to = "var", values_to = "sd")
ts_profiles_ID_mean_long <- ts_profiles_ID_mean %>%
pivot_longer(sal:CT, names_to = "var", values_to = "value")
ts_profiles_ID_long <- inner_join(ts_profiles_ID_mean_long, ts_profiles_ID_sd_long)
ts_profiles_ID_mean %>%
write_csv(here::here("Data/_merged_data_files", "ts_profiles_ID.csv"))
rm(ts_profiles_ID_sd_long, ts_profiles_ID_sd, ts_profiles_ID_mean_long, ts_profiles_ID_mean)
ts_profiles_ID_long %>%
ggplot(aes(value, dep, col=ID))+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_viridis_d()+
facet_wrap(~var, scales = "free_x")
all <- ts_profiles_ID_long %>%
filter(var %in% c("CT", "tem")) %>%
rename(group = ID)
ts_profiles_ID_long %>%
filter(var %in% c("CT", "tem")) %>%
ggplot()+
geom_path(data=all, aes(value, dep, group=group))+
geom_ribbon(aes(xmin = value-sd, xmax=value+sd, y=dep, fill=ID), alpha=0.5)+
geom_path(aes(value, dep, col=ID))+
scale_y_reverse()+
scale_color_viridis_d()+
scale_fill_viridis_d()+
facet_grid(ID~var, scales = "free_x")
rm(all)
Important notes:
CT, pCO2, S, and T profiles were plotted individually pdf here and grouped by ID pdf here. The later gives an idea of the differences between stations at one point in time.
pdf(file=here::here("output/Plots/CT_dynamics",
"ts_profiles_pCO2_tem_sal_CT.pdf"), onefile = TRUE, width = 9, height = 5)
for(i_ID in unique(ts_profiles$ID)){
for(i_station in unique(ts_profiles$station)){
if (nrow(ts_profiles %>% filter(ID == i_ID, station == i_station)) > 0){
# i_ID <- unique(ts_profiles$ID)[1]
# i_station <- unique(ts_profiles$station)[1]
p_pCO2 <-
ts_profiles %>%
arrange(date_time) %>%
filter(ID == i_ID,
station == i_station) %>%
ggplot(aes(pCO2, dep, col="grid_RT"))+
geom_point(data = ts_profiles_highres %>% arrange(date_time) %>% filter(ID == i_ID, station == i_station),
aes(pCO2_raw, dep, col="raw"))+
geom_point(data = ts_profiles_highres %>% arrange(date_time) %>% filter(ID == i_ID, station == i_station),
aes(pCO2, dep, col="raw_RT"))+
geom_point(aes(pCO2_raw, dep, col="grid"))+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_brewer(palette = "Set1")+
labs(y="Depth [m]", x="pCO2 [µatm]", title = str_c(i_ID," | ",i_station))+
coord_cartesian(xlim = c(0,200), ylim = c(30,0))+
theme_bw()+
theme(legend.position = "left")
p_tem <-
ts_profiles %>%
arrange(date_time) %>%
filter(ID == i_ID,
station == i_station) %>%
ggplot(aes(tem, dep))+
geom_point()+
geom_path()+
scale_y_reverse()+
labs(y="Depth [m]", x="Tem [°C]")+
coord_cartesian(xlim = c(14,26), ylim = c(30,0))+
theme_bw()
p_sal <-
ts_profiles %>%
arrange(date_time) %>%
filter(ID == i_ID,
station == i_station) %>%
ggplot(aes(sal, dep))+
geom_point()+
geom_path()+
scale_y_reverse()+
labs(y="Depth [m]", x="Tem [°C]")+
coord_cartesian(xlim = c(6.5,7.5), ylim = c(30,0))+
theme_bw()
p_CT <-
ts_profiles %>%
arrange(date_time) %>%
filter(ID == i_ID,
station == i_station) %>%
ggplot(aes(CT, dep))+
geom_point()+
geom_path()+
scale_y_reverse()+
labs(y="Depth [m]", x="CT* [µmol/kg]")+
coord_cartesian(xlim = c(1400,1700), ylim = c(30,0))+
theme_bw()
print(
p_pCO2 + p_tem + p_sal + p_CT
)
rm(p_pCO2, p_sal, p_tem, p_CT)
}
}
}
dev.off()
rm(i_ID, i_station, ts_profiles_highres)
ts_profiles_long <- ts_profiles %>%
select(-c(lat, lon, pCO2_raw)) %>%
pivot_longer(sal:CT, values_to = "value", names_to = "var")
pdf(file=here::here("output/Plots/CT_dynamics",
"ts_profiles_ID_pCO2_tem_sal_CT.pdf"), onefile = TRUE, width = 9, height = 5)
for(i_ID in unique(ts_profiles$ID)){
#i_ID <- unique(ts_profiles$ID)[1]
sub_ts_profiles_long <- ts_profiles_long %>%
arrange(date_time) %>%
filter(ID == i_ID)
print(
sub_ts_profiles_long %>%
ggplot()+
geom_path(data = ts_profiles_long, aes(value, dep, group=interaction(station, ID)), col="grey")+
geom_path(aes(value, dep, col=station))+
scale_y_reverse()+
labs(y="Depth [m]", title = str_c("ID: ", i_ID))+
theme_bw()+
facet_wrap(~var, scales = "free_x")
)
rm(sub_ts_profiles_long)
}
dev.off()
rm(i_ID, ts_profiles_long)
Changes of seawater vars at each depth are calculated from one cruise day to the next and divided by the number of days inbetween.
ts_profiles_ID_long <- ts_profiles_ID_long %>%
group_by(var, dep) %>%
arrange(date_time_ID) %>%
mutate(date_time_ID_diff = as.numeric(date_time_ID - lag(date_time_ID)),
date_time_ID_ref = date_time_ID - (date_time_ID - lag(date_time_ID))/2,
value_diff = value - lag(value, default = first(value)),
value_diff_daily = value_diff / date_time_ID_diff,
value_cum = cumsum(value_diff)) %>%
ungroup()
ts_profiles_ID_long %>%
arrange(dep) %>%
ggplot(aes(value_diff_daily, dep, col=ID))+
geom_vline(xintercept = 0)+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_viridis_d()+
facet_wrap(~var, scales = "free_x")+
labs(x="Change of value inbetween cruises per day")
Cumulative changes of seawater vars were calculated at each depth relative to the first cruise day on July 5.
ts_profiles_ID_long %>%
arrange(dep) %>%
ggplot(aes(value_cum, dep, col=ID))+
geom_vline(xintercept = 0)+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_viridis_d()+
facet_wrap(~var, scales = "free_x")+
labs(x="Cumulative change of value")
Important notes:
Cumulative positive and negative changes of seawater vars were calculated separately at each depth relative to the first cruise day on July 5.
ts_profiles_ID_long <- ts_profiles_ID_long %>%
mutate(sign = if_else(value_diff < 0, "neg", "pos")) %>%
group_by(var, dep, sign) %>%
arrange(date_time_ID) %>%
mutate(value_cum_sign = cumsum(value_diff)) %>%
ungroup()
ts_profiles_ID_long %>%
arrange(dep) %>%
ggplot(aes(value_cum_sign, dep, col=ID))+
geom_vline(xintercept = 0)+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_viridis_d()+
scale_fill_viridis_d()+
facet_wrap(~interaction(sign, var), scales = "free_x", ncol=4)+
labs(x="Cumulative directional change of value")
ts_profiles_ID_long %>%
write_csv(here::here("Data/_merged_data_files", "ts_profiles_ID_long_cum.csv"))
Mean seawater parameters were calculated for 5m depth intervals.
ts_profiles_ID_long_grid <- ts_profiles_ID_long %>%
mutate(dep = cut(dep, seq(0,30,5))) %>%
group_by(ID, date_time_ID, dep, var) %>%
summarise_all(list(mean), na.rm=TRUE)
ts_profiles_ID_long_grid %>%
ggplot(aes(date_time_ID, value, col=as.factor(dep)))+
geom_path()+
#geom_errorbar(aes(date_time_ID, ymax=value+sd, ymin=value-sd, col=as.factor(dep)))+
geom_point()+
scale_color_viridis_d(name="Depth [m]")+
facet_wrap(~var, scales = "free_y", ncol=1)
rm(ts_profiles_ID_long_grid)
bin_CT <- 30
p_CT_hov <- ts_profiles_ID_long %>%
filter(var == "CT") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID, y=dep, z=value),
breaks = MakeBreaks(bin_CT),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_scico(breaks = MakeBreaks(bin_CT),
guide = "colorstrip",
name="CT (µmol/kg)",
palette = "davos", direction = -1)+
scale_y_reverse()+
theme_bw()+
labs(y="Depth (m)")+
coord_cartesian(expand = 0)+
theme(axis.title.x = element_blank(),
legend.position = "left")
bin_Tem <- 2
p_tem_hov <- ts_profiles_ID_long %>%
filter(var == "tem") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID, y=dep, z=value),
breaks = MakeBreaks(bin_Tem),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_viridis_c(breaks = MakeBreaks(bin_Tem),
guide = "colorstrip",
name="Tem (°C)",
option = "inferno")+
scale_y_reverse()+
labs(y="Depth (m)")+
coord_cartesian(expand = 0)+
theme(axis.title.x = element_blank(),
legend.position = "left")
p_CT_hov / p_tem_hov
rm(p_CT_hov, bin_CT, p_tem_hov, bin_Tem)
bin_CT <- 2.5
CT_hov <- ts_profiles_ID_long %>%
filter(var == "CT") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID_ref, y=dep, z=value_diff_daily),
breaks = MakeBreaks(bin_CT),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_divergent(breaks = MakeBreaks(bin_CT),
guide = "colorstrip",
name="CT (µmol/kg)")+
scale_y_reverse()+
theme_bw()+
labs(y="Depth (m)")+
coord_cartesian(expand = 0)+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
bin_Tem <- 0.1
Tem_hov <- ts_profiles_ID_long %>%
filter(var == "tem") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID_ref, y=dep, z=value_diff_daily),
breaks = MakeBreaks(bin_Tem),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_divergent(breaks = MakeBreaks(bin_Tem),
guide = "colorstrip",
name="Tem (°C)")+
scale_y_reverse()+
theme_bw()+
labs(x="",y="Depth (m)")+
coord_cartesian(expand = 0)
CT_hov / Tem_hov
rm(CT_hov, bin_CT, Tem_hov, bin_Tem)
bin_CT <- 20
CT_hov <- ts_profiles_ID_long %>%
filter(var == "CT") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID, y=dep, z=value_cum),
breaks = MakeBreaks(bin_CT),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_divergent(breaks = MakeBreaks(bin_CT),
guide = "colorstrip",
name="CT (µmol/kg)")+
scale_y_reverse()+
theme_bw()+
labs(y="Depth (m)")+
coord_cartesian(expand = 0)+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
bin_Tem <- 2
Tem_hov <- ts_profiles_ID_long %>%
filter(var == "tem") %>%
ggplot()+
geom_contour_fill(aes(x=date_time_ID, y=dep, z=value_cum),
breaks = MakeBreaks(bin_Tem),
col="black")+
geom_point(aes(x=date_time_ID, y=c(24.5)), size=3, shape=24, fill="white")+
scale_fill_divergent(breaks = MakeBreaks(bin_Tem),
guide = "colorstrip",
name="Tem (°C)")+
scale_y_reverse()+
theme_bw()+
labs(x="",y="Depth (m)")+
coord_cartesian(expand = 0)
CT_hov / Tem_hov
rm(CT_hov, bin_CT, Tem_hov, bin_Tem)
A critical first step for the determination of net community production (NCP) is the integration of observed changes in CT over depth to derive iCT. Two approaches were tested:
Both aproaches deliver depth-integrated, incremental changes of CT inbetween cruise dates. Those were summed up to derive a trajectory of cummulative iCT changes.
Incremental and cumulative CT changes inbetween cruise dates were integrated across the water colums down to predefined depth limits. This was done separately for observed positive/negative changes in CT, as well as for the total observed changes.
iCT_grid_sign <- ts_profiles_ID_long %>%
select(ID, date_time_ID, date_time_ID_ref) %>%
unique() %>%
expand_grid(sign = c("pos", "neg"))
iCT_grid_total <- ts_profiles_ID_long %>%
select(ID, date_time_ID, date_time_ID_ref) %>%
unique() %>%
expand_grid(sign = c("total"))
# dep_i <- 10
#rm(iCT, dep_i)
for (dep_i in seq(9,13,1)) {
iCT_sign_temp <- ts_profiles_ID_long %>%
filter(var == "CT", dep < dep_i) %>%
mutate(sign = if_else(ID == "180705" & dep == 0.5, "neg", sign)) %>%
group_by(ID, date_time_ID, date_time_ID_ref, sign) %>%
summarise(CT_i_diff = sum(value_diff)/1000) %>%
ungroup()
iCT_sign_temp <- iCT_sign_temp %>%
group_by(sign) %>%
arrange(date_time_ID) %>%
mutate(CT_i_cum = cumsum(CT_i_diff)) %>%
ungroup()
iCT_sign_temp <- full_join(iCT_sign_temp, iCT_grid_sign) %>%
arrange(sign, date_time_ID) %>%
fill(CT_i_cum)
iCT_total_temp <- ts_profiles_ID_long %>%
filter(var == "CT", dep < dep_i) %>%
group_by(ID, date_time_ID, date_time_ID_ref) %>%
summarise(CT_i_diff = sum(value_diff)/1000) %>%
ungroup()
iCT_total_temp <- iCT_total_temp %>%
arrange(date_time_ID) %>%
mutate(CT_i_cum = cumsum(CT_i_diff)) %>%
ungroup() %>%
mutate(sign = "total")
iCT_total_temp <- full_join(iCT_total_temp, iCT_grid_total) %>%
arrange(sign, date_time_ID) %>%
fill(CT_i_cum)
iCT_temp <- bind_rows(iCT_sign_temp, iCT_total_temp) %>%
mutate(dep_i = dep_i)
if (exists("iCT")) {
iCT <- bind_rows(iCT, iCT_temp)
} else {iCT <- iCT_temp}
rm(iCT_temp, iCT_sign_temp, iCT_total_temp)
}
rm(iCT_grid_sign, iCT_grid_total)
iCT <- iCT %>%
mutate(dep_i = as.factor(dep_i))
iCT %>%
ggplot()+
geom_point(data = cruise_dates, aes(date_time_ID, 0), shape=21)+
geom_col(aes(date_time_ID_ref, CT_i_diff, fill=dep_i),
position = "dodge", alpha=0.3)+
geom_line(aes(date_time_ID, CT_i_cum, col=dep_i))+
scale_color_viridis_d(name="Depth limit (m)")+
scale_fill_viridis_d(name="Depth limit (m)")+
labs(y="iCT [mol/m2]", x="")+
facet_grid(sign~., scales = "free_y", space = "free_y")+
theme_bw()
iCT_fixed_dep <- iCT
rm(iCT, dep_i)
# iCT %>%
# write_csv(here::here("Data/_merged_data_files", "iCT_dep_limits.csv"))
As an alternative to fixed depth levels, vertical integration as low as the mixed layer depth was tested.
Seawater density Rho was determined from S, T, and p according to TEOS-10.
ts_profiles <- ts_profiles %>%
mutate(rho = swSigma(salinity = sal, temperature = tem, pressure = dep/10))
ts_profiles_ID_mean_hydro <- ts_profiles %>%
select(-c(station,lat, lon, pCO2_raw, pCO2, CT, date_time)) %>%
group_by(ID, date_time_ID, date_ID, dep) %>%
summarise_all(list(mean), na.rm=TRUE) %>%
ungroup()
ts_profiles_ID_sd_hydro <- ts_profiles %>%
select(-c(station,lat, lon, pCO2_raw, pCO2, CT, date_time)) %>%
group_by(ID, date_time_ID, date_ID, dep) %>%
summarise_all(list(sd), na.rm=TRUE) %>%
ungroup()
ts_profiles_ID_sd_hydro_long <- ts_profiles_ID_sd_hydro %>%
pivot_longer(sal:rho, names_to = "var", values_to = "sd")
ts_profiles_ID_mean_hydro_long <- ts_profiles_ID_mean_hydro %>%
pivot_longer(sal:rho, names_to = "var", values_to = "value")
ts_profiles_ID_hydro_long <- inner_join(ts_profiles_ID_mean_hydro_long, ts_profiles_ID_sd_hydro_long)
ts_profiles_ID_hydro <- ts_profiles_ID_mean_hydro
rm(ts_profiles_ID_mean_hydro_long,
ts_profiles_ID_mean_hydro,
ts_profiles_ID_sd_hydro_long,
ts_profiles_ID_sd_hydro)
ts_profiles_ID_hydro_long %>%
ggplot(aes(value, dep, col=ID))+
geom_point()+
geom_path()+
scale_y_reverse()+
scale_color_viridis_d()+
facet_wrap(~var, scales = "free_x")
Mixed layer depth (MLD) was determined based on the difference between density at the surface and at depth, for a range of density criteria
# density criterion
ts_profiles_ID_hydro <- expand_grid(ts_profiles_ID_hydro, rho_lim = c(0.1,0.2,0.5))
MLD <- ts_profiles_ID_hydro %>%
arrange(dep) %>%
group_by(ID, date_time_ID, rho_lim) %>%
mutate(d_rho = rho - first(rho)) %>%
filter(d_rho > rho_lim) %>%
summarise(MLD = min(dep)) %>%
ungroup()
ts_profiles_ID_hydro <-
full_join(ts_profiles_ID_hydro, MLD)
ts_profiles_ID_hydro %>%
arrange(dep) %>%
ggplot(aes(rho, dep))+
geom_hline(aes(yintercept = MLD, col=as.factor(rho_lim)))+
geom_path()+
scale_y_reverse()+
scale_color_brewer(palette = "Set1", name= "Rho limit")+
facet_wrap(~ID)+
theme_bw()
MLD %>%
ggplot(aes(date_time_ID, MLD, col=as.factor(rho_lim)))+
geom_hline(yintercept = 0)+
geom_point()+
geom_path()+
scale_color_brewer(palette = "Set1", name= "Rho limit")+
scale_y_reverse()+
labs(x="")
# iCT_grid_sign <- ts_profiles_ID_long %>%
# select(ID, date_time_ID, date_time_ID_ref) %>%
# unique() %>%
# expand_grid(sign = c("pos", "neg"))
#
# iCT_grid_total <- ts_profiles_ID_long %>%
# select(ID, date_time_ID, date_time_ID_ref) %>%
# unique() %>%
# expand_grid(sign = c("total"))
iCT <- ts_profiles_ID_long %>%
filter(var == "CT")
iCT <- full_join(iCT, MLD)
iCT %>%
write_csv(here::here("Data/_merged_data_files", "ts_profiles_ID_long_cum_MLD.csv"))
iCT <- iCT %>%
filter(dep <= MLD)
iCT <- iCT %>%
group_by(ID, date_time_ID, date_time_ID_ref, rho_lim) %>%
summarise(CT_i_diff = sum(value_diff)/1000) %>%
ungroup()
iCT <- iCT %>%
group_by(rho_lim) %>%
arrange(date_time_ID) %>%
mutate(CT_i_cum = cumsum(CT_i_diff)) %>%
ungroup()
# iCT_total_temp <- full_join(iCT_total_temp, iCT_grid_total) %>%
# arrange(sign, date_time_ID) %>%
# fill(CT_i_cum)
iCT <- iCT %>%
mutate(rho_lim = as.factor(rho_lim))
iCT %>%
ggplot()+
geom_point(data = cruise_dates, aes(date_time_ID, 0), shape=21)+
geom_col(aes(date_time_ID_ref, CT_i_diff, fill=rho_lim),
position = "dodge", alpha=0.3)+
geom_line(aes(date_time_ID, CT_i_cum, col=rho_lim))+
scale_color_viridis_d(name="Rho limit")+
scale_fill_viridis_d(name="Rho limit")+
labs(y="iCT [mol/m2]", x="")+
#facet_grid(sign~., scales = "free_y", space = "free_y")+
theme_bw()
iCT_MLD <- iCT
rm(iCT, MLD)
# iCT %>%
# write_csv(here::here("Data/_merged_data_files", "iCT_dep_limits.csv"))
In the following, all cummulative iCT trajectories are displayed. Highlighted are those obtained for the fixed depth approach with 10 m limit, and the MLD approach with a high density threshold of 0.5 kg/m3.
iCT <- full_join(iCT_fixed_dep, iCT_MLD)
iCT <- iCT %>%
mutate(group = paste(as.character(sign), as.character(dep_i), as.character(rho_lim)))
iCT %>%
arrange(date_time_ID) %>%
ggplot()+
geom_hline(yintercept = 0)+
geom_point(data = cruise_dates, aes(date_time_ID, 0), shape=21)+
geom_line(aes(date_time_ID, CT_i_cum,
group=group), col="grey")+
geom_line(data = iCT_fixed_dep %>% filter(dep_i==12, sign=="total"),
aes(date_time_ID, CT_i_cum, col="12m - total"))+
geom_line(data = iCT_MLD %>% filter(rho_lim == 0.1),
aes(date_time_ID, CT_i_cum, col="MLD - 0.1"))+
scale_color_brewer(palette = "Set1", name="")+
labs(y="iCT [mol/m2]", x="")
rm(iCT, iCT_MLD)
In order to derive an estimate of the net community production NCP (which is equivalent to the formed organic matter that can be exported from the investigated surface layer), two steps are required:
The cummulative iCT trajectory determined by integration of CT to a fixed water depth of 10 m was used for NCP calculation for the following reasons:
ts_profiles_ID_long_180723 <- ts_profiles_ID_long %>%
filter(ID == 180723,
var == "CT")
p_ts_profiles_ID_long <- ts_profiles_ID_long_180723 %>%
arrange(dep) %>%
ggplot(aes(value_cum, dep))+
geom_vline(xintercept = 0)+
geom_hline(yintercept = 12, col="red")+
geom_point()+
geom_path()+
scale_y_reverse()+
labs(x="Cumulative change of CT on July 23 (180723)")+
theme(legend.position = "left")
ts_profiles_ID_long_180723_dep <- ts_profiles_ID_long_180723 %>%
select(dep, value_cum) %>%
filter(value_cum < 0) %>%
arrange(dep) %>%
mutate(value_cum_i = sum(value_cum),
value_cum_dep = cumsum(value_cum),
value_cum_i_rel = value_cum_dep/value_cum_i*100)
p_ts_profiles_ID_long_rel <- ts_profiles_ID_long_180723_dep %>%
ggplot(aes(value_cum_i_rel, dep))+
geom_hline(yintercept = 12, col="red")+
geom_vline(xintercept = 90)+
geom_point()+
geom_line()+
scale_y_reverse(limits = c(25,0))+
scale_x_continuous(breaks = seq(0,100,10))+
labs(y = "Depth (m)", x = "Relative contribution on July 23")+
theme_bw()
p_ts_profiles_ID_long + p_ts_profiles_ID_long_rel
rm(ts_profiles_ID_long_180723,
ts_profiles_ID_long_180723_dep,
p_ts_profiles_ID_long,
p_ts_profiles_ID_long_rel)
ts_profiles_ID_long_180723 <- ts_profiles_ID_long %>%
filter(ID == 180723,
var == "tem")
p_ts_profiles_ID_long <- ts_profiles_ID_long_180723 %>%
arrange(dep) %>%
ggplot(aes(value_cum, dep))+
geom_vline(xintercept = 0)+
geom_hline(yintercept = 12, col="red")+
geom_point()+
geom_path()+
scale_y_reverse()+
labs(x="Cumulative change of Temp on July 23")+
theme(legend.position = "left")
ts_profiles_ID_long_180723_dep <- ts_profiles_ID_long_180723 %>%
select(dep, value_cum) %>%
filter(value_cum > 0) %>%
arrange(dep) %>%
mutate(value_cum_i = sum(value_cum),
value_cum_dep = cumsum(value_cum),
value_cum_i_rel = value_cum_dep/value_cum_i*100)
p_ts_profiles_ID_long_rel <- ts_profiles_ID_long_180723_dep %>%
ggplot(aes(value_cum_i_rel, dep))+
geom_hline(yintercept = 12, col="red")+
geom_vline(xintercept = 90)+
geom_point()+
geom_line()+
scale_y_reverse(limits = c(25,0))+
scale_x_continuous(breaks = seq(0,100,10))+
labs(y = "Depth (m)", x = "Relative contribution on July 23")+
theme_bw()
p_ts_profiles_ID_long + p_ts_profiles_ID_long_rel
rm(ts_profiles_ID_long_180723,
ts_profiles_ID_long_180723_dep,
p_ts_profiles_ID_long,
p_ts_profiles_ID_long_rel)
The cruise mean pCO2 recorded in profiling-mode (stations only) and depths < 6m was used for gas exchange calcualtions.
ts_profiles_surface_long <- ts_profiles %>%
filter(dep < 6) %>%
select(date_time = date_time_ID, ID, tem, pCO2_water = pCO2, CT) %>%
pivot_longer(tem:CT, values_to = "value", names_to = "var")
ts_profiles_surface_long_ID <- ts_profiles_surface_long %>%
group_by(ID, date_time, var) %>%
summarise_all(list(~mean(.), ~sd(.), ~min(.), ~max(.))) %>%
ungroup()
p_pCO2_surf <- ts_profiles_surface_long_ID %>%
filter(var == "pCO2_water") %>%
ggplot(aes(x=date_time))+
geom_ribbon(aes(ymin=mean-sd, ymax=mean+sd), alpha=0.2)+
geom_path(aes(y=mean))+
geom_point(aes(y=mean))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(pCO[2],
(mu*atm))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_tem_surf <- ts_profiles_surface_long_ID %>%
filter(var == "tem") %>%
ggplot(aes(x=date_time))+
geom_ribbon(aes(ymin=mean-sd, ymax=mean+sd), alpha=0.2)+
geom_path(aes(y=mean))+
geom_point(aes(y=mean))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = "temperature \n (\u00B0C)")+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_CT_surf <- ts_profiles_surface_long_ID %>%
filter(var == "CT") %>%
ggplot(aes(x=date_time))+
geom_ribbon(aes(ymin=mean-sd, ymax=mean+sd), alpha=0.2)+
geom_path(aes(y=mean))+
geom_point(aes(y=mean))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(nC[T],
(mu*mol~kg^{-1}))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_pCO2_surf + p_tem_surf + p_CT_surf +
plot_layout(ncol = 1)
#rm(ts_profiles_surface)
start <- min(ts_profiles_surface_long_ID$date_time)
end <- max(ts_profiles_surface_long_ID$date_time)
Metrological data were recorded on the flux tower located on Ostergarnsholm island.
og <- read_delim(here::here("Data/Ostergarnsholm/Tower", "Oes_Jens_atm_water_June_to_August_2018.csv"),
delim = ";" )
og <- og %>%
mutate(date_time = ymd_hms( paste(paste(year, month, day, sep = "/"),
paste(hour, min, sec, sep = ":")))) %>%
select("date_time",
"CO2 12m [ppm]",
"w_c [ppm m/s]",
"WS 12m [m/s]",
"WD 12m [degrees]",
"T 12m [degrees C]",
"RIS [W/m^2]"
) %>%
filter(date_time > start,
date_time < end)
rm(end, start)
og <- og %>%
select(date_time, pCO2_atm = "CO2 12m [ppm]", wind = "WS 12m [m/s]")
Data sets for atmospheric and seawater observations were merged and interpolated to a common time stamp.
ts_profiles_surface_ID <- ts_profiles_surface_long_ID %>%
filter(var %in% c("pCO2_water", "tem")) %>%
select(date_time:mean) %>%
pivot_wider(names_from = "var", values_from = "mean")
ts_og <- full_join(og, ts_profiles_surface_ID) %>%
arrange(date_time)
ts_og <- ts_og %>%
mutate(pCO2_water = na.approx(pCO2_water, rule = 2),
tem = na.approx(tem, rule = 2),
wind = na.approx(wind, rule = 2)) %>%
filter(!is.na(pCO2_atm))
rm(ts_profiles_surface_ID, og)
ts_og_long <- ts_og %>%
pivot_longer("pCO2_atm":"tem",
names_to = "var",
values_to = "value")
p_pCO2_atm <- ts_og_long %>%
filter(var == "pCO2_atm") %>%
ggplot(aes(x=date_time))+
geom_path(aes(y=value))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(pCO["2,atm"],
(mu*atm))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_wind <- ts_og_long %>%
filter(var == "wind") %>%
ggplot(aes(x=date_time))+
geom_path(aes(y=value))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(windspeed,
(m~s^{-1}))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_pCO2_atm + p_wind +
plot_layout(ncol = 1)
F = k * dCO2
with
dCO2 = K0 * dpCO2 and
k = coeff * U^2 * (660/Sc)^0.5
Units used here are:
dpCO2: µatm
K0: mol atm-1 kg-1
dCO2: µmol kg-1
wind speed U: m s-1
coeff for k calculation (eg 0.251 in W14): cm hr-1 (m s-1)-2
gas transfer velocities k: cm hr-1 (= 6060100 m s-1)
air sea CO2 flux F: mol m–2 d–1
conversion between the unit of k * dCO2 and F requires a factor of 10-5 * 24
Sc_W14 <- function(tem) {
2116.8 - 136.25 * tem + 4.7353 * tem^2 - 0.092307 * tem^3 + 0.0007555 * tem^4
}
# Sc_W14(20)
ts_og <- ts_og %>%
mutate(dpCO2 = pCO2_water - pCO2_atm,
dCO2 = dpCO2 * K0(S=6.92, T=tem),
# W92 = gas_transfer(t = tem, u10 = wind, species = "CO2",
# method = "Wanninkhof1")* 60^2 * 100,
#k_SM18 = 0.24 * wind^2 * ((1943-119.6*tem + 3.488*tem^2 - 0.0417*tem^3) / 660)^(-0.5),
k = 0.251 * wind^2 * (Sc_W14(tem)/660)^(-0.5))
# pivot_longer(9:10, names_to = "k_para", values_to = "k_value")
# calculate flux F [mol m–2 d–1]
ts_og <- ts_og %>%
mutate(flux_daily = k*dCO2*1e-5*24)
rm(Sc_W14)
p_flux_daily <- ts_og %>%
ggplot(aes(x=date_time))+
geom_path(aes(y=flux_daily))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(flux[daily],
(mol~m^{-2}~d^{-1}))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
# scale flux to time interval
ts_og <- ts_og %>%
mutate(scale = 24*2) %>%
mutate(flux_scale = flux_daily / scale) %>%
#group_by(freq, k_para) %>%
arrange(date_time) %>%
mutate(flux_cum = cumsum(flux_scale)) %>%
ungroup()
p_flux_cum <- ts_og %>%
ggplot(aes(x=date_time))+
geom_path(aes(y=flux_cum))+
scale_fill_discrete(guide=FALSE)+
scale_x_datetime(date_breaks = "week",
sec.axis = dup_axis())+
labs(y = expression(atop(flux[cum],
(mol~m^{-2}))))+
theme(axis.title.x = element_blank(),
axis.text.x = element_blank())
p_pCO2_surf + p_tem_surf + p_CT_surf + p_pCO2_atm + p_wind + p_flux_daily + p_flux_cum +
plot_layout(ncol = 1)
The cumulative iCT time series obtained through integration across the upper 10m of the water column was used for further calculations of NCP.
Correction of iCT for air-sea CO2 fluxes will be based on estimates derived from observation with 30min measurement interval and calculation according to Wanninkhof (2014).
To derive an integrated NCP estimated, the observed change in iCT must be corrected for the air-sea flux of CO2. iCT was determined for the upper 10m of the water column. The MLD was always shallower 10m, except for the last cruise day. Therefore:
During the last cruise, deeper mixing up to 17m water depth was observed, resulting in increased CT values at 0-10 m and a decrease of CT in 10-17m. The loss of CT in 10-17m can be assumed to be entirely cause by mixing with low-CT surface water. Some CT loss is balanced through CT input attributable to the air-sea flux. Therefore, the observed loss, corrected for 7m/MLD-share of the air-sea-flux, was added to the integrated CT changes in 0-10m.
# extract CT data for fixed depth approach, depth limit 10m
iCT_10 <- iCT_fixed_dep %>%
filter(dep_i == 12, sign=="total") %>%
select(-c(sign, dep_i))
rm(iCT_fixed_dep)
iCT_10 <- iCT_10 %>%
select(ID, date_time = date_time_ID, date_time_ID_ref, CT_i_diff, CT_i_cum)
# date of the second last cruise
date_180806 <- unique(iCT_10$date_time)[7]
# calculate cumulative air-sea fluxes affecting 0-10m
ts_og_flux <- ts_og %>%
mutate(flux_scale = if_else(date_time > date_180806,
12/17 * flux_scale,
flux_scale)) %>%
arrange(date_time) %>%
mutate(flux_cum = cumsum(flux_scale)) %>%
select(date_time, flux_cum)
# calculate cumulative air-sea fluxes affecting 10-17m
ts_og_flux_dep <- ts_og %>%
filter(date_time > date_180806) %>%
mutate(flux_scale = 5/17 * flux_scale) %>%
arrange(date_time) %>%
mutate(flux_cum = cumsum(flux_scale)) %>%
select(date_time, flux_cum)
iCT_10_flux <- full_join(iCT_10, ts_og_flux) %>%
arrange(date_time)
rm(ts_og_flux, iCT_10, ts_og_long, ts_og)
# linear interpolation of cumulative changes to frequency of the flux estimates estimates
iCT_10_flux <- iCT_10_flux %>%
mutate(CT_i_cum = na.approx(CT_i_cum, rule = 2),
flux_cum = na.approx(flux_cum, rule = 2),
CT_i_flux_cum = CT_i_cum + flux_cum)
# calculate cumulative fluxes inbetween cruises
iCT_10_flux_diff <- iCT_10_flux %>%
filter(!is.na(date_time_ID_ref)) %>%
mutate(flux_diff = flux_cum - lag(flux_cum, default = 0)) %>%
select(date_time_ID_ref, observed=CT_i_diff, flux=flux_diff) %>%
pivot_longer(cols = 2:3, names_to = "var", values_to = "value_diff")
# calculate mixing with deep waters, corrected for air sea fluxes
iCT_10_mix <- ts_profiles_ID_long %>%
filter(ID == "180815",
var == "CT",
dep < 17,
dep > 12) %>%
group_by(ID, date_time_ID,
date_time_ID_ref) %>%
summarise(value_diff = sum(value_diff)/1000 + min(ts_og_flux_dep$flux_cum)) %>%
ungroup()
rm(ts_og_flux_dep)
iCT_10_mix_diff <- iCT_10_mix %>%
select(date_time_ID_ref, value_diff) %>%
mutate(var="mixing")
iCT_10_flux_mix_diff <-
full_join(iCT_10_flux_diff, iCT_10_mix_diff)
iCT_10_flux_mix <-
full_join(iCT_10_flux,
iCT_10_mix %>% rename(mix_cum = value_diff))
rm(iCT_10_mix, iCT_10_mix_diff, iCT_10_flux, iCT_10_flux_diff, date_180806)
iCT_10_flux_mix <- iCT_10_flux_mix %>%
arrange(date_time) %>%
fill(ID) %>%
mutate(mix_cum = if_else(ID %in% c("180806", 180815), mix_cum, 0),
mix_cum = na.approx(mix_cum),
CT_i_flux_mix_cum = CT_i_flux_cum + mix_cum)
p_iCT <- iCT_10_flux_mix %>%
arrange(date_time) %>%
ggplot()+
geom_col(data = iCT_10_flux_mix_diff,
aes(date_time_ID_ref, value_diff, fill=var),
position = position_dodge2(preserve = "single"),
alpha=0.5)+
geom_hline(yintercept = 0)+
geom_point(data = cruise_dates, aes(date_time_ID, 0), shape=21)+
geom_line(aes(date_time, CT_i_cum, col="observed"))+
geom_line(aes(date_time, CT_i_flux_mix_cum, col="mixing + flux corrected"))+
geom_line(aes(date_time, CT_i_flux_cum, col="flux corrected"))+
scale_x_datetime(date_breaks = "week",
date_labels = "%b %d",
sec.axis = dup_axis())+
scale_fill_brewer(palette = "Set1", name="incremental changes")+
scale_color_brewer(palette = "Set1", name="cumulative changes")+
labs(y=expression(atop(integrated~nC[T],
(mol~m^{-2}))))+
guides(guide_colourbar(order = 1))+
theme(axis.title.x = element_blank(),
axis.text.x.top = element_blank(),
legend.position = "bottom",
legend.direction = "vertical")
p_iCT
iCT_10_flux_mix %>%
write_csv(here::here("Data/_merged_data_files", "ts_NCP_cum.csv"))
iCT_10_flux_mix_diff %>%
write_csv(here::here("Data/_merged_data_files", "ts_NCP_inc.csv"))
p_pCO2_surf + p_tem_surf + p_CT_surf +
p_pCO2_atm + p_wind + p_flux_daily + p_flux_cum +
p_iCT +
plot_layout(ncol = 1,
heights = c(rep(1,7), 3))
ggsave(here::here("output/Plots/Figures_publication/article", "atm_water_timeseries.pdf"),
width = 120, height = 250, dpi = 300, units = "mm")
Should be identical for stored files and objectes in R environment
sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_Germany.1252 LC_CTYPE=English_Germany.1252
[3] LC_MONETARY=English_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=English_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] zoo_1.8-7 lubridate_1.7.4 scico_1.1.0 metR_0.6.0
[5] marelac_2.1.10 shape_1.4.4 seacarb_3.2.13 oce_1.2-0
[9] gsw_1.0-5 testthat_2.3.2 patchwork_1.0.0 forcats_0.5.0
[13] stringr_1.4.0 dplyr_0.8.5 purrr_0.3.3 readr_1.3.1
[17] tidyr_1.0.2 tibble_3.0.0 ggplot2_3.3.0 tidyverse_1.3.0
[21] workflowr_1.6.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4 whisker_0.4 knitr_1.28 xml2_1.3.0
[5] magrittr_1.5 hms_0.5.3 rvest_0.3.5 tidyselect_1.0.0
[9] viridisLite_0.3.0 here_0.1 colorspace_1.4-1 lattice_0.20-41
[13] R6_2.4.1 rlang_0.4.5 fansi_0.4.1 broom_0.5.5
[17] xfun_0.12 dbplyr_1.4.2 modelr_0.1.6 withr_2.1.2
[21] git2r_0.26.1 ellipsis_0.3.0 htmltools_0.4.0 assertthat_0.2.1
[25] rprojroot_1.3-2 digest_0.6.25 lifecycle_0.2.0 haven_2.2.0
[29] rmarkdown_2.1 sp_1.4-1 compiler_3.6.3 cellranger_1.1.0
[33] pillar_1.4.3 scales_1.1.0 backports_1.1.5 generics_0.0.2
[37] jsonlite_1.6.1 httpuv_1.5.2 pkgconfig_2.0.3 rstudioapi_0.11
[41] munsell_0.5.0 plyr_1.8.6 highr_0.8 httr_1.4.1
[45] tools_3.6.3 grid_3.6.3 nlme_3.1-145 data.table_1.12.8
[49] gtable_0.3.0 checkmate_2.0.0 DBI_1.1.0 cli_2.0.2
[53] readxl_1.3.1 yaml_2.2.1 crayon_1.3.4 farver_2.0.3
[57] RColorBrewer_1.1-2 later_1.0.0 promises_1.1.0 fs_1.4.0
[61] vctrs_0.2.4 memoise_1.1.0 glue_1.3.2 evaluate_0.14
[65] labeling_0.3 reprex_0.3.0 stringi_1.4.6