Last updated: 2022-11-30

Checks: 7 0

Knit directory: emlr_obs_analysis/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.7.0). 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 ef50aa6. 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/other/
    Ignored:    output/presentation/
    Ignored:    output/publication/

Untracked files:
    Untracked:  code/results_publication_backup_incl_ensemble_uncertainty_20221111.Rmd

Unstaged changes:
    Deleted:    analysis/MLR_target_budgets.Rmd
    Deleted:    analysis/MLR_target_column_inventories.Rmd
    Deleted:    analysis/MLR_target_zonal_sections.Rmd
    Modified:   analysis/_site.yml
    Modified:   analysis/results_publication.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/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 57d1a9b jens-daniel-mueller 2022-11-17 Build site.
html 375300e jens-daniel-mueller 2022-11-14 Build site.
html cc337dd jens-daniel-mueller 2022-11-11 Build site.
html ec60f68 jens-daniel-mueller 2022-11-07 Build site.
Rmd 820fff8 jens-daniel-mueller 2022-11-06 rebuild website after internal implementing review round 1
html 5d06b07 jens-daniel-mueller 2022-10-07 Build site.
Rmd a79155d jens-daniel-mueller 2022-10-07 revised color scheme for obs coverage map
html 9d2929c jens-daniel-mueller 2022-09-09 Build site.
Rmd bd6c492 jens-daniel-mueller 2022-09-09 adjustment counts
html 7184b6b jens-daniel-mueller 2022-09-09 Build site.
Rmd 4e4b934 jens-daniel-mueller 2022-09-09 data coverage time series updated
html 7cf954e jens-daniel-mueller 2022-09-08 Build site.
Rmd 6f53c28 jens-daniel-mueller 2022-09-08 column inventory uncertainty stippling added
html 4786cae jens-daniel-mueller 2022-08-29 Build site.
Rmd 0c7719a jens-daniel-mueller 2022-08-29 data coverage time series updated
html e99640e jens-daniel-mueller 2022-07-29 Build site.
html 531ecfd jens-daniel-mueller 2022-07-19 Build site.
Rmd 97dcf07 jens-daniel-mueller 2022-07-19 changed color scales
html 08c00b4 jens-daniel-mueller 2022-07-16 Build site.
html 692c937 jens-daniel-mueller 2022-07-16 Build site.
html b44c72a jens-daniel-mueller 2022-07-03 Build site.
html 6e173bf jens-daniel-mueller 2022-06-30 updated regional budget plots
html f09080e jens-daniel-mueller 2022-06-28 Build site.
Rmd d457610 jens-daniel-mueller 2022-06-28 save figures for publication
html a13a7cf jens-daniel-mueller 2022-06-28 Build site.
html b52b159 jens-daniel-mueller 2022-06-27 Build site.
html 09b0780 jens-daniel-mueller 2022-05-24 Build site.
html 25da2fb jens-daniel-mueller 2022-05-24 Build site.
Rmd aba19e4 jens-daniel-mueller 2022-05-24 rebuild with multi model assesment
html e09320d jens-daniel-mueller 2022-04-12 Build site.
html 8dca96a jens-daniel-mueller 2022-04-12 Build site.
html acad2e2 jens-daniel-mueller 2022-04-09 Build site.
html c3a6238 jens-daniel-mueller 2022-03-08 Build site.
html 565224d jens-daniel-mueller 2022-02-17 Build site.
Rmd 33422e3 jens-daniel-mueller 2022-02-17 scaled budgets to global coverage
html a246221 jens-daniel-mueller 2022-02-04 Build site.
Rmd 4874b3b jens-daniel-mueller 2022-02-04 new coaverage map
html d2191ad jens-daniel-mueller 2022-02-04 Build site.
Rmd 79a54fe jens-daniel-mueller 2022-02-04 new coaverage map
html accfd87 jens-daniel-mueller 2022-02-01 Build site.
Rmd afc3d83 jens-daniel-mueller 2022-02-01 plot 5 basin map
html de557de jens-daniel-mueller 2022-01-28 Build site.
html 9753eb8 jens-daniel-mueller 2022-01-26 Build site.
html f347cd7 jens-daniel-mueller 2022-01-18 Build site.
Rmd 86b711c jens-daniel-mueller 2022-01-18 plot hemisphere budgets and publication results
html 513630f jens-daniel-mueller 2022-01-18 Build site.
html d7dfc7c jens-daniel-mueller 2022-01-18 Build site.
html 269809e jens-daniel-mueller 2022-01-12 Build site.
html 1696b98 jens-daniel-mueller 2022-01-11 Build site.
html 570e738 jens-daniel-mueller 2022-01-10 Build site.
Rmd d3903e6 jens-daniel-mueller 2022-01-10 rebuild with child docs
html 7e0a36b jens-daniel-mueller 2021-11-21 Build site.
html e505a4b jens-daniel-mueller 2021-11-09 Build site.
html 18f801f jens-daniel-mueller 2021-11-03 Build site.
Rmd 0ff2960 jens-daniel-mueller 2021-11-03 updated plots
html e1743e7 jens-daniel-mueller 2021-11-03 Build site.
Rmd 2441237 jens-daniel-mueller 2021-11-03 updated plots
html f7c3da2 jens-daniel-mueller 2021-11-03 Build site.
html e534f51 jens-daniel-mueller 2021-11-02 Build site.
html 57cfc36 jens-daniel-mueller 2021-11-01 Build site.
html 4331a22 jens-daniel-mueller 2021-10-29 Build site.
html ae5ae64 jens-daniel-mueller 2021-10-26 Build site.
html 581baa0 jens-daniel-mueller 2021-10-07 Build site.
html a7af62f jens-daniel-mueller 2021-10-06 Build site.
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

