Last updated: 2020-04-27

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 f73f073. 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/

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/BloomSail_surface.Rmd) and HTML (docs/BloomSail_surface.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
Rmd f73f073 jens-daniel-mueller 2020-04-27 removed Date-ID column causing error
html 472c2b4 jens-daniel-mueller 2020-04-21 Build site.
Rmd a82b4fe jens-daniel-mueller 2020-04-21 try rebuild all html
html f8fcf50 jens-daniel-mueller 2020-04-19 created pub figures for time series
html dc275fe jens-daniel-mueller 2020-04-14 Build site.
Rmd 2e7d3a5 jens-daniel-mueller 2020-04-14 temperature penetration depth eval TRUE
html 87658c3 jens-daniel-mueller 2020-04-14 Build site.
Rmd 5c96a65 jens-daniel-mueller 2020-04-14 temperature penetration depth
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 1465fb5 jens-daniel-mueller 2020-03-31 Build site.
Rmd 2ebefdf jens-daniel-mueller 2020-03-31 Finalized Baltic surface reconstruction
html 6302994 jens-daniel-mueller 2020-03-31 Build site.
Rmd 50ab313 jens-daniel-mueller 2020-03-31 implemented temperature reconstruction
html ce0f1cf jens-daniel-mueller 2020-03-30 Build site.
Rmd c2d1b89 jens-daniel-mueller 2020-03-30 activated chunks
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
Rmd a135643 jens-daniel-mueller 2020-03-20 renamed
html a025f62 jens-daniel-mueller 2020-03-20 Build site.
Rmd 39c69a3 jens-daniel-mueller 2020-03-20 knit BloomSail surface

library(tidyverse)
library(seacarb)
library(oce)
library(marelac)
library(patchwork)
library(metR)

1 Approach

In order to test how (and how well) the depth-integrated CT 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:

  1. MLD: Integration of surface observation across the MLD, assuming homogenious vertical patterns
  2. Temperature: Vertical reconstruction of incremental CT changes based on profiles of incremental changes in temperature

2 Sensor data

1m gridded, downcast profiles, from which CO2 data other than 3.5 m water depth were removed, 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))

3 MLD approach

MLD calculation was previously described in the CT dynamics chapter.

3.1 Timeseries

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)

3.2 iCT calculation

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()

3.3 Incremental and cumulative timeseries

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)

rm(ts_profiles_ID, ts_profiles_ID_surface)

4 Temperature approach

ts_profiles_ID <-
  read_csv(here::here("Data/_merged_data_files", "ts_profiles_ID.csv"))

ts_profiles_ID <- ts_profiles_ID %>% 
  mutate(CT = if_else(dep == 3.5, CT, NaN),
         ID = as.factor(ID)) %>% 
  select(-date_ID)

4.1 CT vs temperature

As primary production (negative changes in CT) and increase in seawater temperature have a common driver (light), the relation between both changes was investigated.

ts_profiles_ID_diff <- ts_profiles_ID %>% 
  drop_na() %>% 
  arrange(date_time_ID) %>%
  mutate(CT_diff = CT - lag(CT, default = first(CT)),
         tem_diff = tem - lag(tem, default = first(tem)),
         factor = CT_diff / tem_diff,
         factor = if_else(is.na(factor), 0, factor))

ts_profiles_ID_diff %>% 
  ggplot(aes(tem_diff, CT_diff))+
  geom_hline(yintercept = 0)+
  geom_vline(xintercept = 0)+
  geom_path()+
  geom_point()

4.2 Reconstruction of CT dynamics

The ratio of the incremental change of CT with temperature at the seasurface was applied to calculate the CT in other water depth based on the known change in temperature.

ts_profiles_ID_diff <- ts_profiles_ID_diff %>% 
  select(ID, factor)

ts_profiles_ID <- full_join(ts_profiles_ID, ts_profiles_ID_diff)
rm(ts_profiles_ID_diff)

ts_profiles_ID <- ts_profiles_ID %>%
  arrange(date_time_ID) %>%
  group_by(dep) %>% 
  mutate(tem_diff = tem - lag(tem, default = first(tem))) %>% 
  ungroup()

ts_profiles_ID <- ts_profiles_ID %>% 
  mutate(CT_diff = tem_diff * factor) %>% 
  select(-factor)

The reconstructed incremental changes are added up to derive cummulative CT changes throughout the water column.

ts_profiles_ID_long <- ts_profiles_ID %>% 
  select(ID, date_time_ID, dep, tem = tem_diff, CT = CT_diff) %>% 
  pivot_longer(4:5, names_to = "var", values_to = "value_diff") %>% 
  group_by(dep, var) %>% 
  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_daily = value_diff / date_time_ID_diff,
         value_cum = cumsum(value_diff)) %>% 
  ungroup()

