Last updated: 2021-06-02

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 9881e98. 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/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/column_inventories.Rmd) and HTML (docs/column_inventories.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
Rmd 9881e98 jens-daniel-mueller 2021-06-02 include GLODAP beta 2021 based results
html 4d8b4e7 jens-daniel-mueller 2021-06-02 Build site.
Rmd 05184e5 jens-daniel-mueller 2021-06-02 include GLODAP beta 2021 based results
html 878aef7 jens-daniel-mueller 2021-05-28 Build site.
Rmd 2c347cd jens-daniel-mueller 2021-05-28 plotted C* rmse, MLR target, vif max
html 92cae2e jens-daniel-mueller 2021-05-28 Build site.
Rmd 87a8c49 jens-daniel-mueller 2021-05-28 plotted Canyon B max
html 998f4a6 jens-daniel-mueller 2021-05-28 Build site.
Rmd 3c6f0f4 jens-daniel-mueller 2021-05-28 including cases 109-116
html a28ce5c jens-daniel-mueller 2021-05-28 Build site.
Rmd 2f6d0c0 jens-daniel-mueller 2021-05-28 including cases 109-116
html 3454b72 jens-daniel-mueller 2021-05-28 Build site.
Rmd 1b46b2a jens-daniel-mueller 2021-05-28 including cases 109-116
html db22706 jens-daniel-mueller 2021-05-28 Build site.
Rmd 9bb2f7a jens-daniel-mueller 2021-05-28 plot global budgets
html 87481da jens-daniel-mueller 2021-05-28 Build site.
Rmd 154a8fc jens-daniel-mueller 2021-05-28 plot global budgets
html bd4af9d jens-daniel-mueller 2021-05-28 Build site.
Rmd cdd2cc8 jens-daniel-mueller 2021-05-28 plot global budgets
html ee5b15d jens-daniel-mueller 2021-05-27 Build site.
Rmd 83f3e37 jens-daniel-mueller 2021-05-27 plot bias maps
html e8bd251 jens-daniel-mueller 2021-05-27 Build site.
Rmd f642ef2 jens-daniel-mueller 2021-05-27 plot bias maps
html ea0153f jens-daniel-mueller 2021-05-27 Build site.
Rmd 8b38db1 jens-daniel-mueller 2021-05-27 plot bias maps
html cf3365a jens-daniel-mueller 2021-05-27 Build site.
Rmd 2eb7603 jens-daniel-mueller 2021-05-27 plot bias maps
html 57ddd1f jens-daniel-mueller 2021-05-27 Build site.
Rmd f403434 jens-daniel-mueller 2021-05-27 sensitivity case comparison included

1 GLODAPv2.2020

2 Data preparation

2.1 Load data

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

# Version_IDs <- Version_IDs[1:length(Version_IDs)-1]

for (i_Version_IDs in Version_IDs) {
  # i_Version_IDs <- Version_IDs[1]
  
  print(i_Version_IDs)
  
  path_version_data     <-
  paste(path_observations,
        i_Version_IDs,
        "/data/",
        sep = "")
  
  cant_inv <-
    read_csv(paste(path_version_data,
                   "cant_inv.csv",
                   sep = ""))
  
  cant_inv_mod_truth <-
    read_csv(paste(path_version_data,
                   "cant_inv_mod_truth.csv",
                   sep = ""))
  
  cant_inv <- bind_rows(cant_inv, cant_inv_mod_truth)
  
  cant_inv <- cant_inv %>% 
    mutate(Version_ID = i_Version_IDs)
  
  params_local <-
    read_rds(paste(path_version_data,
                   "params_local.rds",
                   sep = ""))
  
  params_local <- bind_cols(
    Version_ID = i_Version_IDs,
    MLR_basins = params_local$MLR_basins,
    dup_era1 = str_c(params_local$dup_era1, collapse = "-"),
    MLR_target = params_local$MLR_target,
    CANYON_B_max = params_local$CANYON_B_max,
    c_star_rmse_max = params_local$c_star_rmse_max,
    vif_max = params_local$vif_max
  )
  
  cant_inv <- full_join(cant_inv, params_local)
  
  tref <- read_csv(paste(path_version_data,
                         "tref.csv",
                         sep = ""))
  
  duration <- sort(tref$median_year)[2] - sort(tref$median_year)[1]
  
  cant_inv <- cant_inv %>% 
    mutate(duration = duration)
  
  if (exists("cant_inv_all")) {
    cant_inv_all <- bind_rows(cant_inv_all, cant_inv)
  }
  
  if (!exists("cant_inv_all")) {
    cant_inv_all <- cant_inv
  }
  
  
}
[1] "v_101"
[1] "v_102"
[1] "v_103"
[1] "v_104"
[1] "v_105"
[1] "v_106"
[1] "v_107"
[1] "v_108"
[1] "v_109"
[1] "v_110"
[1] "v_111"
[1] "v_112"
[1] "v_113"
[1] "v_114"
[1] "v_115"
[1] "v_116"
rm(cant_inv)

cant_inv_all <- cant_inv_all %>% 
  rename(era_duplication = dup_era1) %>% 
  mutate(era_duplication = if_else(era_duplication == "2009-2009", "non-overlapping eras", "overlapping eras"))

2.2 Format column inventories

cant_inv_all <- cant_inv_all %>%
  filter(inv_depth == params_global$inventory_depth_standard)
cant_inv_all_bias <- cant_inv_all %>%
  select(lat, lon, data_source, cant_inv, Version_ID, 
         era_duplication, MLR_basins,
         MLR_target, CANYON_B_max, vif_max, c_star_rmse_max) %>%
  pivot_wider(names_from = data_source,
              values_from = cant_inv) %>%
  mutate(cant_bias = mod - mod_truth) %>%
  drop_na()

2.3 Calculate budgets

cant_inv_budget <- cant_inv_all %>% 
  mutate(surface_area = earth_surf(lat, lon),
         cant_inv_grid = cant_inv*surface_area,
         cant_pos_inv_grid = cant_pos_inv*surface_area) %>% 
  group_by(basin_AIP, data_source,
           Version_ID, MLR_basins,
           era_duplication, duration,
           MLR_target, CANYON_B_max, vif_max, c_star_rmse_max) %>% 
  summarise(cant_total = sum(cant_inv_grid)*12*1e-15,
            cant_total = round(cant_total,1),
            cant_pos_total = sum(cant_pos_inv_grid)*12*1e-15,
            cant_pos_total = round(cant_pos_total,1)) %>% 
  ungroup()

cant_inv_budget %>%
  group_by(data_source, Version_ID) %>%
  summarise(cant_total = sum(cant_total),
            cant_total = round(cant_total,1),
            cant_pos_total = sum(cant_pos_total),
            cant_pos_total = round(cant_pos_total,1),
            cant_total_rate = cant_total / duration,
            cant_pos_total_rate = cant_pos_total / duration) %>%
  ungroup()
# A tibble: 144 x 6
   data_source Version_ID cant_total cant_pos_total cant_total_rate
   <chr>       <chr>           <dbl>          <dbl>           <dbl>
 1 mod         v_101            14.3           16              1.79
 2 mod         v_101            14.3           16              1.79
 3 mod         v_101            14.3           16              1.79
 4 mod         v_102            19.2           20.3            2.4 
 5 mod         v_102            19.2           20.3            2.4 
 6 mod         v_102            19.2           20.3            2.4 
 7 mod         v_103            18.8           20.1            2.35
 8 mod         v_103            18.8           20.1            2.35
 9 mod         v_103            18.8           20.1            2.35
10 mod         v_104            17.2           18              2.15
# … with 134 more rows, and 1 more variable: cant_pos_total_rate <dbl>

3 MLR regions and era overlap

3.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% Version_IDs[1:8])

cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(MLR_basins ~ era_duplication)

Version Author Date
998f4a6 jens-daniel-mueller 2021-05-28
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "divergent",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(MLR_basins ~ era_duplication)

Version Author Date
4d8b4e7 jens-daniel-mueller 2021-06-02
998f4a6 jens-daniel-mueller 2021-05-28
rm(cant_inv_all_bias_sub)

3.2 Budgets

3.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% Version_IDs[1:8])

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(MLR_basins ~ era_duplication)

Version Author Date
92cae2e jens-daniel-mueller 2021-05-28
998f4a6 jens-daniel-mueller 2021-05-28

3.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(MLR_basins, era_duplication) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(era_duplication, rate, fill=MLR_basins)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1})),
       x = "") +
  scale_fill_brewer(palette = "PuBuGn")

Version Author Date
998f4a6 jens-daniel-mueller 2021-05-28
rm(cant_inv_budget_sub)

4 CANYON-B threshold

4.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% Version_IDs[c(1,11,12)])

cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(CANYON_B_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
92cae2e jens-daniel-mueller 2021-05-28
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "bias",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(CANYON_B_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
92cae2e jens-daniel-mueller 2021-05-28
rm(cant_inv_all_bias_sub)

4.2 Budgets

4.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% Version_IDs[c(1,11,12)]) %>% 
  mutate(CANYON_B_max = as.factor(CANYON_B_max))

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(CANYON_B_max ~ .)

Version Author Date
92cae2e jens-daniel-mueller 2021-05-28

4.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(CANYON_B_max) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(NA, rate, fill = CANYON_B_max)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  scale_fill_brewer(palette = "PuBuGn") +
  theme(axis.text.x = element_blank(),
        axis.title.x = element_blank(),
        axis.ticks.x = element_blank())

Version Author Date
92cae2e jens-daniel-mueller 2021-05-28
rm(cant_inv_budget_sub)

5 C* RMSE threshold

5.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% Version_IDs[c(1,13,14)])

cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(c_star_rmse_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "bias",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(c_star_rmse_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_all_bias_sub)

5.2 Budgets

5.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% Version_IDs[c(1,13,14)]) %>% 
  mutate(c_star_rmse_max = as.factor(c_star_rmse_max))

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(c_star_rmse_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28

5.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(c_star_rmse_max) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(NA, rate, fill = c_star_rmse_max)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  scale_fill_brewer(palette = "PuBuGn") +
  theme(axis.text.x = element_blank(),
        axis.title.x = element_blank(),
        axis.ticks.x = element_blank())

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_budget_sub)

6 VIF max

6.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% Version_IDs[c(1,15,16)])

cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(vif_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "bias",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(vif_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_all_bias_sub)

6.2 Budgets

6.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% Version_IDs[c(1,15,16)]) %>% 
  mutate(vif_max = as.factor(vif_max))

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(vif_max ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28

6.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(vif_max) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(NA, rate, fill = vif_max)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  scale_fill_brewer(palette = "PuBuGn") +
  theme(axis.text.x = element_blank(),
        axis.title.x = element_blank(),
        axis.ticks.x = element_blank())

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_budget_sub)

7 MLR target variable

7.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% Version_IDs[c(1,9,10)])

cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(MLR_target ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "bias",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(MLR_target ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_all_bias_sub)

7.2 Budgets

7.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% Version_IDs[c(1,9,10)]) %>% 
  mutate(MLR_target = as.factor(MLR_target))

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(MLR_target ~ .)

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28

7.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(MLR_target) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(NA, rate, fill = MLR_target)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  scale_fill_brewer(palette = "PuBuGn") +
  theme(axis.text.x = element_blank(),
        axis.title.x = element_blank(),
        axis.ticks.x = element_blank())

Version Author Date
878aef7 jens-daniel-mueller 2021-05-28
rm(cant_inv_budget_sub)

8 GLODAPv2.2021 prerelease

9 Data preparation

9.1 Load data

cant_inv_all <- cant_inv_all %>% 
  select(-era_duplication) %>% 
  mutate(GLODAPv2_version = "2020")

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

# Version_IDs <- Version_IDs[1:length(Version_IDs)-1]