version_id_pattern <- "103"

# identify required version IDs

Version_IDs_1 <- list.files(path = "/nfs/kryo/work/jenmueller/emlr_cant/observations",
                            pattern = paste0("v_1", version_id_pattern))

Version_IDs_2 <- list.files(path = "/nfs/kryo/work/jenmueller/emlr_cant/observations",
                            pattern = paste0("v_2", version_id_pattern))

Version_IDs_3 <- list.files(path = "/nfs/kryo/work/jenmueller/emlr_cant/observations",
                            pattern = paste0("v_3", version_id_pattern))

Version_IDs <- c(Version_IDs_1, Version_IDs_2, Version_IDs_3)
for (i_Version_IDs in Version_IDs) {
  
  path_version_data     <-
    paste(path_observations,
          i_Version_IDs,
          "/data/",
          sep = "")
  
  params_local <-
    read_rds(paste(path_version_data,
                   "params_local.rds",
                   sep = ""))
  
  params_local <- bind_cols(
    Version_ID = i_Version_IDs,
    tref1 = params_local$tref1,
    tref2 = params_local$tref2,
    MLR_basins = params_local$MLR_basins
  )
  
  tref <- read_csv(paste(path_version_data,
                         "tref.csv",
                         sep = ""))
  
  params_local <- params_local %>%
    mutate(
      median_year_1 = sort(tref$median_year)[1],
      median_year_2 = sort(tref$median_year)[2],
      duration = median_year_2 - median_year_1,
      period = paste(median_year_1, "-", median_year_2)
    )
  
  if (exists("params_local_all_ensemble")) {
    params_local_all_ensemble <- bind_rows(params_local_all_ensemble, params_local)
  }
  
  if (!exists("params_local_all_ensemble")) {
    params_local_all_ensemble <- params_local
  }
  
  
}

rm(params_local,
   tref)


params_local_all_ensemble <- params_local_all_ensemble %>%
  select(Version_ID, period, MLR_basins, tref1, tref2)

params_local_all_ensemble <-
  params_local_all_ensemble %>%
  mutate(
    Version_ID_group = str_sub(Version_ID, 4, 4),
    Version_ID_group = case_when(
      Version_ID_group == "1" ~ "Bulk adjustment",
      Version_ID_group == "c" ~ "Cruise adjustment",
      Version_ID_group == "d" ~ "No adjustment",
      Version_ID_group == "g" ~ "No gap filling",
      Version_ID_group == "o" ~ "Reoccupation filter",
      Version_ID_group == "e" ~ "Surface eMLR(C*)",
      Version_ID_group == "n" ~ "C*(N)",
      TRUE ~ Version_ID_group
    )
  )