4.3 Profiles of incremental changes

Changes of seawater parameters at each depth were reconstructed from one cruise day to the next and divided by the number of days inbetween.

ts_profiles_ID_long %>% 
  arrange(dep) %>% 
  ggplot(aes(value_diff, 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")

4.4 Profiles of cumulative changes

Cumulative changes of seawater parameters 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()+
  labs(x="Cumulative change of value")+
  facet_wrap(~var, scales = "free_x")

4.5 Hovmoeller plots

Hoevmoeller plots were generated for the reconstructed daily and cumulative changes in CT. Absolute values are not reproducible with this approach. Furthermore, it meets our expectations

4.5.1 Daily changes

bin_CT <- 2.5

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())

rm(bin_CT)

4.5.2 Cumulative changes

bin_CT <- 20

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())


rm(bin_CT)

4.6 Heat penetration depth

As an alternative approach to the integration over the MLD or the reconstruction of CT profiles, we can estimate the mean penetration depth of the warming signal, which was defined the surface change in temperature devided by the integrated change in seawater temperature across depth.

tem_diff_surface <- ts_profiles_ID %>% 
  filter(dep == 3.5) %>% 
  select(ID, tem_diff_surface=tem_diff)

ts_profiles_ID <- full_join(ts_profiles_ID, tem_diff_surface) 
rm(tem_diff_surface)

tem_depth <- ts_profiles_ID %>%
  filter(dep < 18) %>% 
  group_by(ID, date_time_ID) %>% 
  summarise(tem_diff_int = sum(tem_diff),
            tem_diff_surface = mean(tem_diff_surface),
            tem_depth = tem_diff_int/tem_diff_surface) %>% 
  ungroup()

tem_depth %>% 
  ggplot(aes(date_time_ID, tem_depth))+
  geom_hline(yintercept = 0)+
  geom_line()+
  geom_point()+
  scale_y_reverse()

4.7 iCT time series

Total incremental and cumulative CT changes inbetween cruise dates were calculated for the upper 10 m of the water body.

iCT_10 <- ts_profiles_ID_long %>%
  filter(dep < 10, 
         var == "CT") %>% 
  select(ID, date_time_ID, date_time_ID_ref, CT_diff=value_diff, CT_cum=value_cum) %>% 
  group_by(ID, date_time_ID, date_time_ID_ref) %>% 
  summarise(CT_i_diff = sum(CT_diff)/1000,
            CT_i_cum = sum(CT_cum)/1000) %>% 
  ungroup()

iCT_10 %>% 
  ggplot()+
  #geom_point(data = cruise_dates, aes(date_time_ID, 0), shape=21)+
  geom_col(aes(date_time_ID_ref, CT_i_diff),
           position = "dodge", alpha=0.3)+
  geom_line(aes(date_time_ID, CT_i_cum))+
  scale_color_viridis_d(name="Depth limit (m)")+
  scale_fill_viridis_d(name="Depth limit (m)")+
  labs(y="iCT [mol/m2]", x="")+
  theme_bw()


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] metR_0.6.0      patchwork_1.0.0 marelac_2.1.10  shape_1.4.4    
 [5] seacarb_3.2.13  oce_1.2-0       gsw_1.0-5       testthat_2.3.2 
 [9] forcats_0.5.0   stringr_1.4.0   dplyr_0.8.5     purrr_0.3.3    
[13] readr_1.3.1     tidyr_1.0.2     tibble_3.0.0    ggplot2_3.3.0  
[17] tidyverse_1.3.0 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     compiler_3.6.3    cellranger_1.1.0  pillar_1.4.3     
[33] scales_1.1.0      backports_1.1.5   generics_0.0.2    lubridate_1.7.4  
[37] jsonlite_1.6.1    httpuv_1.5.2      pkgconfig_2.0.3   rstudioapi_0.11  
[41] munsell_0.5.0     httr_1.4.1        tools_3.6.3       grid_3.6.3       
[45] nlme_3.1-145      data.table_1.12.8 gtable_0.3.0      checkmate_2.0.0  
[49] DBI_1.1.0         cli_2.0.2         readxl_1.3.1      yaml_2.2.1       
[53] crayon_1.3.4      farver_2.0.3      later_1.0.0       promises_1.1.0   
[57] fs_1.4.0          vctrs_0.2.4       glue_1.3.2        evaluate_0.14    
[61] labeling_0.3      reprex_0.3.0      stringi_1.4.6