Last updated: 2020-08-20

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 cc5d91b. 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/
    Ignored:    figure/

Unstaged changes:
    Modified:   analysis/_site.yml

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 6320d89 jens-daniel-mueller 2020-08-20 Build site.
Rmd 0c8e2e8 jens-daniel-mueller 2020-08-20 moved WOA 13 Clement to separate Rmd
html 1064ef8 jens-daniel-mueller 2020-08-19 Build site.
html 29a537a jens-daniel-mueller 2020-08-18 Build site.
Rmd 7fb61d5 jens-daniel-mueller 2020-08-18 rerun with all parameters in one file
html 2c0a2c2 jens-daniel-mueller 2020-08-14 Build site.
Rmd f6a3179 jens-daniel-mueller 2020-08-14 checked gamma calculation and sabine cant
html a3b6b68 jens-daniel-mueller 2020-08-13 Build site.
html 00c2120 jens-daniel-mueller 2020-08-13 Build site.
html c9df014 jens-daniel-mueller 2020-08-13 Build site.
Rmd 35b1b79 jens-daniel-mueller 2020-08-13 formatting
html f0b8f3f jens-daniel-mueller 2020-08-13 Build site.
Rmd 044073d jens-daniel-mueller 2020-08-13 Arctic and Sea of Japan incuded in basin mask
html a1b06c9 jens-daniel-mueller 2020-08-13 Build site.
Rmd 7133d1a jens-daniel-mueller 2020-08-13 potentiell temperature calculated
html bf69270 jens-daniel-mueller 2020-08-13 Build site.
html 1176c9a jens-daniel-mueller 2020-08-12 Build site.
html 1a078e7 jens-daniel-mueller 2020-08-12 Build site.
Rmd 6344282 jens-daniel-mueller 2020-08-12 updated lon conversion, variable names and masks
html 2980ad4 jens-daniel-mueller 2020-08-12 Build site.
Rmd 8ba8189 jens-daniel-mueller 2020-08-12 corrected depth conversion from pressure
html f143b2d jens-daniel-mueller 2020-08-12 Build site.
Rmd c78a3f9 jens-daniel-mueller 2020-08-12 corrected pressure input for gamma calculation
html 2d179e7 jens-daniel-mueller 2020-08-12 Build site.
Rmd 525cb52 jens-daniel-mueller 2020-08-12 WOA 18 gamma calculation, new lon values in mapping
html 9455a55 jens-daniel-mueller 2020-08-12 Build site.
Rmd 1a7acc2 jens-daniel-mueller 2020-08-12 applied basin mask, combined sectio plots for Atl, Pac, Ind
html 35b284d jens-daniel-mueller 2020-08-11 Build site.
Rmd 5d45981 jens-daniel-mueller 2020-08-11 plot sal sections from function both basins
html 495debb jens-daniel-mueller 2020-08-11 Build site.
Rmd cfbc5e4 jens-daniel-mueller 2020-08-11 plot sections from function both basins
html 075099b jens-daniel-mueller 2020-08-11 Build site.
Rmd adc0335 jens-daniel-mueller 2020-08-11 plot sections from function
Rmd 69b9a78 jens-daniel-mueller 2020-08-11 plot sections from function
html cfd84b7 jens-daniel-mueller 2020-08-11 Build site.
Rmd ca836af jens-daniel-mueller 2020-08-11 Removed Rmd child tests
html dc2b649 jens-daniel-mueller 2020-08-11 Build site.
Rmd 928cd7d jens-daniel-mueller 2020-08-11 Rmd child test with access to global object
html be47191 jens-daniel-mueller 2020-08-11 Build site.
Rmd 9c8f6b8 jens-daniel-mueller 2020-08-11 Rmd child test with variable name transmission
html 6ebb3de jens-daniel-mueller 2020-08-11 Build site.
Rmd 0333c99 jens-daniel-mueller 2020-08-11 test addition child Rmd file
html fbbabf4 jens-daniel-mueller 2020-08-11 Build site.
Rmd e92638d jens-daniel-mueller 2020-08-11 plot maps from function
html cee0e89 jens-daniel-mueller 2020-08-11 Build site.
Rmd c9e2d65 jens-daniel-mueller 2020-08-11 plot maps from function
html de933d9 jens-daniel-mueller 2020-08-11 Build site.
Rmd c3a6c63 jens-daniel-mueller 2020-08-11 included WOA land mask and longitude conversion
html 5d33341 jens-daniel-mueller 2020-08-11 Build site.
html 8a010ca jens-daniel-mueller 2020-08-11 Build site.
html a01041a jens-daniel-mueller 2020-08-11 Build site.
html e18e59a jens-daniel-mueller 2020-08-10 Build site.
html 7d7900a jens-daniel-mueller 2020-08-07 Build site.
html 4394942 jens-daniel-mueller 2020-08-04 Build site.
Rmd eb838d4 jens-daniel-mueller 2020-08-04 Read, plot, write data from D Clement
html 662560f jens-daniel-mueller 2020-08-04 Build site.
Rmd b2b1f24 jens-daniel-mueller 2020-08-04 Read, plot, write data from D Clement
html e9a52c5 jens-daniel-mueller 2020-07-31 Build site.
Rmd 5ee70b2 jens-daniel-mueller 2020-07-31 formatting
html f33772b jens-daniel-mueller 2020-07-31 Build site.
Rmd dea0eaf jens-daniel-mueller 2020-07-31 alligned plots with GLODAP climatology
html 9dc5d7f jens-daniel-mueller 2020-07-29 Build site.
html 21524b4 jens-daniel-mueller 2020-07-29 Build site.
html f5c4667 jens-daniel-mueller 2020-07-29 Build site.
Rmd f6d4d92 jens-daniel-mueller 2020-07-29 format and plots revised
html 8d71a56 jens-daniel-mueller 2020-07-29 Build site.
Rmd 82db969 jens-daniel-mueller 2020-07-29 format and plots revised
html 2e08795 jens-daniel-mueller 2020-07-24 Build site.
html 61a1a48 jens-daniel-mueller 2020-07-24 Build site.
Rmd 864a6e3 jens-daniel-mueller 2020-07-24 merged predictor data sets
html eb716ce jens-daniel-mueller 2020-07-23 Build site.
Rmd ffd46da jens-daniel-mueller 2020-07-23 WOA18 read in
html 556e6cc jens-daniel-mueller 2020-07-23 Build site.
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(tidync)
library(reticulate)
library(oce)