params_local_all_ensemble <-
  params_local_all_ensemble %>%
  mutate(
    MLR_basins = case_when(
      MLR_basins == "AIP" ~ "3",
      MLR_basins == "SO_AIP" ~ "3+SO",
      MLR_basins == "SO_5" ~ "5+SO",
      TRUE ~ MLR_basins
    )
  )


params_local_all <- params_local_all_ensemble %>% 
  filter(Version_ID %in% Version_IDs)

1.1 Periods

two_decades <- unique(params_local_all_ensemble$period)[1:2]

1.2 Observations coverage

for (i_Version_IDs in Version_IDs) {
  # i_Version_IDs <- Version_IDs[1]
  
  path_version_data     <-
    paste(path_observations,
          i_Version_IDs,
          "/data/",
          sep = "")
  
  # read cleaned GLODAP files
  GLODAP <- read_csv(paste(
    path_version_data,
    "GLODAPv2.2020_clean.csv",
    sep = ""
  ))
  
  GLODAP <- GLODAP %>%
    mutate(Version_ID = i_Version_IDs)
  
  if (exists("GLODAP_all")) {
    GLODAP_all <-
      bind_rows(GLODAP_all, GLODAP)
  }
  
  if (!exists("GLODAP_all")) {
    GLODAP_all <- GLODAP
  }

  
  # read cleaned GLODAP_flagging_stats files
  GLODAP_flagging_stats <- read_csv(paste(
    path_version_data,
    "GLODAP_flagging_stats.csv",
    sep = ""
  ))
  
  GLODAP_flagging_stats <- GLODAP_flagging_stats %>%
    mutate(Version_ID = i_Version_IDs)
  
  if (exists("GLODAP_flagging_stats_all")) {
    GLODAP_flagging_stats_all <-
      bind_rows(GLODAP_flagging_stats_all, GLODAP_flagging_stats)
  }
  
  if (!exists("GLODAP_flagging_stats_all")) {
    GLODAP_flagging_stats_all <- GLODAP_flagging_stats
  }
  
  # read cleaned GLODAP_adjustment_stats files
  GLODAP_adjustment_stats <- read_csv(paste(
    path_version_data,
    "GLODAP_adjustment_stats.csv",
    sep = ""
  ))
  
  GLODAP_adjustment_stats <- GLODAP_adjustment_stats %>%
    mutate(Version_ID = i_Version_IDs)
  
  if (exists("GLODAP_adjustment_stats_all")) {
    GLODAP_adjustment_stats_all <-
      bind_rows(GLODAP_adjustment_stats_all, GLODAP_adjustment_stats)
  }
  
  if (!exists("GLODAP_adjustment_stats_all")) {
    GLODAP_adjustment_stats_all <- GLODAP_adjustment_stats
  }
  
  # read cleaned GLODAP_CanyonB_filling_stats files
  GLODAP_CanyonB_filling_stats <- read_csv(paste(
    path_version_data,
    "GLODAP_CanyonB_filling_stats.csv",
    sep = ""
  ))
  
  GLODAP_CanyonB_filling_stats <- GLODAP_CanyonB_filling_stats %>%
    mutate(Version_ID = i_Version_IDs)
  
  if (exists("GLODAP_CanyonB_filling_stats_all")) {
    GLODAP_CanyonB_filling_stats_all <-
      bind_rows(GLODAP_CanyonB_filling_stats_all, GLODAP_CanyonB_filling_stats)
  }
  
  if (!exists("GLODAP_CanyonB_filling_stats_all")) {
    GLODAP_CanyonB_filling_stats_all <- GLODAP_CanyonB_filling_stats
  }

}


rm(
  GLODAP,
  GLODAP_adjustment_stats,
  GLODAP_CanyonB_filling_stats,
  GLODAP_flagging_stats
)

GLODAP_all <- full_join(GLODAP_all,
                        params_local_all)

GLODAP_adjustment_stats_all <-
  full_join(GLODAP_adjustment_stats_all,
            params_local_all)

GLODAP_CanyonB_filling_stats_all <-
  full_join(GLODAP_CanyonB_filling_stats_all,
            params_local_all)

GLODAP_flagging_stats_all <- full_join(GLODAP_flagging_stats_all,
                                       params_local_all)


