Last updated: 2021-07-07

Checks: 7 0

Knit directory: emlr_obs_preprocessing/

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 6312bd4. 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/

Unstaged changes:
    Modified:   README.md
    Modified:   analysis/_site.yml
    Deleted:    analysis/read_Gruber_2019_Cant.Rmd
    Deleted:    analysis/read_Sabine_2004_Cant.Rmd
    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/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 6312bd4 jens-daniel-mueller 2021-07-07 Build site.
html 58bc706 jens-daniel-mueller 2021-07-06 Build site.
Rmd 0db89e1 jens-daniel-mueller 2021-07-06 rerun with revised variable names
html f600971 jens-daniel-mueller 2021-07-02 Build site.
html 265c4ef jens-daniel-mueller 2021-06-04 Build site.
Rmd 00065c8 jens-daniel-mueller 2021-06-04 included OceanSODA
html c79346a jens-daniel-mueller 2021-06-03 Build site.
html 0ef91d5 jens-daniel-mueller 2021-05-12 Build site.
Rmd f091aa5 jens-daniel-mueller 2021-05-12 removed Sea of Japan from basin mask
html ace484d jens-daniel-mueller 2021-05-12 Build site.
Rmd 149c948 jens-daniel-mueller 2021-05-12 removed Sea of Japan from basin mask
html 6ff516e jens-daniel-mueller 2021-03-30 Build site.
html 86aee67 jens-daniel-mueller 2021-03-26 Build site.
Rmd 96f4b3a jens-daniel-mueller 2021-03-26 darker grey for landmask
html a5846c5 jens-daniel-mueller 2020-12-18 Build site.
Rmd 5538466 jens-daniel-mueller 2020-12-18 subsetted WOA depth levels to 33 standard depths
html 88967c0 jens-daniel-mueller 2020-12-16 Build site.
html fd1a2c9 jens-daniel-mueller 2020-12-15 cleaned for copying
html ed3e64c jens-daniel-mueller 2020-12-15 Build site.
html 64cfdd6 jens-daniel-mueller 2020-12-15 Build site.
Rmd 6f2a669 jens-daniel-mueller 2020-12-15 code and output cleaning
html 2fdd2a7 jens-daniel-mueller 2020-12-14 Build site.
html cc07d29 jens-daniel-mueller 2020-12-14 Build site.
Rmd 325e1fa jens-daniel-mueller 2020-12-14 rebuild with new root folder
html 4ded3cd jens-daniel-mueller 2020-12-14 Build site.
Rmd a09b95f jens-daniel-mueller 2020-12-14 rebuild with new root folder
html 474daac jens-daniel-mueller 2020-12-12 Build site.
Rmd 53d8356 jens-daniel-mueller 2020-12-12 removed basinmask issues
html 5c773fa jens-daniel-mueller 2020-12-11 Build site.
html ae7aa2e jens-daniel-mueller 2020-12-11 Build site.
Rmd ec6f803 jens-daniel-mueller 2020-12-11 apply only lat max but not basinmak
html 914159f jens-daniel-mueller 2020-12-11 Build site.
Rmd 30eb59a jens-daniel-mueller 2020-12-11 created basin masks for analysis
html 9c5d86d jens-daniel-mueller 2020-12-11 Build site.
Rmd 8a8db38 jens-daniel-mueller 2020-12-11 renamed tem to temp
html 999cd9d jens-daniel-mueller 2020-12-02 Build site.
html e28cc90 jens-daniel-mueller 2020-11-30 Build site.
Rmd cd676e8 jens-daniel-mueller 2020-11-30 created global parameterization file params_global.rds
html 825309e jens-daniel-mueller 2020-11-27 Build site.
Rmd 4dd5bda jens-daniel-mueller 2020-11-27 correct source link, basinmask and plotting function
html 58359ac jens-daniel-mueller 2020-11-27 Build site.
Rmd 2f37595 jens-daniel-mueller 2020-11-27 first rebuild after splitting the preprocessing part
Rmd cb7a9ca jens-daniel-mueller 2020-11-27 linked to local paths on server
Rmd 92e10aa Jens Müller 2020-11-27 Initial commit
html 92e10aa Jens Müller 2020-11-27 Initial commit

1 Data source

2 Masks

2.1 Land

2.1.1 Read mask

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

landsea_01 <- read_csv(
  paste(
    path_woa2018,
    "masks/landsea_01.msk",
    sep = ""),
  skip = 1,
  col_types = list(.default = "d"))

2.1.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))

