Last updated: 2020-10-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 789039c. 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/GLODAPv1_1/
    Ignored:    data/GLODAPv2_2016b_MappedClimatologies/
    Ignored:    data/GLODAPv2_2020/
    Ignored:    data/Gruber_2019/
    Ignored:    data/WOCE/
    Ignored:    data/World_Ocean_Atlas_2013_Clement/
    Ignored:    data/World_Ocean_Atlas_2018/
    Ignored:    data/eMLR/
    Ignored:    data/mapping/
    Ignored:    data/pCO2_atmosphere/
    Ignored:    dump/

Untracked files:
    Untracked:  code/globe_3d.R

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/analysis_this_study_3d.Rmd) and HTML (docs/analysis_this_study_3d.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 789039c jens-daniel-mueller 2020-10-14 JGOFS-GO only
html 20211d1 jens-daniel-mueller 2020-10-14 Build site.
Rmd a49c6a6 jens-daniel-mueller 2020-10-14 JGOFS-GO only
html 411a35b jens-daniel-mueller 2020-10-02 Build site.
html 16dd185 jens-daniel-mueller 2020-10-01 Build site.
Rmd 2517e2d jens-daniel-mueller 2020-10-01 seperate globe rmd
html 35e9f38 jens-daniel-mueller 2020-10-01 Build site.
Rmd 64e261a jens-daniel-mueller 2020-10-01 seperate globe rmd
html 0d38979 jens-daniel-mueller 2020-10-01 Build site.
Rmd 7d351db jens-daniel-mueller 2020-10-01 sep globe 3d rmd

library(tidyverse)
library(patchwork)
library(scico)
library(scales)
library(metR)
library(marelac)
library(kableExtra)
library(threejs)

1 Data sources

Cant estimates from this study:

  • Inventories (lat, lon)
Cant_inv <-
  read_csv(here::here("data/mapping/_summarized_files",
                         "Cant_inv.csv"))

2 Color scale

For ease of comparison with Gruber et al (2019) we adapt their color scale, including the ranges and breaks applied in various types of visualizations.

rgb2hex <- function(r, g, b)
  rgb(r, g, b, maxColorValue = 100)

cols = c(rgb2hex(95, 95, 95),
         rgb2hex(0, 0, 95),
         rgb2hex(100, 0, 0),
         rgb2hex(100, 100, 0))

Gruber_rainbow <- colorRampPalette(cols)

rm(rgb2hex, cols)

3 Cant - positive

In a first series of plots we explore the distribution of Cant, taking only positive estimates into account (positive here refers to the mean Cant estimate across 10 eMLR model predictions available for each grid cell). Negative values were set to zero before calculating mean sections and inventories.

3.1 Inventory

3.1.1 Map

Column inventory of positive Cant between the surface and 3000m water depth per horizontal grid cell (lat x lon).

breaks <- c(seq(0,16,2),Inf)
breaks_n <- length(breaks) - 1

Cant_inv <- Cant_inv %>% 
  mutate(cant_inv_pos_int = cut(cant_inv_pos, 
                                breaks,
                                right = FALSE)) %>% 
  mutate(eras = factor(eras, c("JGOFS_GO", "GO_new")))

Cant_inv %>%
  filter(eras == "JGOFS_GO") %>%
  ggplot() +
  geom_raster(data = landmask,
              aes(lon, lat), fill = "grey30") +
  geom_raster(aes(lon, lat, fill = cant_inv_pos_int)) +
  coord_quickmap(expand = 0) +
  scale_fill_manual(values = Gruber_rainbow(breaks_n),
                    name = "Cant") +
  theme(axis.title = element_blank(),
        axis.ticks = element_blank(),
        axis.text = element_blank(),
        legend.position = "bottom")

3.1.2 Interactive Globe

x <- Cant_inv %>%
  filter(eras == "JGOFS_GO") %>%
  select(lon, lat, cant_inv_pos) %>%
  mutate(cant_col = as.character(cut(
    cant_inv_pos,
    breaks,
    Gruber_rainbow(breaks_n)
  )))


globejs(
  lat = x$lat,
  long = x$lon,
  color = x$cant_col,
  val = 0,
  pointsize = 2,
  bg = "white",
  rotationlong = -0.8,
  rotationlat = 0.3
)
rm(x)

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-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] threejs_0.3.3    igraph_1.2.5     kableExtra_1.1.0 marelac_2.1.10  
 [5] shape_1.4.4      metR_0.7.0       scales_1.1.1     scico_1.2.0     
 [9] patchwork_1.0.1  forcats_0.5.0    stringr_1.4.0    dplyr_1.0.0     
[13] purrr_0.3.4      readr_1.3.1      tidyr_1.1.0      tibble_3.0.3    
[17] ggplot2_3.3.2    tidyverse_1.3.0  workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] httr_1.4.2        jsonlite_1.7.0    viridisLite_0.3.0 here_0.1         
 [5] modelr_0.1.8      assertthat_0.2.1  blob_1.2.1        cellranger_1.1.0 
 [9] yaml_2.2.1        pillar_1.4.6      backports_1.1.8   glue_1.4.1       
[13] digest_0.6.25     promises_1.1.1    checkmate_2.0.0   rvest_0.3.6      
[17] colorspace_1.4-1  htmltools_0.5.0   httpuv_1.5.4      pkgconfig_2.0.3  
[21] broom_0.7.0       seacarb_3.2.13    haven_2.3.1       webshot_0.5.2    
[25] whisker_0.4       later_1.1.0.1     git2r_0.27.1      farver_2.0.3     
[29] generics_0.0.2    ellipsis_0.3.1    withr_2.2.0       cli_2.0.2        
[33] magrittr_1.5      crayon_1.3.4      readxl_1.3.1      evaluate_0.14    
[37] fs_1.4.2          fansi_0.4.1       xml2_1.3.2        oce_1.2-0        
[41] tools_4.0.2       data.table_1.13.0 hms_0.5.3         lifecycle_0.2.0  
[45] munsell_0.5.0     reprex_0.3.0      gsw_1.0-5         compiler_4.0.2   
[49] rlang_0.4.7       grid_4.0.2        rstudioapi_0.11   htmlwidgets_1.5.1
[53] crosstalk_1.1.0.1 labeling_0.3      base64enc_0.1-3   rmarkdown_2.3    
[57] testthat_2.3.2    gtable_0.3.0      DBI_1.1.0         R6_2.4.1         
[61] lubridate_1.7.9   knitr_1.30        rprojroot_1.3-2   stringi_1.4.6    
[65] Rcpp_1.0.5        vctrs_0.3.2       dbplyr_1.4.4      tidyselect_1.1.0 
[69] xfun_0.16