1 Data source

2 Masks

2.1 Basins

2.1.1 Read mask

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,
                         col_types = list(.default = "d"))

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

2.1.2 Labels

According to WOA FAQ website and WOA18 documentation, number codes in the mask files were used to assign ocean basins as follows:

Atlantic Ocean:

  • 1: Atlantic Ocean (with 10 - Southern Ocean, between 63°W and 20°E)
  • 11: Arctic Ocean (restricted by northern latitude limit)

Indo-Pacific:

  • 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)
  • 12: Sea of Japan
  • 56: Bay of Bengal
basinmask_01 <- basinmask_01 %>% 
  filter(Basin_0m %in% c("1", "2", "3", "10", "11", "12", "56"),
         lat <= parameters$lat_max) %>% 
  mutate(basin = if_else(Basin_0m == "10" & lon >= -63 & lon < 20,
                         "Atlantic", "Indo-Pacific"),
         basin = if_else(Basin_0m == "11",
                         "Atlantic", basin),
         basin = if_else(Basin_0m == "1",
                         "Atlantic", basin)) %>% 
  select(-Basin_0m) %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon))

2.2 Land

2.2.1 Read mask

The land sea mask with 1x1° resolution from the file landsea_01.msk was used.

landsea_01 <- read_csv(here::here("data/World_Ocean_Atlas_2018",
                                  "landsea_01.msk"),
                         skip = 1,
                         col_types = list(.default = "d"))

2.2.2 Label

According to the WOA18 documentation document:

“The landsea_XX.msk contains the standard depth level number at which the bottom of the ocean is first encountered at each quarter-degree or one-degree square for the entire world. Land will have a value of 1, corresponding to the surface.”

The landmask was derived as coordinates with value 1.

landmask <- landsea_01 %>% 
  mutate(region = if_else(Bottom_Standard_Level == "1",
                         "land", "ocean")) %>% 
  select(-Bottom_Standard_Level)

landmask <- landmask %>% 
  rename(lat = Latitude,
         lon = Longitude) %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon))