for (i_Version_IDs in Version_IDs) {
  # i_Version_IDs <- Version_IDs[1]
  
  print(i_Version_IDs)
  
  path_version_data     <-
  paste(path_observations,
        i_Version_IDs,
        "/data/",
        sep = "")
  
  cant_inv <-
    read_csv(paste(path_version_data,
                   "cant_inv.csv",
                   sep = ""))
  
  cant_inv_mod_truth <-
    read_csv(paste(path_version_data,
                   "cant_inv_mod_truth.csv",
                   sep = ""))
  
  cant_inv <- bind_rows(cant_inv, cant_inv_mod_truth)
  
  cant_inv <- cant_inv %>% 
    mutate(Version_ID = i_Version_IDs)
  
  params_local <-
    read_rds(paste(path_version_data,
                   "params_local.rds",
                   sep = ""))
  
  params_local <- bind_cols(
    Version_ID = i_Version_IDs,
    MLR_basins = params_local$MLR_basins,
    MLR_target = params_local$MLR_target,
    CANYON_B_max = params_local$CANYON_B_max,
    c_star_rmse_max = params_local$c_star_rmse_max,
    vif_max = params_local$vif_max,
    GLODAPv2_version = params_local$GLODAPv2_version
  )
  
  cant_inv <- full_join(cant_inv, params_local)
  
  tref <- read_csv(paste(path_version_data,
                         "tref.csv",
                         sep = ""))
  
  duration <- sort(tref$median_year)[2] - sort(tref$median_year)[1]
  
  cant_inv <- cant_inv %>% 
    mutate(duration = duration)
  
  if (exists("cant_inv_all")) {
    cant_inv_all <- bind_rows(cant_inv_all, cant_inv)
  }
  
  if (!exists("cant_inv_all")) {
    cant_inv_all <- cant_inv
  }
  
  
}
[1] "v_201"
[1] "v_202"
[1] "v_203"
[1] "v_204"
rm(cant_inv)

9.2 Format column inventories

cant_inv_all <- cant_inv_all %>%
  filter(inv_depth == params_global$inventory_depth_standard)
cant_inv_all_bias <- cant_inv_all %>%
  select(lat, lon, data_source, cant_inv, Version_ID, 
         GLODAPv2_version, MLR_basins,
         MLR_target, CANYON_B_max, vif_max, c_star_rmse_max) %>%
  pivot_wider(names_from = data_source,
              values_from = cant_inv) %>%
  mutate(cant_bias = mod - mod_truth) %>%
  drop_na()

9.3 Calculate budgets

cant_inv_budget <- cant_inv_all %>% 
  mutate(surface_area = earth_surf(lat, lon),
         cant_inv_grid = cant_inv*surface_area,
         cant_pos_inv_grid = cant_pos_inv*surface_area) %>% 
  group_by(basin_AIP, data_source,
           Version_ID, MLR_basins,
           GLODAPv2_version, duration,
           MLR_target, CANYON_B_max, vif_max, c_star_rmse_max) %>% 
  summarise(cant_total = sum(cant_inv_grid)*12*1e-15,
            cant_total = round(cant_total,1),
            cant_pos_total = sum(cant_pos_inv_grid)*12*1e-15,
            cant_pos_total = round(cant_pos_total,1)) %>% 
  ungroup()

cant_inv_budget %>%
  group_by(data_source, Version_ID) %>%
  summarise(cant_total = sum(cant_total),
            cant_total = round(cant_total,1),
            cant_pos_total = sum(cant_pos_total),
            cant_pos_total = round(cant_pos_total,1),
            cant_total_rate = cant_total / duration,
            cant_pos_total_rate = cant_pos_total / duration) %>%
  ungroup()
# A tibble: 180 x 6
   data_source Version_ID cant_total cant_pos_total cant_total_rate
   <chr>       <chr>           <dbl>          <dbl>           <dbl>
 1 mod         v_101            14.3           16              1.79
 2 mod         v_101            14.3           16              1.79
 3 mod         v_101            14.3           16              1.79
 4 mod         v_102            19.2           20.3            2.4 
 5 mod         v_102            19.2           20.3            2.4 
 6 mod         v_102            19.2           20.3            2.4 
 7 mod         v_103            18.8           20.1            2.35
 8 mod         v_103            18.8           20.1            2.35
 9 mod         v_103            18.8           20.1            2.35
10 mod         v_104            17.2           18              2.15
# … with 170 more rows, and 1 more variable: cant_pos_total_rate <dbl>

10 MLR regions and era overlap

10.1 Column inventories

cant_inv_all_bias_sub <- cant_inv_all_bias %>%
  filter(Version_ID %in% c("v_101", "v_102", "v_103", "v_104",
                           "v_201", "v_202", "v_203", "v_204"))


cant_inv_all_bias_sub %>% 
  p_map_cant_inv(var = "obs",
                 col = "divergent",
                 subtitle_text = "data_source: observations") +
  facet_grid(MLR_basins ~ GLODAPv2_version)