GLODAP_expocodes <-
  read_tsv(
    paste(
      "/nfs/kryo/work/updata/glodapv2_2021/",
      "EXPOCODES.txt",
      sep = ""
    ),
    col_names = c("cruise", "cruise_expocode")
  )

GLODAP_all <-
  left_join(GLODAP_all, GLODAP_expocodes)

GLODAP_all <- GLODAP_all %>%
  filter(period %in% two_decades) %>%
  filter(!(period == "1994 - 2004" &
             era == "2000-2009"))

2 Adjustment stats

GLODAP_adjustment_stats_all %>% 
  group_by(era, period, adjustment, group) %>% 
  summarise(n = sum(n)) %>% 
  ungroup() %>% 
  filter(adjustment == "yes") %>% 
  filter(period %in% two_decades) %>%
  filter(!(period == "1994 - 2004" &
             era == "2000-2009")) %>% 
  summarise(n = sum(n))
# A tibble: 1 × 1
      n
  <dbl>
1 50482
GLODAP_flagging_stats_all %>% 
  filter(group == "filled")
# A tibble: 4 × 10
  group  era           n criterion Version_ID period      MLR_basins tref1 tref2
  <chr>  <chr>     <dbl> <chr>     <chr>      <chr>       <chr>      <dbl> <dbl>
1 filled 1989-1999  2244 f_flag    v_2103     1994 - 2004 3           1994  2004
2 filled 1989-1999  5365 qc_flag   v_2103     1994 - 2004 3           1994  2004
3 filled 1989-1999  2244 f_flag    v_3103     1994 - 2014 3           1994  2014
4 filled 1989-1999  5365 qc_flag   v_3103     1994 - 2014 3           1994  2014
# … with 1 more variable: Version_ID_group <chr>
GLODAP_CanyonB_filling_stats_all %>%
  group_by(era, period, parameter, filling) %>%
  summarise(n = sum(n)) %>%
  ungroup() %>% 
  filter(filling == "filled") %>%
  filter(period %in% two_decades) %>%
  filter(!(period == "1994 - 2004" &
             era == "2000-2009")) %>% 
  summarise(n = sum(n))
# A tibble: 1 × 1
      n
  <dbl>
1  7305
  # ggplot(aes(parameter, n, fill = filling)) +
  # coord_flip() +
  # geom_col() +
  # facet_grid(era~period) +
  # scale_fill_brewer(palette = "Dark2")
GLODAP_preprocessed <-
  read_csv(
    paste(
      path_preprocessing,
      "GLODAPv2.2021_preprocessed.csv",
      sep = ""
    )
  )
# land sea mask
landseamask <-
  read_csv(paste(path_files,
                  "land_sea_mask_WOA18.csv",
                  sep = ""))

3 Time series histogram

time_histo <- GLODAP_preprocessed %>% 
  drop_na() %>% 
  mutate(version = if_else(cruise <1000, "Gruber et al. (2019)", 
                           "New observations"),
         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)", 
                           "New observations"),
         version = if_else(cruise %in% c(1041, 1042), "Gruber et al. (2019)", version)) %>% 
  count(version)

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, 2021)) +
  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 %>%
  mutate(version = fct_rev(version)) %>% 
  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, 2021)) +
  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
p_time_histo_all


# ggsave(plot = p_time_histo_G19,
#        path = here::here("output/publication"),
#        filename = "time_histo_G19.png",
#        height = 2,
#        width = 10)

# ggsave(plot = p_time_histo_all,
#        path = here::here("output/publication"),
#        filename = "FigS_coverage_time_series.png",
#        height = 4,
#        width = 10)

rm(
p_time_histo_G19,
p_time_histo_all
)
GLODAP_all <-
  inner_join(GLODAP_all %>% select(-basin),
             basinmask_05)


time_histo <- GLODAP_all %>%
  count(year, basin) %>%
  mutate(basin = fct_relevel(
    basin,
    "N. Pacific",
    "S. Pacific",
    "N. Atlantic",
    "S. Atlantic",
    "Indian"
  ))

