Last updated: 2020-03-30
Checks: 7 0
Knit directory: BloomSail/
This reproducible R Markdown analysis was created with workflowr (version 1.6.0). 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 version displayed above was the version of the Git repository at the time these results were generated.
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/
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.
There are no past versions. Publish this analysis with wflow_publish()
to start tracking its development.
library(tidyverse)
library(seacarb)
library(oce)
library(marelac)
library(patchwork)
In order to test how (and how well) the depth-integrated NCP estimates can be reproduced if only surface CO2 data were available, the BloomSail observations were restricted to those made in surface water and two reconstruction approaches were tested:
1m gridded, downcast profiles were used.
ts_profiles_ID <-
read_csv(here::here("Data/_merged_data_files", "ts_profiles_ID_long_cum_MLD.csv"))
ts_profiles_ID <- ts_profiles_ID %>%
select(ID, date_time_ID, dep, CT = value, CT_diff = value_diff, CT_cum = value_cum, sign, rho_lim, MLD)
ts_profiles_ID <- ts_profiles_ID %>%
mutate(CT = if_else(dep == 3.5, CT, NaN),
rho_lim = as.factor(rho_lim))
MLD calculation was previously described in the CT dynamics chapter.
For comparison to MLD, the effective penetration depth of NCP, zeff, was calculated as the ratio of the inremental, depth-integrated change of CT, divided by the change in surface CT, for all cases where the change in surface CT was negative.
ts_profiles_ID_surface <- ts_profiles_ID %>%
filter(sign=="neg",
rho_lim == "0.5",
dep == 3.5) %>%
group_by(ID, date_time_ID) %>%
summarise(CT_diff_surf = mean(CT_diff, na.rm = TRUE)) %>%
ungroup()
ts_profiles_ID_i <- ts_profiles_ID %>%
filter(sign=="neg",
rho_lim == "0.5") %>%
group_by(ID, date_time_ID) %>%
summarise(CT_diff_i = sum(CT_diff, na.rm = TRUE))
zeff <- inner_join(ts_profiles_ID_surface, ts_profiles_ID_i)
rm(ts_profiles_ID_surface, ts_profiles_ID_i)
zeff <- zeff %>%
mutate(zeff = CT_diff_i / CT_diff_surf)
ts_profiles_ID %>%
ggplot()+
geom_hline(yintercept = 0)+
geom_line(data = zeff, aes(date_time_ID, zeff, linetype="zeff"))+
geom_line(aes(date_time_ID, MLD, col=rho_lim, linetype="MLD"))+
scale_y_reverse()+
scale_color_viridis_d(name="Rho limit")+
scale_linetype(name="Estimate")+
labs(y="Depth (m)")+
theme(axis.title.x = element_blank())
rm(zeff)
Integrated CT depletion was calculated as the product of observed incremental CT changes in surface waters and the respective mixed layer depth.
ts_profiles_ID_surface <- ts_profiles_ID %>%
filter(dep==3.5) %>%
group_by(rho_lim) %>%
arrange(date_time_ID) %>%
mutate(iCT_diff = CT_diff * MLD / 1000,
iCT_cum = cumsum(replace_na(iCT_diff, 0))) %>%
ungroup()
Total incremental and cumulative CT changes inbetween cruise dates were calculated.
p_iCT <- ts_profiles_ID_surface %>%
ggplot(aes(date_time_ID, iCT_diff, fill= rho_lim))+
geom_hline(yintercept = 0)+
geom_col(col="black", position = "dodge")+
scale_y_continuous(breaks = seq(-100, 100, 0.2))+
scale_fill_viridis_d()+
labs(y="integrated CT changes [mol/m2]")+
theme(axis.title.x = element_blank())
p_iCT_cum <- ts_profiles_ID_surface %>%
ggplot(aes(date_time_ID, iCT_cum,
col=rho_lim))+
geom_line()+
geom_hline(yintercept = 0)+
scale_color_viridis_d()+
scale_y_continuous(breaks = seq(-100, 100, 0.2))+
theme(strip.background = element_blank(),
strip.text = element_blank())+
labs(y="integrated, cumulative CT changes [mol/m2]", x="date")
(p_iCT / p_iCT_cum)+
plot_layout(guides = 'collect')
rm(p_iCT, p_iCT_cum)
sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] patchwork_1.0.0 marelac_2.1.9 shape_1.4.4 seacarb_3.2.12
[5] oce_1.2-0 gsw_1.0-5 testthat_2.3.1 forcats_0.4.0
[9] stringr_1.4.0 dplyr_0.8.3 purrr_0.3.3 readr_1.3.1
[13] tidyr_1.0.0 tibble_2.1.3 ggplot2_3.3.0 tidyverse_1.3.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.2 lubridate_1.7.4 here_0.1 lattice_0.20-35
[5] assertthat_0.2.1 zeallot_0.1.0 rprojroot_1.3-2 digest_0.6.22
[9] R6_2.4.0 cellranger_1.1.0 backports_1.1.5 reprex_0.3.0
[13] evaluate_0.14 httr_1.4.1 pillar_1.4.2 rlang_0.4.5
[17] readxl_1.3.1 rstudioapi_0.10 rmarkdown_2.0 labeling_0.3
[21] munsell_0.5.0 broom_0.5.3 compiler_3.5.0 httpuv_1.5.2
[25] modelr_0.1.5 xfun_0.10 pkgconfig_2.0.3 htmltools_0.4.0
[29] tidyselect_0.2.5 workflowr_1.6.0 viridisLite_0.3.0 crayon_1.3.4
[33] dbplyr_1.4.2 withr_2.1.2 later_1.0.0 grid_3.5.0
[37] nlme_3.1-137 jsonlite_1.6 gtable_0.3.0 lifecycle_0.1.0
[41] DBI_1.0.0 git2r_0.26.1 magrittr_1.5 scales_1.0.0
[45] cli_1.1.0 stringi_1.4.3 fs_1.3.1 promises_1.1.0
[49] xml2_1.2.2 ellipsis_0.3.0 generics_0.0.2 vctrs_0.2.0
[53] tools_3.5.0 glue_1.3.1 hms_0.5.2 yaml_2.2.0
[57] colorspace_1.4-1 rvest_0.3.5 knitr_1.26 haven_2.2.0