Last updated: 2021-10-06

Checks: 7 0

Knit directory: emlr_obs_analysis/

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(20210412) 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 277e227. 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/
    Ignored:    output/Gruber_2019_comparison/
    Ignored:    output/publication/

Untracked files:
    Untracked:  code/classic_slab_inventories.Rmd

Unstaged changes:
    Modified:   analysis/_site.yml
    Modified:   code/Workflowr_project_managment.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/basics.Rmd) and HTML (docs/basics.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 f9b4f93 jens-daniel-mueller 2021-10-05 Build site.
html ae93565 jens-daniel-mueller 2021-09-29 Build site.
Rmd c5eb521 jens-daniel-mueller 2021-09-29 coverage maps added
html 960d158 jens-daniel-mueller 2021-09-29 Build site.
html 0573621 jens-daniel-mueller 2021-09-29 Build site.
Rmd f5cf35e jens-daniel-mueller 2021-09-29 rebuildt with vif results

1 Read files

GLODAP_preprocessed <-
  read_csv(
    paste(
      path_preprocessing,
      "GLODAPv2.2021_preprocessed.csv",
      sep = ""
    )
  )

2 Time series histogram

map +
  geom_raster(data = GLODAP_preprocessed %>% 
                filter(year %in% c(2013, 2014),
                       cruise < 2000,
                       lon > 300,
                       lon < 350) %>% 
                count(lat, lon, cruise),
              aes(lon, lat, fill = as.factor(cruise))) +
  scale_fill_brewer(palette = "Set1")

Version Author Date
0573621 jens-daniel-mueller 2021-09-29
time_histo <- GLODAP_preprocessed %>% 
  drop_na() %>% 
  mutate(version = if_else(cruise <1000, "Gruber et al. (2019)", 
                           "Data added"),
         version = if_else(cruise %in% c(1041, 1042), "Gruber et al. (2019)", version)) %>% 
  count(year, version)

GLODAP_preprocessed %>% 
  drop_na() %>% 
  mutate(version = if_else(cruise <1000, "Gruber et al. (2019)", 
                           "Data added"),
         version = if_else(cruise %in% c(1041, 1042), "Gruber et al. (2019)", version)) %>% 
  count(version)
# A tibble: 2 × 2
  version                   n
  <chr>                 <int>
1 Data added            94402
2 Gruber et al. (2019) 221038
p_time_histo_G19 <-
  time_histo %>%
  filter(version == "Gruber et al. (2019)") %>% 
  ggplot() +
  geom_col(aes(year, n, fill = version),
           col = "grey20") +
  scale_fill_manual(values = c("grey70"),
                    name = "") +
  scale_x_continuous(breaks = seq(1900, 2100, 5),
                     limits = c(1981, 2020)) +
  scale_y_continuous(limits = c(0, max(time_histo$n) + 500)) +
  coord_cartesian(expand = 0) +
  labs(title = "Observations per year") +
  theme_classic() +
  theme(axis.title = element_blank())

p_time_histo_all <-
  time_histo %>%
  ggplot() +
  geom_col(aes(year, n, fill = version),
           col = "grey20") +
  scale_fill_manual(values = c("darkgoldenrod1", "grey70"),
                    name = "") +
  scale_x_continuous(breaks = seq(1900, 2100, 5),
                     limits = c(1981, 2020)) +
  scale_y_continuous(limits = c(0, max(time_histo$n) + 500)) +
  coord_cartesian(expand = 0) +
  labs(title = "Observations per year") +
  theme_classic() +
  theme(axis.title = element_blank())


p_time_histo_G19

Version Author Date
0573621 jens-daniel-mueller 2021-09-29
p_time_histo_all

Version Author Date
0573621 jens-daniel-mueller 2021-09-29
ggsave(plot = p_time_histo_G19,
       path = "output/publication",
       filename = "time_histo_G19.png",
       height = 2,
       width = 10)

ggsave(plot = p_time_histo_all,
       path = "output/publication",
       filename = "time_histo_all.png",
       height = 2,
       width = 10)

3 Time series histogram

MLR_basins_in <- c("1", "2", "AIP", "SO_2", "5", "SO_AIP", "SO")

# basinmask$group_id <- 
# basinmask %>% group_indices(MLR_basins, basin)

basin_maps <-
  map +
  geom_raster(data = basinmask %>%  filter(MLR_basins %in% MLR_basins_in),
              aes(lon, lat, fill = basin)) +
  scale_fill_brewer(palette = "Set3", guide = "none") +
  facet_wrap( ~ MLR_basins) +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank())