Version Author Date
4d8b4e7 jens-daniel-mueller 2021-06-02
cant_inv_all_bias_sub %>%
  p_map_cant_inv(var = "cant_bias",
                 col = "divergent",
                 subtitle_text = "data_source: mod - mod_truth") +
  facet_grid(MLR_basins ~ GLODAPv2_version)

Version Author Date
4d8b4e7 jens-daniel-mueller 2021-06-02

10.2 Budgets

10.2.1 Regional

cant_inv_budget_sub <- cant_inv_budget %>%
  filter(Version_ID %in% unique(cant_inv_all_bias_sub$Version_ID))

cant_inv_budget_sub %>%
  ggplot(aes(data_source, cant_total/duration, fill = basin_AIP)) +
  scale_fill_brewer(palette = "PuBuGn") +
  geom_col(col = "black") +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1}))) +
  facet_grid(MLR_basins ~ GLODAPv2_version)

Version Author Date
4d8b4e7 jens-daniel-mueller 2021-06-02

10.2.2 Global

cant_inv_budget_sub %>%
  filter(data_source == "obs") %>% 
  group_by(MLR_basins, GLODAPv2_version) %>% 
  summarise(rate = sum(cant_total/duration)) %>% 
  ungroup() %>% 
  ggplot(aes(GLODAPv2_version, rate, fill=MLR_basins)) +
  geom_bar(stat="identity", position=position_dodge(), col="black") +
  scale_y_continuous() +
  labs(y = expression(Uptake~rate ~ (PgC ~ yr ^ {-1})),
       x = "") +
  scale_fill_brewer(palette = "PuBuGn")

Version Author Date
4d8b4e7 jens-daniel-mueller 2021-06-02
rm(cant_inv_budget_sub)

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] marelac_2.1.10  shape_1.4.5     metR_0.9.0      scico_1.2.0    
 [5] patchwork_1.1.1 collapse_1.5.0  forcats_0.5.0   stringr_1.4.0  
 [9] dplyr_1.0.5     purrr_0.3.4     readr_1.4.0     tidyr_1.1.2    
[13] tibble_3.0.4    ggplot2_3.3.3   tidyverse_1.3.0 workflowr_1.6.2

loaded via a namespace (and not attached):
 [1] httr_1.4.2               jsonlite_1.7.1           modelr_0.1.8            
 [4] assertthat_0.2.1         blob_1.2.1               cellranger_1.1.0        
 [7] yaml_2.2.1               pillar_1.4.7             backports_1.1.10        
[10] lattice_0.20-41          glue_1.4.2               RcppEigen_0.3.3.7.0     
[13] digest_0.6.27            RColorBrewer_1.1-2       promises_1.1.1          
[16] checkmate_2.0.0          rvest_0.3.6              colorspace_1.4-1        
[19] htmltools_0.5.0          httpuv_1.5.4             Matrix_1.2-18           
[22] pkgconfig_2.0.3          broom_0.7.5              seacarb_3.2.14          
[25] haven_2.3.1              scales_1.1.1             whisker_0.4             
[28] later_1.1.0.1            git2r_0.27.1             farver_2.0.3            
[31] generics_0.0.2           ellipsis_0.3.1           withr_2.3.0             
[34] cli_2.1.0                magrittr_1.5             crayon_1.3.4            
[37] readxl_1.3.1             evaluate_0.14            fs_1.5.0                
[40] fansi_0.4.1              xml2_1.3.2               RcppArmadillo_0.10.1.2.0
[43] oce_1.2-0                tools_4.0.3              data.table_1.13.2       
[46] hms_0.5.3                lifecycle_1.0.0          munsell_0.5.0           
[49] reprex_0.3.0             gsw_1.0-5                compiler_4.0.3          
[52] rlang_0.4.10             grid_4.0.3               rstudioapi_0.11         
[55] labeling_0.4.2           rmarkdown_2.5            testthat_2.3.2          
[58] gtable_0.3.0             DBI_1.1.0                R6_2.5.0                
[61] lubridate_1.7.9          knitr_1.30               utf8_1.1.4              
[64] rprojroot_2.0.2          stringi_1.5.3            parallel_4.0.3          
[67] Rcpp_1.0.5               vctrs_0.3.5              dbplyr_1.4.4            
[70] tidyselect_1.1.0         xfun_0.18