p_time_histo_basin <-
  time_histo %>%
  ggplot() +
  annotate("rect", xmin = 1999.5, xmax=2009.5,
                ymin = 0, ymax = Inf,
            fill = "black", alpha = 0.2, col="transparent") +
  geom_col(
    aes(year, n, fill = basin),
    col = "grey20",
    # fill = "grey50",
    size = 0.3,
    width = 0.7
  ) +
  scale_fill_brewer(palette = "Paired") +
  scale_x_continuous(breaks = seq(1994, 2014, 10)) +
  scale_y_continuous(limits = c(0, NA), expand = c(0, 0)) +
  labs(y = "Observations per year") +
  # facet_grid(basin~.)+
  theme(axis.title.x = element_blank(),
        panel.grid.minor = element_blank(),
        legend.title = element_blank(),
        legend.position = c(0.08,0.67),
        legend.background = element_rect(fill = "transparent"))

p_time_histo_basin

Version Author Date
7184b6b jens-daniel-mueller 2022-09-09
4786cae jens-daniel-mueller 2022-08-29
531ecfd jens-daniel-mueller 2022-07-19
acad2e2 jens-daniel-mueller 2022-04-09
d2191ad jens-daniel-mueller 2022-02-04
18f801f jens-daniel-mueller 2021-11-03
e1743e7 jens-daniel-mueller 2021-11-03
# ggsave(plot = p_time_histo_basin,
#        path = here::here("output/publication"),
#        filename = "FigS_observations_coverage_time_series.png",
#        height = 6,
#        width = 7)

# rm(p_time_histo_basin)
time_histo %>% 
  summarise(n = sum(n))
# A tibble: 1 × 1
       n
   <int>
1 206836
GLODAP_all %>% 
  count(era)
# A tibble: 3 × 2
  era           n
  <chr>     <int>
1 1989-1999 50336
2 2000-2009 71398
3 2010-2020 85102

4 Coverage maps

cruises_phosphate_gap_fill <-
  c("33MW19930704",
    "33RO20030604",
    "33RO20050111",
    "33RO19980123")

cruises_talk_gap_fill <-
  c("06AQ19980328")

cruises_talk_calc <-
  c("06MT19900123",
    "316N19920502",
    "316N19921006")

GLODAP_all_coverage <- GLODAP_all %>% 
  distinct(lat, lon, era, cruise_expocode) %>% 
  mutate(gap_filling = case_when(
    cruise_expocode %in% cruises_phosphate_gap_fill ~ "Phosphate from CANYON-B",
    cruise_expocode %in% cruises_talk_gap_fill ~ "TA from CANYON-B",
    cruise_expocode %in% cruises_talk_calc ~ "TA calculated from other variables",
    cruise_expocode %in% "31DS19940126" ~ "Nitrate qc-flag not met",
    TRUE ~ "All quality criteria fulfilled"
  )) %>% 
  distinct(lat, lon, era, gap_filling)

colour("bright")(7)
     blue       red     green    yellow      cyan    purple      grey 
"#4477AA" "#EE6677" "#228833" "#CCBB44" "#66CCEE" "#AA3377" "#BBBBBB" 
attr(,"missing")
[1] NA
coverage_map <- map +
  geom_tile(data = GLODAP_all_coverage,
            aes(lon, lat,
            fill = gap_filling, col = gap_filling)) +
  facet_wrap( ~ era, ncol = 2) +
  scale_color_okabeito() +
  scale_fill_okabeito() +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank(),
        legend.position = c(0.7,0.3),
        legend.title = element_blank())

wrap_plots(p_time_histo_basin,
           coverage_map, ncol = 1) +
  plot_layout(heights = c(1, 2))  +
  plot_annotation(tag_levels = 'A')

Version Author Date
ec60f68 jens-daniel-mueller 2022-11-07
5d06b07 jens-daniel-mueller 2022-10-07
7184b6b jens-daniel-mueller 2022-09-09
acad2e2 jens-daniel-mueller 2022-04-09
c3a6238 jens-daniel-mueller 2022-03-08
d2191ad jens-daniel-mueller 2022-02-04
e1743e7 jens-daniel-mueller 2021-11-03
ae93565 jens-daniel-mueller 2021-09-29
ggsave(
  path = here::here("output/publication"),
  filename = "Fig_observations_coverage.png",
  height = 7,
  width = 9
)