rm(landsea_01)

2.3 Map

ggplot() +
  geom_raster(data = landmask %>% filter(region == "land"),
              aes(lon, lat), fill = "grey80") +
  geom_raster(data = basinmask_01,
              aes(lon, lat, fill = basin)) +
  scale_fill_brewer(palette = "Dark2") +
  coord_quickmap(expand = 0) +
  theme(legend.position = "top",
        legend.title = element_blank())

2.4 Write files

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

landmask %>% 
  write_csv(here::here("data/World_Ocean_Atlas_2018/_summarized_files",
                       "land_mask_WOA18.csv"))

3 Climatologies

Copied from the WOA FAQ website, the file naming conventions is:

PREF_DDDD_VTTFFGG.EXT, where:

  • PREF: prefix
  • DDDD: decade
  • V: variable
  • TT: time period
  • FF: field type
  • GG: grid (5deg- 5°, 01- 1°, 04 - 1/4°)
  • EXT: file extention

Short description of two statistical fields in WOA

  • Objectively analyzed climatologies are the objectively interpolated mean fields for oceanographic variables at standard - depth levels for the World Ocean.
  • The statistical mean is the average of all unflagged interpolated values at each standard depth level for each variable - in each 1° square which contains at least one measurement for the given oceanographic variable.

Here, we use

  • Fields: objectively analyzed mean
  • Decades: all decades
  • Grid: 1 deg resolution

According to the WOA18 documentation document:

What are the units for temperature and salinity in the WOA18?

In situ temperatures used for WOA18 are not converted from their original scale, so there is a mix of IPTS-48, IPTS-68, and ITS-90 (and pre IPTS-48 temperatures). The differences between scales are small (on the order of 0.01°C) and should not have much effect on the climatological means, except, possibly at very deep depths. Values for salinity are on the Practical salinity scale (PSS-78). Pre-1978 salinity values converted from conductivity may have used a different salinity scale. Pre-conductivity salinities use the Knudsen method.

3.1 Read ncdfs

# temperature

WOA_tem <- tidync(here::here("data/World_Ocean_Atlas_2018",
                                 "woa18_decav_t00_01.nc"))

WOA_tem_tibble <- WOA_tem %>% hyper_tibble()

WOA_tem_tibble <- WOA_tem_tibble  %>% 
  select(tem = t_an, lon, lat, depth) %>% 
  drop_na() %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon))

# salinity

WOA_sal <- tidync(here::here("data/World_Ocean_Atlas_2018",
                                 "woa18_decav_s00_01.nc"))

WOA_sal_tibble <- WOA_sal %>% hyper_tibble()

WOA_sal_tibble <- WOA_sal_tibble  %>% 
  select(sal = s_an, lon, lat, depth) %>% 
  drop_na() %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon))

rm(WOA_sal, WOA_tem)
WOA18_predictors <- full_join(WOA_sal_tibble, WOA_tem_tibble)
rm(WOA_sal_tibble, WOA_tem_tibble)

3.2 Apply basin mask

Data outside the WOA18 basin mask were removed for further analysis.

WOA18_predictors <- inner_join(WOA18_predictors, basinmask_01)
rm(basinmask_01)

3.3 Potential temperature

3.3.1 Calculation

WOA18_predictors <- WOA18_predictors %>% 
  mutate(THETA = swTheta(salinity = sal,
                         temperature = tem,
                         pressure = depth,
                         referencePressure = 0,
                         longitude = lon - 180,
                         latitude = lat))

3.3.2 Profile

Example profile from North Atlantic Ocean.

WOA18_predictors %>%
  filter(lat == parameters$lat_Atl_profile,
         lon == parameters$lon_Atl_section) %>%
  ggplot() +
  geom_line(aes(tem, depth, col = "insitu")) +
  geom_point(aes(tem, depth, col = "insitu")) +
  geom_line(aes(THETA, depth, col = "theta")) +
  geom_point(aes(THETA, depth, col = "theta")) +
  scale_y_reverse() +
  scale_color_brewer(palette = "Dark2", name = "Scale")

3.4 Neutral density

Neutral density gamma was calculated with a Python script provided by Serazin et al (2011), which performs a polynomial approximation of the original gamma calculation.

