Last updated: 2020-07-23

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 1ce10e7. 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_2016b_MappedClimatologies/
    Ignored:    data/GLODAPv2_2020/
    Ignored:    data/World_Ocean_Atlas_2018/
    Ignored:    data/pCO2_atmosphere/
    Ignored:    dump/
    Ignored:    output/plots/

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/read_World_Ocean_Atlas_2018.Rmd) and HTML (docs/read_World_Ocean_Atlas_2018.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 c1289a2 jens-daniel-mueller 2020-07-23 Build site.
html 2890e73 jens-daniel-mueller 2020-07-23 Build site.
html fdfa7b9 jens-daniel-mueller 2020-07-22 Build site.
html bb9c002 jens-daniel-mueller 2020-07-21 Build site.
Rmd d2ed0f8 jens-daniel-mueller 2020-07-21 harmonied lat lon labeling
html 97dbf5b jens-daniel-mueller 2020-07-21 Build site.
Rmd 5def7e8 jens-daniel-mueller 2020-07-21 create csvs for each parameter
html b47adc2 jens-daniel-mueller 2020-07-20 Build site.
Rmd 366d7d5 jens-daniel-mueller 2020-07-20 update plots
html 1de1bc0 jens-daniel-mueller 2020-07-20 Build site.
Rmd 68e4615 jens-daniel-mueller 2020-07-20 assigned ocean basins and plotted world map
html 3149ffd jens-daniel-mueller 2020-07-20 Build site.
Rmd 918f8c8 jens-daniel-mueller 2020-07-20 assigned ocean basins and plotted world map
html 2fa2896 jens-daniel-mueller 2020-07-20 Build site.
Rmd 23220a8 jens-daniel-mueller 2020-07-20 assigned ocean basins and plotted world map
html 27d380d jens-daniel-mueller 2020-07-20 Build site.
Rmd 09f3f73 jens-daniel-mueller 2020-07-20 basin masks read in
html 22b588c jens-daniel-mueller 2020-07-18 Build site.
Rmd 87a4680 jens-daniel-mueller 2020-07-18 added WOA blank script

library(tidyverse)
library(lubridate)
library(tidync)
library(stars)

1 Data source

2 Basin mask

2.1 Read data

The surface mask (0m) with 1x1° resolution from the file basinmask_01.msk was used.

basinmask_01 <- read_csv(here::here("data/World_Ocean_Atlas_2018",
                                    "basinmask_01.msk"),
                         skip = 1)

basinmask_01 <- basinmask_01 %>% 
  select(Latitude:Basin_0m) %>% 
  mutate(Basin_0m = as.factor(Basin_0m)) %>% 
  rename(lat = Latitude, lon = Longitude)

2.2 Basin labels

According to WOA FAQ website, number codes in the mask file refer to Ocean basins as follows:

  • 1: Atlantic Ocean (with 10 - Southern Ocean, between 63°W and 20°E)
  • 2: Pacific Ocean (with 10 - Southern Ocean, between 147°E and 63°W)
  • 3: Indian Ocean (with 10 - Southern Ocean, between 20°E and 147°E)

From this, the Atlantik and the Indo-Pacific were labeled.

basinmask_01 <- basinmask_01 %>% 
  filter(Basin_0m %in% c("1", "2", "3", "10")) %>% 
  mutate(basin = if_else(Basin_0m == "10" & lon >= -63 & lon < 20,
                         "Atlantic", "Indo-Pacific"),
         basin = if_else(Basin_0m == "1",
                         "Atlantic", basin)) %>% 
  select(-Basin_0m)

2.3 Plot world map

mapWorld <- borders("world", colour="gray60", fill="gray60")

basinmask_01 %>% 
  ggplot(aes(lon, lat, fill=basin))+
  mapWorld+
  geom_raster()+
  scale_fill_brewer(palette = "Dark2")+
  coord_quickmap(expand = 0)

2.4 Write file

basinmask_01 %>% 
  write_csv(here::here("data/World_Ocean_Atlas_2018/_summarized_files",
                       "basin_mask_WOA18.csv"))

3 Read/plot ncdf files

  • read-in not yet started
file_list <- list.files(path= "data/GLODAPv2_2016b_Mappedclimatologies", pattern = "*.nc")

print("files used:")
print(file_list)

#file <- file_list[1]

for (file in file_list) {
 
clim_stars <- read_stars(here::here("data/GLODAPv2_2016b_Mappedclimatologies",
                          file))

parameter <- str_split(file, pattern = "6b.", simplify = TRUE)[2]
parameter <- str_split(parameter, pattern = ".nc", simplify = TRUE)[1]

map_clim_stars <- clim_stars %>% select(all_of(parameter))

map_clim_stars <- map_clim_stars %>% 
  filter(depth_surface %in% c(0,50,100,200,500,1000,2000,3000,5000))

print(
ggplot()+
  geom_stars(data = map_clim_stars)+
  geom_vline(xintercept = 335, col="white")+
  scale_fill_viridis_b()+
  labs(title = file)+
  facet_wrap(~depth_surface, ncol = 3)+
  theme(axis.text = element_blank(),
        axis.title = element_blank(),
        axis.ticks = element_blank())+
  coord_quickmap(expand = 0)
)


# clim_tidync <- tidync(here::here("data/GLODAPv2_2016b_Mappedclimatologies",
#                                  file))
# print(clim_tidync)
# 
# Atl_sec_clim <- clim_tidync %>% hyper_filter(lon = lon == 335.5)
# Atl_sec_clim_tibble <- Atl_sec_clim %>% hyper_tibble()
# 
# Atl_sec_clim_tibble %>% 
#   ggplot(aes(lat, depth_surface, fill=Cant))+
#   geom_point()+
#   scale_y_reverse()+
#   scale_fill_viridis_b()

}

4 Open tasks

  • none

5 Questions

  • none

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] stars_0.4-3     sf_0.9-4        abind_1.4-5     tidync_0.2.4   
 [5] lubridate_1.7.9 forcats_0.5.0   stringr_1.4.0   dplyr_1.0.0    
 [9] purrr_0.3.4     readr_1.3.1     tidyr_1.1.0     tibble_3.0.3   
[13] ggplot2_3.3.2   tidyverse_1.3.0 workflowr_1.6.2

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