rm(coverage_map, 
   GLODAP_all_coverage, GLODAP_expocodes,
   GLODAP_grid_era_all)


rm(cruises_phosphate_gap_fill,
   cruises_talk_gap_fill,
   cruises_talk_calc)

5 Basin maps

5.1 MLR basins

basinmask <- basinmask %>% 
  mutate(
    MLR_basins = case_when(
      MLR_basins == "AIP" ~ "3",
      MLR_basins == "SO_AIP" ~ "3+SO",
      MLR_basins == "SO_5" ~ "5+SO",
      TRUE ~ MLR_basins
    )
  )


MLR_basins_in <- c("1", "2", "3", "5", "3+SO", "5+SO")

basinmask <- basinmask %>%
  filter(MLR_basins %in% MLR_basins_in)

basinmask <- basinmask %>% 
  group_by(MLR_basins) %>% 
  mutate(basin = as.character(as.numeric(as.factor(basin)))) %>% 
  ungroup()


basin_maps <-
  map +
  geom_raster(data = basinmask,
              aes(lon, lat, fill = basin)) +
  scale_fill_muted(guide = "none") +
  facet_wrap( ~ MLR_basins) +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank())

basin_maps

Version Author Date
ec60f68 jens-daniel-mueller 2022-11-07
531ecfd jens-daniel-mueller 2022-07-19
b52b159 jens-daniel-mueller 2022-06-27
09b0780 jens-daniel-mueller 2022-05-24
acad2e2 jens-daniel-mueller 2022-04-09
c3a6238 jens-daniel-mueller 2022-03-08
d2191ad jens-daniel-mueller 2022-02-04
ggsave(plot = basin_maps,
       path = here::here("output/publication"),
       filename = "FigS_basin_masks.png",
       height = 4,
       width = 10)

5.2 5 basins

MLR_basins_in <- c("5")

basinmask <- basinmask %>%
  filter(MLR_basins %in% MLR_basins_in)

basinmask <- basinmask %>% 
  group_by(MLR_basins) %>% 
  mutate(basin = as.character(as.numeric(as.factor(basin)))) %>% 
  ungroup()


basinmask <- basinmask %>%
  mutate(
    basin = fct_recode(
      basin,
      "N. Pacific" = "3",
      "S. Pacific" = "5",
      "N. Atlantic" = "2",
      "S. Atlantic" = "4",
      "Indian" = "1"
    )
  )

basinmask <- basinmask %>%
  mutate(basin = fct_relevel(
    basin,
    "N. Pacific",
    "S. Pacific",
    "N. Atlantic",
    "S. Atlantic",
    "Indian"
  ))

basin_maps <-
  map +
  geom_raster(data = basinmask,
              aes(lon, lat, fill = basin)) +
  scale_fill_bright(guide = "none") +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank(),
        legend.title = element_blank())

basin_maps

Version Author Date
ec60f68 jens-daniel-mueller 2022-11-07
531ecfd jens-daniel-mueller 2022-07-19
acad2e2 jens-daniel-mueller 2022-04-09
c3a6238 jens-daniel-mueller 2022-03-08
accfd87 jens-daniel-mueller 2022-02-01
# ggsave(plot = basin_maps,
#        path = here::here("output/publication"),
#        filename = "FigS_basin_mask_5.png",
#        height = 5,
#        width = 10)

5.3 Area scaling

mapped_ocean_mask <- full_join(
  landseamask %>% 
    filter(region == "ocean") %>% 
    select(lon, lat),
  basinmask %>% 
    select(lon, lat) %>% 
    mutate(mapped_ocean = "1")
) %>% 
  mutate(mapped_ocean = replace_na(mapped_ocean, 0))


map +
  geom_raster(data = mapped_ocean_mask,
              aes(lon, lat, fill = mapped_ocean)) +
  scale_fill_brewer(palette = "Set1") +
  theme(
    axis.text = element_blank(),
    axis.ticks = element_blank()
  )

Version Author Date
ec60f68 jens-daniel-mueller 2022-11-07
acad2e2 jens-daniel-mueller 2022-04-09
c3a6238 jens-daniel-mueller 2022-03-08
565224d jens-daniel-mueller 2022-02-17
mapped_ocean_mask %>% 
  mutate(surface_area = earth_surf(lat, lon)) %>% 
  group_by(mapped_ocean) %>% 
  summarise(surface_area = sum(surface_area)) %>% 
  ungroup() %>% 
  mutate(surface_area_ratio = surface_area / lead(surface_area))
