Last updated: 2020-07-14

Checks: 7 0

Knit directory: Cant_eMLR/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20200707) 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 6c00cf0. 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:    .Rproj.user/
    Ignored:    data/GLODAPv2_2020/
    Ignored:    data/World_Ocean_Atlas_2018/
    Ignored:    data/pCO2_atmosphere/
    Ignored:    dump/
    Ignored:    output/plots/

Unstaged changes:
    Deleted:    analysis/data_base.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/eMLR.Rmd) and HTML (docs/eMLR.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 1c511ce jens-daniel-mueller 2020-07-14 Build site.
Rmd e03016e jens-daniel-mueller 2020-07-14 split read in per data set
html 45ed0ea jens-daniel-mueller 2020-07-14 Build site.
Rmd dc1c56e jens-daniel-mueller 2020-07-14 tref calculated
html b1ece68 jens-daniel-mueller 2020-07-13 Build site.
Rmd 8eb1b22 jens-daniel-mueller 2020-07-13 cleaned data base file
Rmd 9e8f7f1 jens-daniel-mueller 2020-07-13 untracked changes
html 79312b2 jens-daniel-mueller 2020-07-13 Build site.
Rmd ffbc2a1 jens-daniel-mueller 2020-07-13 added Cstar calculation
html 090cfeb jens-daniel-mueller 2020-07-13 Build site.
Rmd e6a2ade jens-daniel-mueller 2020-07-13 added Cstar calculation

library(tidyverse)
library(lubridate)
library(patchwork)

1 Open clean data set

GLODAP <- read_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
                              "GLODAPv2.2020_clean.csv"))

2 C* calculation

rCP <- 117
rNP <- 16
GLODAP <- GLODAP %>% 
  mutate(C_star = tco2 - (rCP * phosphate) - 0.5 * (talk + rNP * phosphate))

2.1 Selected section plots

cruises_meridional <- c("1041")

# cruises_meridional <- c("1041","1042", "260",
#                         "2011", "393", "1031", "394", "395",
#                         "1088", "983")

# cruises_zonal <- c()

GLODAP_cruise <- GLODAP %>% 
  filter(cruise %in% cruises_meridional)
mapWorld <- borders("world", colour="gray60", fill="gray60")

map <- GLODAP_cruise %>%
  ggplot(aes(longitude, latitude))+
  mapWorld+
  geom_point(aes(col=date))+
  geom_path()+
  coord_quickmap(expand = FALSE)+
  scale_color_viridis_c(trans = "date")

lat_section <- GLODAP_cruise %>%
  ggplot(aes(latitude, depth))+
  scale_y_reverse()+
  scale_color_viridis_c()

lat_tco2 <- lat_section+
  geom_point(aes(col=tco2))

lat_talk <- lat_section+
  geom_point(aes(col=talk))

lat_phosphate <- lat_section+
  geom_point(aes(col=phosphate))

lat_C_star <- lat_section+
  geom_point(aes(col=C_star))

map / lat_tco2 / lat_talk / lat_phosphate / lat_C_star

rm(map, lat_tco2, lat_talk, lat_phosphate, lat_C_star)

3 Reference year adjustment

The scaling factor Cant_apriori at a given location and depth was estimated for each reference year from XXX. Note that eq. 6 in Clement and Gruber (2018) misses pCO2 pre-industrial in the denominator.

GLODAP <- GLODAP %>% 
  mutate(C_star_ref = C_star - 
           ( (pCO2_atm(year) - pCO2_atm(year_ref)) / 
               (pCO2_atm(year_ref) - pCO2_atm(year_pi) ) * Cant_ref)

4 MLR fitting

temperature
salinity
phosphate
silicate
phosphate_star = phosphate + (oxygen / 170) - 1.95
oxygen
aou
basins <- c("Atlantic", "Indo_Pacific")
slabs <- c("")

for (i_basin in basins) {
  for (i_slab in slabs) {
    
    
  }
  
}

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] patchwork_1.0.1 lubridate_1.7.9 forcats_0.5.0   stringr_1.4.0  
 [5] dplyr_1.0.0     purrr_0.3.4     readr_1.3.1     tidyr_1.1.0    
 [9] tibble_3.0.3    ggplot2_3.3.2   tidyverse_1.3.0 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] jsonlite_1.7.0    rstudioapi_0.11   generics_0.0.2    magrittr_1.5     
 [5] farver_2.0.3      gtable_0.3.0      rmarkdown_2.3     vctrs_0.3.1      
 [9] fs_1.4.2          hms_0.5.3         xml2_1.3.2        pillar_1.4.6     
[13] htmltools_0.5.0   haven_2.3.1       later_1.1.0.1     broom_0.7.0      
[17] cellranger_1.1.0  tidyselect_1.1.0  knitr_1.29        git2r_0.27.1     
[21] whisker_0.4       lifecycle_0.2.0   pkgconfig_2.0.3   R6_2.4.1         
[25] digest_0.6.25     xfun_0.15         colorspace_1.4-1  rprojroot_1.3-2  
[29] stringi_1.4.6     yaml_2.2.1        evaluate_0.14     labeling_0.3     
[33] fansi_0.4.1       httr_1.4.1        compiler_3.6.3    here_0.1         
[37] cli_2.0.2         withr_2.2.0       backports_1.1.5   munsell_0.5.0    
[41] DBI_1.1.0         modelr_0.1.8      Rcpp_1.0.5        readxl_1.3.1     
[45] dbplyr_1.4.4      maps_3.3.0        ellipsis_0.3.1    assertthat_0.2.1 
[49] blob_1.2.1        tools_3.6.3       reprex_0.3.0      viridisLite_0.3.0
[53] httpuv_1.5.4      scales_1.1.1      crayon_1.3.4      glue_1.4.1       
[57] rlang_0.4.7       rvest_0.3.5       promises_1.1.1    grid_3.6.3