basin_maps

Version Author Date
ae93565 jens-daniel-mueller 2021-09-29
0573621 jens-daniel-mueller 2021-09-29
ggsave(plot = basin_maps,
       path = "output/publication",
       filename = "basin_maps.png",
       height = 5,
       width = 10)

4 coverage maps

GLODAP_era_grid <- GLODAP_preprocessed %>% 
  mutate(era = cut(year,
                   seq(1990, 2020, 10),
                   labels = c("1990 - 1999", "2000 - 2009", "2010 - 2019"),
                   right = FALSE)) %>% 
  group_by(lon, lat, era) %>% 
  summarise(year_max = max(year),
            year_min = min(year)) %>% 
  ungroup() %>% 
  drop_na()

coverage_map <-
  map +
  geom_raster(data = GLODAP_era_grid,
              aes(lon, lat)) +
  scale_fill_viridis_c() +
  facet_grid(. ~ era) +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank())

coverage_map

Version Author Date
ae93565 jens-daniel-mueller 2021-09-29
ggsave(plot = coverage_map,
       path = "output/publication",
       filename = "coverage_map.png",
       height = 2,
       width = 8)

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.2

Matrix products: default
BLAS:   /usr/local/R-4.0.3/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R-4.0.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggforce_0.3.3   metR_0.9.0      scico_1.2.0     patchwork_1.1.1
 [5] collapse_1.5.0  forcats_0.5.0   stringr_1.4.0   dplyr_1.0.5    
 [9] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.3   
[13] ggplot2_3.3.5   tidyverse_1.3.0 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] httr_1.4.2               sass_0.4.0               viridisLite_0.3.0       
 [4] jsonlite_1.7.1           modelr_0.1.8             bslib_0.2.5.1           
 [7] assertthat_0.2.1         highr_0.8                blob_1.2.1              
[10] cellranger_1.1.0         yaml_2.2.1               pillar_1.6.2            
[13] backports_1.1.10         lattice_0.20-41          glue_1.4.2              
[16] RcppEigen_0.3.3.7.0      digest_0.6.27            RColorBrewer_1.1-2      
[19] promises_1.1.1           polyclip_1.10-0          checkmate_2.0.0         
[22] rvest_0.3.6              colorspace_2.0-2         htmltools_0.5.1.1       
[25] httpuv_1.5.4             Matrix_1.2-18            pkgconfig_2.0.3         
[28] broom_0.7.9              haven_2.3.1              scales_1.1.1            
[31] tweenr_1.0.2             whisker_0.4              later_1.2.0             
[34] git2r_0.27.1             farver_2.0.3             generics_0.1.0          
[37] ellipsis_0.3.2           withr_2.3.0              cli_3.0.1               
[40] magrittr_1.5             crayon_1.3.4             readxl_1.3.1            
[43] evaluate_0.14            fs_1.5.0                 fansi_0.4.1             
[46] MASS_7.3-53              xml2_1.3.2               RcppArmadillo_0.10.1.2.0
[49] tools_4.0.3              data.table_1.14.0        hms_0.5.3               
[52] lifecycle_1.0.0          munsell_0.5.0            reprex_0.3.0            
[55] compiler_4.0.3           jquerylib_0.1.4          rlang_0.4.11            
[58] grid_4.0.3               rstudioapi_0.13          labeling_0.4.2          
[61] rmarkdown_2.10           gtable_0.3.0             DBI_1.1.0               
[64] R6_2.5.0                 lubridate_1.7.9          knitr_1.33              
[67] utf8_1.1.4               rprojroot_2.0.2          stringi_1.5.3           
[70] parallel_4.0.3           Rcpp_1.0.5               vctrs_0.3.8             
[73] dbplyr_1.4.4             tidyselect_1.1.0         xfun_0.25