# A tibble: 2 × 3
  mapped_ocean surface_area surface_area_ratio
  <chr>               <dbl>              <dbl>
1 0                 4.17e12             0.0125
2 1                 3.34e14            NA     

6 coverage maps all

GLODAP_era_grid <- GLODAP_all %>% 
  group_by(lon, lat, era) %>% 
  summarise(year_max = max(year),
            year_min = min(year)) %>% 
  ungroup() %>% 
  drop_na()

coverage_map <-
  map +
  geom_tile(data = GLODAP_era_grid,
              aes(lon, lat, 
              fill = "X")) +
  scale_fill_brewer(palette = "Dark2", guide = "none") +
  facet_wrap(~ era, ncol = 2) +
  theme(axis.text = element_blank(),
        axis.ticks = element_blank(),
        panel.grid = element_blank())

coverage_map

Version Author Date
7184b6b jens-daniel-mueller 2022-09-09

sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.3

Matrix products: default
BLAS:   /usr/local/R-4.1.2/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R-4.1.2/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] khroma_1.9.0       geomtextpath_0.1.0 colorspace_2.0-2   marelac_2.1.10    
 [5] shape_1.4.6        ggforce_0.3.3      metR_0.11.0        scico_1.3.0       
 [9] patchwork_1.1.1    collapse_1.7.0     forcats_0.5.1      stringr_1.4.0     
[13] dplyr_1.0.7        purrr_0.3.4        readr_2.1.1        tidyr_1.1.4       
[17] tibble_3.1.6       ggplot2_3.3.5      tidyverse_1.3.1    workflowr_1.7.0   

loaded via a namespace (and not attached):
 [1] fs_1.5.2           bit64_4.0.5        lubridate_1.8.0    gsw_1.0-6         
 [5] RColorBrewer_1.1-2 httr_1.4.2         rprojroot_2.0.2    tools_4.1.2       
 [9] backports_1.4.1    bslib_0.3.1        utf8_1.2.2         R6_2.5.1          
[13] DBI_1.1.2          withr_2.4.3        tidyselect_1.1.1   processx_3.5.2    
[17] bit_4.0.4          compiler_4.1.2     git2r_0.29.0       textshaping_0.3.6 
[21] cli_3.1.1          rvest_1.0.2        xml2_1.3.3         labeling_0.4.2    
[25] sass_0.4.0         scales_1.1.1       checkmate_2.0.0    SolveSAPHE_2.1.0  
[29] callr_3.7.0        systemfonts_1.0.3  digest_0.6.29      rmarkdown_2.11    
[33] oce_1.5-0          pkgconfig_2.0.3    htmltools_0.5.2    highr_0.9         
[37] dbplyr_2.1.1       fastmap_1.1.0      rlang_1.0.2        readxl_1.3.1      
[41] rstudioapi_0.13    jquerylib_0.1.4    generics_0.1.1     farver_2.1.0      
[45] jsonlite_1.7.3     vroom_1.5.7        magrittr_2.0.1     Rcpp_1.0.8        
[49] munsell_0.5.0      fansi_1.0.2        lifecycle_1.0.1    stringi_1.7.6     
[53] whisker_0.4        yaml_2.2.1         MASS_7.3-55        grid_4.1.2        
[57] parallel_4.1.2     promises_1.2.0.1   crayon_1.4.2       haven_2.4.3       
[61] hms_1.1.1          seacarb_3.3.0      knitr_1.37         ps_1.6.0          
[65] pillar_1.6.4       reprex_2.0.1       glue_1.6.0         evaluate_0.14     
[69] getPass_0.2-2      data.table_1.14.2  modelr_0.1.8       vctrs_0.3.8       
[73] tzdb_0.2.0         tweenr_1.0.2       httpuv_1.6.5       cellranger_1.1.0  
[77] gtable_0.3.0       polyclip_1.10-0    assertthat_0.2.1   xfun_0.29         
[81] broom_0.7.11       later_1.3.0        ellipsis_0.3.2     here_1.0.1