3.4.1 Calculation

WOA18_predictors_gamma_prep <- WOA18_predictors %>% 
  rename(LATITUDE = lat,
         LONGITUDE = lon,
         SALNTY = sal,
         CTDPRS = depth)

source_python(here::here("code/python_scripts",
                         "Gamma_GLODAP_python.py"))

WOA18_predictors_gamma_calc <- calculate_gamma(WOA18_predictors_gamma_prep)

3.4.2 Write/open file

WOA18_predictors <- WOA18_predictors_gamma_calc %>% 
  rename(lat = LATITUDE,
         lon = LONGITUDE,
         sal = SALNTY,
         depth = CTDPRS,
         gamma  = GAMMA)

WOA18_predictors %>% 
  write_csv(here::here("data/World_Ocean_Atlas_2018/_summarized_files",
                       "WOA18_predictors.csv"))
rm(list = setdiff(ls(), c("landmask", "parameters")))

WOA18_predictors <- 
  read_csv(here::here("data/World_Ocean_Atlas_2018/_summarized_files",
                       "WOA18_predictors.csv"))

3.5 Temperature plots

Below, following subsets of the climatologies are plotted for all relevant parameters:

  • Horizontal planes at 0, 100, 500, 2000m
  • Meridional sections at longitudes:
    • Atlantic: 335.5
    • Pacific: 190.5

Section locations are indicated as white lines in maps.

3.5.1 Surface map

source(here::here("code",
                  "plotting_functions.R"))

map_climatology(WOA18_predictors, "tem")

3.5.2 Sections

section_climatology(WOA18_predictors, "tem")

3.5.3 Sections shallow

section_climatology_shallow(WOA18_predictors, "tem")

3.6 Salinity plots

3.6.1 Surface map

map_climatology(WOA18_predictors, "sal")

3.6.2 Sections

section_climatology(WOA18_predictors, "sal")

3.6.3 Sections shallow

section_climatology_shallow(WOA18_predictors, "sal")

3.7 Neutral density plots

3.7.1 Surface map

map_climatology(WOA18_predictors, "gamma")

3.7.2 Sections

section_climatology(WOA18_predictors, "gamma")

3.7.3 Sections shallow

section_climatology_shallow(WOA18_predictors, "gamma")

4 Open tasks

  • How to convert depth from WOA18 to CTD pressure (dbars) for neutral density calculation?

5 Questions

  • Which version of the WOA to be used
    • Fields (currently: objectively analyzed mean)
    • Decades (currently: all decades)
    • Grid (currently: 1 deg resolution)

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] oce_1.2-0       gsw_1.0-5       testthat_2.3.2  reticulate_1.16
 [5] tidync_0.2.4    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] 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    lattice_0.20-41   
[13] glue_1.4.1         digest_0.6.25      RColorBrewer_1.1-2 promises_1.1.1    
[17] rvest_0.3.6        colorspace_1.4-1   htmltools_0.5.0    httpuv_1.5.4      
[21] Matrix_1.2-18      pkgconfig_2.0.3    broom_0.7.0        haven_2.3.1       
[25] scales_1.1.1       whisker_0.4        later_1.1.0.1      git2r_0.27.1      
[29] generics_0.0.2     farver_2.0.3       ellipsis_0.3.1     withr_2.2.0       
[33] cli_2.0.2          magrittr_1.5       crayon_1.3.4       readxl_1.3.1      
[37] evaluate_0.14      fs_1.4.2           ncdf4_1.17         fansi_0.4.1       
[41] xml2_1.3.2         tools_4.0.2        hms_0.5.3          lifecycle_0.2.0   
[45] munsell_0.5.0      reprex_0.3.0       isoband_0.2.2      compiler_4.0.2    
[49] RNetCDF_2.3-1      rlang_0.4.7        grid_4.0.2         rstudioapi_0.11   
[53] labeling_0.3       rmarkdown_2.3      gtable_0.3.0       DBI_1.1.0         
[57] R6_2.4.1           ncmeta_0.2.5       lubridate_1.7.9    knitr_1.29        
[61] rprojroot_1.3-2    stringi_1.4.6      Rcpp_1.0.5         vctrs_0.3.2       
[65] dbplyr_1.4.4       tidyselect_1.1.0   xfun_0.16