landmask <- landmask %>%
  filter(region == "land",
         lat >= params_global$lat_min,
         lat <= params_global$lat_max
         ) %>%
  select(-region)

rm(landsea_01)

2.2 Basins

2.2.1 Read mask

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

basinmask_01 <- read_csv(
  paste(
    path_woa2018,
    "masks/basinmask_01.msk",
    sep = ""),
  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.2.2 Basins for budgets

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
  • 10: Southern Ocean between 63°W and 20°E
  • 11: Arctic Ocean (restricted by northern latitude limit 65N)

Indian Ocean:

  • 3: Indian Ocean
  • 10: Southern Ocean between 20°E and 147°E
  • 56: Bay of Bengal

Pacific Ocean:

  • 2: Pacific Ocean
  • 10: Southern Ocean between 147°E and 63°W
  • (12: Sea of Japan; currently not included)
# assign basin labels
basinmask_01 <- basinmask_01 %>%
  filter(Basin_0m %in% c("1", "2", "3", "10", "11", "56")) %>%
  mutate(
    basin_AIP = "none",
    basin_AIP = case_when(
      Basin_0m == "1" ~ "Atlantic",
      Basin_0m == "10" & lon >= -63 & lon < 20 ~ "Atlantic",
      Basin_0m == "11" ~ "Atlantic",
      Basin_0m == "3" ~ "Indian",
      Basin_0m == "56" ~ "Indian",
      Basin_0m == "10" & lon >= 20 & lon < 147 ~ "Indian",
      Basin_0m == "2" ~ "Pacific",
      # Basin_0m == "12" ~ "Pacific",
      Basin_0m == "10" &
        lon >= 147 | lon < -63 ~ "Pacific"
    )
  ) %>%
  select(-Basin_0m)

# apply northern latitude boundary
basinmask_01 <- basinmask_01 %>%
  filter(lat <= params_global$lat_max)

# harmonize lon scale
basinmask_01 <- basinmask_01  %>%
  mutate(lon = if_else(lon < 20, lon + 360, lon))
# generate base map, which is further used throughout the project
map <- 
  ggplot() +
  geom_raster(data = landmask,
              aes(lon, lat), fill = "grey80") +
  coord_quickmap(expand = 0) +
  theme(axis.title = element_blank())

# plot basin_AIP map
map +
  geom_raster(data = basinmask_01,
              aes(lon, lat, fill = basin_AIP)) +
  scale_fill_brewer(palette = "Dark2")

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11

2.2.3 Basins for MLR fitting

For the MLR fitting, ocean basins are further split up, as plotted below.

# 2 basins
basinmask_01 <- basinmask_01 %>%
  mutate(basin = if_else(basin_AIP == "Atlantic",
                         "Atlantic",
                         "Indo-Pacific"),
         MLR_basins = "2")

# 5 basins
basinmask_5 <- basinmask_01 %>%
  mutate(
    basin = case_when(
      basin_AIP ==  "Atlantic" & lat > params_global$lat_equator ~ "N_Atlantic",
      basin_AIP ==  "Atlantic" & lat < params_global$lat_equator ~ "S_Atlantic",
      basin_AIP ==  "Pacific" & lat > params_global$lat_equator ~ "N_Pacific",
      basin_AIP ==  "Pacific" & lat < params_global$lat_equator ~ "S_Pacific",
      basin_AIP ==  "Indian" ~ "Indian"
    )
  ) %>%
  mutate(MLR_basins = "5")

# SO basin separate
basinmask_SO <- basinmask_01 %>%
  mutate(
    basin = if_else(
      lat < params_global$lat_min_SO, "SO", basin)
  ) %>%
  mutate(MLR_basins = "SO")

# SO basin separate, with others being AIP
basinmask_SO_AIP <- basinmask_01 %>%
  mutate(
    basin = if_else(
      lat < params_global$lat_min_SO, "SO", basin_AIP)
  ) %>%
  mutate(MLR_basins = "SO_AIP")

# 3 basins
basinmask_AIP <- basinmask_01 %>%
  mutate(
    basin = basin_AIP) %>%
  mutate(MLR_basins = "AIP")

# join basin masks into one file
basinmask_01 <- bind_rows(basinmask_01, basinmask_5, basinmask_SO, basinmask_SO_AIP, basinmask_AIP)
for (i_MLR_basins in unique(basinmask_01$MLR_basins)) {
  
  print(
    map +
      geom_raster(
        data = basinmask_01 %>% filter(MLR_basins == i_MLR_basins),
        aes(lon, lat, fill = basin)
      ) +
      scale_fill_brewer(palette = "Dark2") +
      labs(title = paste("MLR basin label:", i_MLR_basins))
  )
  
}

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11

Version Author Date
58bc706 jens-daniel-mueller 2021-07-06
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11

Version Author Date
58bc706 jens-daniel-mueller 2021-07-06

2.3 Global section

To plot sections from the North Atlantic south to the Southern Ocean, around Antarctica and back North across the Pacific Ocean, corresponding coordinates were subsetted from the basin mask and distances between coordinate grid points calculated.

section <- basinmask_01 %>%
  select(lon, lat)

# subset individual section parts
Atl_NS <- section %>%
  filter(
    lon == params_global$lon_Atl_section,
    lat <= params_global$lat_section_N,
    lat >= params_global$lat_section_S
  ) %>%
  arrange(-lat)

Atl_SO <- section %>%
  filter(lon > params_global$lon_Atl_section,
         lat == params_global$lat_section_S) %>%
  arrange(lon)

Pac_SO <- section %>%
  filter(lon < params_global$lon_Pac_section,
         lat == params_global$lat_section_S) %>%
  arrange(lon)

Pac_SN <- section %>%
  filter(
    lon == params_global$lon_Pac_section,
    lat <= params_global$lat_section_N,
    lat >= params_global$lat_section_S
  ) %>%
  arrange(lat)

# join individual section parts
section_global_coordinates <- bind_rows(Atl_NS,
                     Atl_SO,
                     Pac_SO,
                     Pac_SN)

# convert to regular lon coordinates for distance calculation
section_global_coordinates <- section_global_coordinates %>%
  mutate(lon_180 = if_else(lon > 180, lon - 360, lon))

# calculate distance along section
section_global_coordinates <- section_global_coordinates %>%
  mutate(dist_int = distGeo(cbind(lon_180, lat)) / 1e6) %>%
  mutate(dist = cumsum(dist_int))

section_global_coordinates <- section_global_coordinates %>%
  select(lon, lat, dist) %>% 
  drop_na()

rm(Atl_NS, Atl_SO, Pac_SN, Pac_SO, section)
map +
  geom_point(data = section_global_coordinates,
             aes(lon, lat, col = dist)) +
  scale_colour_viridis_b(name = "Distance (Mm)")

Version Author Date
58bc706 jens-daniel-mueller 2021-07-06
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
64cfdd6 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

2.4 Write files

# basin mask
basinmask_01 %>%
  write_csv(paste(path_files,
                  "basin_mask_WOA18.csv",
                  sep = ""))
# global section
section_global_coordinates %>%
  write_csv(paste(path_files,
                  "section_global_coordinates.csv",
                  sep = ""))

# base map ggplot
map %>%
  write_rds(paste(path_files,
                  "map_landmask_WOA18.rds",
                  sep = ""))

3 Climatology S and T

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 nc files

# temperature

WOA18_temp <- tidync(paste(
  path_woa2018,
  "temperature/decav/1.00/woa18_decav_t00_01.nc",
  sep = ""
))

WOA18_temp_tibble <- WOA18_temp %>%
  hyper_tibble()

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

# salinity

WOA18_sal <- tidync(paste(
  path_woa2018,
  "salinity/decav/1.00/woa18_decav_s00_01.nc",
  sep = ""
))

WOA18_sal_tibble <- WOA18_sal %>% hyper_tibble()

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

rm(WOA18_sal, WOA18_temp)

3.2 Join predictors

WOA18_sal_temp <- full_join(WOA18_sal_tibble, WOA18_temp_tibble)
rm(WOA18_sal_tibble, WOA18_temp_tibble)

3.3 Apply basin mask

# use only three basin to assign general basin mask
# ie this is not specific to the MLR fitting

basinmask_01 <- basinmask_01 %>% 
  filter(MLR_basins == "2") %>% 
  select(lat, lon, basin_AIP)

# restrict predictor fields to basin mask grid

WOA18_sal_temp <- inner_join(WOA18_sal_temp, basinmask_01)

3.4 Subset depth levels

WOA18_sal_temp <- WOA18_sal_temp %>% 
  filter(depth %in% params_global$depth_levels_33)

3.5 Potential temperature

Potential temperature is calculated as in input variable for the neutral density calculation.

3.5.1 Calculation

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

3.5.2 Profile

Example profile from North Atlantic Ocean.

WOA18_sal_temp %>%
  filter(lat == params_global$lat_Atl_profile,
         lon == params_global$lon_Atl_section) %>%
  ggplot() +
  geom_line(aes(temp, depth, col = "insitu")) +
  geom_point(aes(temp, 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")

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
9c5d86d jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.5.3 Section

p_section_global(
  df = WOA18_sal_temp,
  var = "THETA")

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.6 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.6.1 Calculation

# calculate pressure from depth

WOA18_sal_temp <- WOA18_sal_temp %>%
  mutate(CTDPRS = gsw_p_from_z(-depth,
                               lat))
# rename variables according to python script

WOA18_sal_temp_gamma_prep <- WOA18_sal_temp %>%
  rename(LATITUDE = lat,
         LONGITUDE = lon,
         SALNTY = sal)

# load python scripts

source_python(paste(
  path_functions,
  "python_scripts/Gamma_GLODAP_python.py",
  sep = ""
))

# calculate gamma

WOA18_sal_temp_gamma_calc <-
  calculate_gamma(WOA18_sal_temp_gamma_prep)

# reverse variable naming

WOA18_sal_temp <- WOA18_sal_temp_gamma_calc %>%
  select(-c(CTDPRS, THETA)) %>%
  rename(
    lat = LATITUDE,
    lon = LONGITUDE,
    sal = SALNTY,
    gamma  = GAMMA
  )

WOA18_sal_temp <- as_tibble(WOA18_sal_temp)

rm(WOA18_sal_temp_gamma_calc, WOA18_sal_temp_gamma_prep)

3.7 Write file

WOA18_sal_temp %>%
  write_csv(paste(path_preprocessing,
                  "WOA18_sal_temp.csv",
                  sep = ""))

3.8 Temperature plots

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

  • Horizontal planes at 0, 5, 150, 155, 483, 500, 2000, 1969m
  • Global section as defined above and indicated as white lines in maps.

3.8.1 Surface map

p_map_climatology(
  df = WOA18_sal_temp,
  var = "temp")

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
9c5d86d jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.8.2 Section

p_section_global(
  df = WOA18_sal_temp,
  var = "temp")

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
9c5d86d jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.9 Salinity plots

3.9.1 Surface map

p_map_climatology(
  df = WOA18_sal_temp,
  var = "sal")

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.9.2 Section

p_section_global(
  df = WOA18_sal_temp,
  var = "sal")

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.10 Neutral density plots

3.10.1 Surface map

p_map_climatology(
  df = WOA18_sal_temp,
  var = "gamma")

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

3.10.2 Section

p_section_global(
  df = WOA18_sal_temp,
  var = "gamma")

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

4 Climatology Nuts and O2

4.1 Read nc files

Data are read-in looping over all relevant files, thereby reproducing the same subsetting steps as applied above to the salintity and temperature fields.

# Keep grid cells of WOA18 sal temp data set, to join with
WOA18_nuts_O2 <-
  WOA18_sal_temp %>%
  select(lon, lat, depth)
rm(WOA18_sal_temp)

# create file list
file_list <- c(
  paste(path_woa2018, "phosphate/all/1.00/woa18_all_p00_01.nc", sep = ""),
  paste(path_woa2018, "nitrate/all/1.00/woa18_all_n00_01.nc", sep = ""),
  paste(path_woa2018, "silicate/all/1.00/woa18_all_i00_01.nc", sep = ""),
  paste(path_woa2018, "oxygen/all/1.00/woa18_all_o00_01.nc", sep = ""),
  paste(path_woa2018, "AOU/all/1.00/woa18_all_A00_01.nc", sep = "")
)

# read, plot and join data sets while looping over file list
for (file in file_list) {
  # file <- file_list[1]

  # open file
  WOA18 <- tidync(file)
  WOA18_tibble <- WOA18 %>% hyper_tibble()
  
  # extract parameter name
  parameter <- str_split(file, pattern = "00_", simplify = TRUE)[1]
  parameter <- str_split(parameter, pattern = "all_", simplify = TRUE)[2]
  parameter <- paste(parameter, "_an", sep = "")
  print(file)
  
  WOA18_tibble <- WOA18_tibble  %>%
    select(all_of(parameter),
           lon, lat, depth) %>%
    mutate(lon = if_else(lon < 20, lon + 360, lon))
  
  # apply general basin mask
  WOA18_tibble <- inner_join(WOA18_tibble, basinmask_01)
  
  # subset depth levels
  WOA18_tibble <- WOA18_tibble %>%
    filter(depth %in% params_global$depth_levels_33)
  
  
  # join with previous WOA data and keep only rows in existing data frame
  # this is equal to applying the basinmask
  WOA18_nuts_O2 <- left_join(
    x = WOA18_nuts_O2,
    y = WOA18_tibble)

  # plot maps
  print(
    p_map_climatology(
      df = WOA18_nuts_O2,
      var = parameter)
    )
  
  # plot sections
  print(p_section_global(
    df = WOA18_nuts_O2,
    var = parameter
  ))
  
}
[1] "/nfs/kryo/work/updata/woa2018/phosphate/all/1.00/woa18_all_p00_01.nc"

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
825309e jens-daniel-mueller 2020-11-27
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27
[1] "/nfs/kryo/work/updata/woa2018/nitrate/all/1.00/woa18_all_n00_01.nc"

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
825309e jens-daniel-mueller 2020-11-27
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27
[1] "/nfs/kryo/work/updata/woa2018/silicate/all/1.00/woa18_all_i00_01.nc"

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
825309e jens-daniel-mueller 2020-11-27
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27
[1] "/nfs/kryo/work/updata/woa2018/oxygen/all/1.00/woa18_all_o00_01.nc"

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
825309e jens-daniel-mueller 2020-11-27
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27
[1] "/nfs/kryo/work/updata/woa2018/AOU/all/1.00/woa18_all_A00_01.nc"

Version Author Date
0ef91d5 jens-daniel-mueller 2021-05-12
ace484d jens-daniel-mueller 2021-05-12
86aee67 jens-daniel-mueller 2021-03-26
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
cc07d29 jens-daniel-mueller 2020-12-14
ae7aa2e jens-daniel-mueller 2020-12-11
914159f jens-daniel-mueller 2020-12-11
825309e jens-daniel-mueller 2020-11-27
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

Version Author Date
86aee67 jens-daniel-mueller 2021-03-26
a5846c5 jens-daniel-mueller 2020-12-18
88967c0 jens-daniel-mueller 2020-12-16
fd1a2c9 jens-daniel-mueller 2020-12-15
914159f jens-daniel-mueller 2020-12-11
58359ac jens-daniel-mueller 2020-11-27
92e10aa Jens Müller 2020-11-27

4.2 Write file

WOA18_nuts_O2 %>%
  rename(phosphate = p_an,
         nitrate = n_an,
         silicate = i_an,
         oxygen = o_an,
         aou = A_an) %>% 
  write_csv(paste(path_preprocessing,
                  "WOA18_nuts_O2.csv",
                  sep = ""))

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] patchwork_1.1.1  geosphere_1.5-10 oce_1.2-0        gsw_1.0-5       
 [5] testthat_2.3.2   reticulate_1.18  tidync_0.2.4     forcats_0.5.0   
 [9] stringr_1.4.0    dplyr_1.0.5      purrr_0.3.4      readr_1.4.0     
[13] tidyr_1.1.2      tibble_3.0.4     ggplot2_3.3.3    tidyverse_1.3.0 
[17] workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] httr_1.4.2         viridisLite_0.3.0  jsonlite_1.7.1     modelr_0.1.8      
 [5] assertthat_0.2.1   sp_1.4-4           blob_1.2.1         cellranger_1.1.0  
 [9] yaml_2.2.1         pillar_1.4.7       backports_1.1.10   lattice_0.20-41   
[13] glue_1.4.2         digest_0.6.27      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.5        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.3.0       
[33] cli_2.1.0          magrittr_1.5       crayon_1.3.4       readxl_1.3.1      
[37] evaluate_0.14      fs_1.5.0           ncdf4_1.17         fansi_0.4.1       
[41] xml2_1.3.2         tools_4.0.3        hms_0.5.3          lifecycle_1.0.0   
[45] munsell_0.5.0      reprex_0.3.0       isoband_0.2.2      compiler_4.0.3    
[49] RNetCDF_2.4-2      rlang_0.4.10       grid_4.0.3         rstudioapi_0.11   
[53] rappdirs_0.3.1     labeling_0.4.2     rmarkdown_2.5      gtable_0.3.0      
[57] DBI_1.1.0          R6_2.5.0           ncmeta_0.3.0       lubridate_1.7.9   
[61] knitr_1.30         rprojroot_2.0.2    stringi_1.5.3      Rcpp_1.0.5        
[65] vctrs_0.3.5        dbplyr_1.4.4       tidyselect_1.1.0   xfun_0.18