Last updated: 2022-04-13
Checks: 7 0
Knit directory: emlr_obs_preprocessing/
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(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 20ce2b7. 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/
Unstaged changes:
Modified: analysis/_site.yml
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_RECCAP2_flux_products.Rmd
) and HTML (docs/read_RECCAP2_flux_products.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 | 016bac6 | jens-daniel-mueller | 2022-04-07 | Build site. |
Rmd | 1a7cbdb | jens-daniel-mueller | 2022-04-07 | rerun all with lat max 65N and without arcic |
html | f088f55 | jens-daniel-mueller | 2022-04-01 | Build site. |
html | 569e06b | jens-daniel-mueller | 2022-04-01 | Build site. |
html | 2565e71 | jens-daniel-mueller | 2022-02-17 | Build site. |
Rmd | 78b36b3 | jens-daniel-mueller | 2022-02-17 | read Seaflux data |
html | 163d599 | jens-daniel-mueller | 2022-02-17 | Build site. |
Rmd | 7611648 | jens-daniel-mueller | 2022-02-17 | read Seaflux data |
html | 6e65117 | jens-daniel-mueller | 2022-02-16 | Build site. |
html | 008f1c0 | jens-daniel-mueller | 2022-02-15 | Build site. |
Rmd | 5e4080a | jens-daniel-mueller | 2022-02-15 | testrun new script |
products <- list.files(path_reccap2_surface_co2)
products <-
products[!str_detect(products, pattern = "\\.")]
# Remove data sets that do not meet formatting requirements
products <-
products[!str_detect(products, pattern = "JMAMLR_v20210312")]
products <-
products[!str_detect(products, pattern = "JMAMLR_v20211202")]
products <-
products[!str_detect(products, pattern = "LDEO_2021_clim_RECCAP2_v20210702")]
products <-
products[!str_detect(products, pattern = "spco2_LDEO_HPD_1985-2018_v20211210")]
products <-
products[!str_detect(products, pattern = "NIES-nn_v202011")]
products <-
products[!str_detect(products, pattern = "SOMFFN_v20211121")]
products <-
products[!str_detect(products, pattern = "AOML_EXTRAT_v20211130")]
products <-
products[!str_detect(products, pattern = "archive")]
### loop
for (i_products in products) {
# i_products <- products[5]
path_product <- paste(path_reccap2_surface_co2,
i_products,
sep = "/")
product_file_name <-
list.files(path_product, pattern = "fgco2_glob")
RECCAP2 <-
tidync(paste(path_product,
product_file_name,
sep = "/"))
RECCAP2 <- RECCAP2 %>%
hyper_tibble()
RECCAP2 <- RECCAP2 %>%
mutate(product = i_products)
if (exists("RECCAP2_all")) {
RECCAP2_all <- bind_rows(RECCAP2_all, RECCAP2)
}
if (!exists("RECCAP2_all")) {
RECCAP2_all <- RECCAP2
}
}
SeaFlux_file_name <- paste0(path_seaflux_surface_co2,
"SeaFlux_v2021.04_fgco2_global.nc")
SeaFlux <-
tidync(SeaFlux_file_name) %>%
hyper_tibble()
ncmeta::nc_atts(SeaFlux_file_name)
# A tibble: 9 × 4
id name variable value
<int> <chr> <chr> <named list>
1 0 units time <chr [1]>
2 1 calendar time <chr [1]>
3 0 description wind <chr [1]>
4 0 description product <chr [1]>
5 0 _FillValue fgco2_global <dbl [1]>
6 1 units fgco2_global <chr [1]>
7 2 long_name fgco2_global <chr [1]>
8 3 product fgco2_global <chr [1]>
9 4 description fgco2_global <chr [1]>
ncmeta::nc_atts(SeaFlux_file_name, "time") %>% tidyr::unnest(cols = c(value))
# A tibble: 2 × 4
id name variable value
<int> <chr> <chr> <chr>
1 0 units time days since 1982-01-15
2 1 calendar time proleptic_gregorian
SeaFlux <- SeaFlux %>%
mutate(date = as.Date(time, origin = '1982-01-15'),
year = year(date))
RECCAP2_all <- RECCAP2_all %>%
mutate(date = as.Date(time, origin = '1980-01-01'),
year = year(date)) %>%
select(product, year, date, fgco2_glob)
RECCAP2_all %>%
ggplot(aes(date, fgco2_glob, col=product)) +
geom_line() +
theme(legend.position = "bottom")
RECCAP2_all_annual <- RECCAP2_all %>%
group_by(year, product) %>%
summarise(fgco2_glob = mean(fgco2_glob)) %>%
ungroup()
RECCAP2_all_annual %>%
ggplot(aes(year, fgco2_glob, col=product)) +
geom_line() +
theme(legend.position = "bottom")
RECCAP2_all_annual_cum_1994 <- RECCAP2_all_annual %>%
filter(year >= 1994) %>%
arrange(year) %>%
group_by(product) %>%
mutate(fgco2_glob_cum = cumsum(fgco2_glob)) %>%
ungroup()
RECCAP2_all_annual_cum_1994 %>%
ggplot(aes(year, fgco2_glob_cum, col = product)) +
geom_line() +
geom_point(shape = 21, fill = "white") +
theme(legend.position = "bottom")
RECCAP2_all_annual_ensemble <- RECCAP2_all_annual %>%
filter(product != "UOEX_Wat20_1985_2019_v20211204") %>%
group_by(year) %>%
summarise(fgco2_glob_sd = sd(fgco2_glob),
fgco2_glob = mean(fgco2_glob)) %>%
ungroup()
ggplot() +
geom_ribbon(
data =
RECCAP2_all_annual_ensemble,
aes(
year,
ymax = fgco2_glob + fgco2_glob_sd,
ymin = fgco2_glob - fgco2_glob_sd,
fill = "ensemble SD"
), alpha = 0.3
) +
geom_line(data =
RECCAP2_all_annual,
aes(year, fgco2_glob, group = product, col = "individual products")) +
geom_line(data =
RECCAP2_all_annual_ensemble,
aes(year, fgco2_glob, col = "ensemble mean"), size = 1) +
scale_fill_manual(values = "red") +
scale_color_manual(values = c("red", "grey50")) +
theme(legend.position = "bottom",
legend.title = element_blank())
SeaFlux <- SeaFlux %>%
mutate(fgco2_glob = -fgco2_global) %>%
select(product, wind, year, date, fgco2_glob)
SeaFlux %>%
ggplot(aes(date, fgco2_glob, col=wind)) +
geom_line() +
theme(legend.position = "bottom") +
facet_wrap(~ product)
Version | Author | Date |
---|---|---|
163d599 | jens-daniel-mueller | 2022-02-17 |
SeaFlux_annual <- SeaFlux %>%
filter(wind %in% c("CCMP2", "ERA5", "JRA55")) %>%
group_by(year, product) %>%
summarise(fgco2_glob = mean(fgco2_glob)) %>%
ungroup()
SeaFlux_annual %>%
ggplot(aes(year, fgco2_glob, col=product)) +
geom_line() +
theme(legend.position = "bottom")
Version | Author | Date |
---|---|---|
163d599 | jens-daniel-mueller | 2022-02-17 |
SeaFlux_annual_cum_1994 <- SeaFlux_annual %>%
filter(year >= 1994) %>%
arrange(year) %>%
group_by(product) %>%
mutate(fgco2_glob_cum = cumsum(fgco2_glob)) %>%
ungroup()
SeaFlux_annual_cum_1994 %>%
ggplot(aes(year, fgco2_glob_cum, col = product)) +
geom_line() +
geom_point(shape = 21, fill = "white") +
theme(legend.position = "bottom")
Version | Author | Date |
---|---|---|
163d599 | jens-daniel-mueller | 2022-02-17 |
SeaFlux_annual_ensemble <- SeaFlux_annual %>%
group_by(year) %>%
summarise(fgco2_glob_sd = sd(fgco2_glob),
fgco2_glob = mean(fgco2_glob)) %>%
ungroup()
ggplot() +
geom_ribbon(
data =
SeaFlux_annual_ensemble,
aes(
year,
ymax = fgco2_glob + fgco2_glob_sd,
ymin = fgco2_glob - fgco2_glob_sd,
fill = "ensemble SD"
), alpha = 0.3
) +
geom_line(data =
SeaFlux_annual,
aes(year, fgco2_glob, group = product, col = "individual products")) +
geom_line(data =
SeaFlux_annual_ensemble,
aes(year, fgco2_glob, col = "ensemble mean"), size = 1) +
scale_fill_manual(values = "red") +
scale_color_manual(values = c("red", "grey50")) +
theme(legend.position = "bottom",
legend.title = element_blank())
Version | Author | Date |
---|---|---|
163d599 | jens-daniel-mueller | 2022-02-17 |
ggplot() +
geom_line(data = SeaFlux_annual,
aes(year, fgco2_glob, group = product,
col = "Seaflux")) +
geom_line(data = RECCAP2_all_annual,
aes(year, fgco2_glob, group = product,
col = "RECCAP2")) +
scale_color_brewer(palette = "Dark2") +
theme(legend.position = "bottom",
legend.title = element_blank())
ggplot() +
geom_line(data = SeaFlux_annual_cum_1994,
aes(year, fgco2_glob_cum, group = product,
col = "Seaflux")) +
geom_line(data = RECCAP2_all_annual_cum_1994,
aes(year, fgco2_glob_cum, group = product,
col = "RECCAP2")) +
scale_color_brewer(palette = "Dark2") +
theme(legend.position = "bottom",
legend.title = element_blank())
RECCAP2_all %>%
write_csv(paste0(path_preprocessing,
"fgco2_glob_RECCAP2_all.csv"))
RECCAP2_all_annual %>%
write_csv(paste0(path_preprocessing,
"fgco2_glob_RECCAP2_all_annual.csv"))
SeaFlux %>%
write_csv(paste0(path_preprocessing,
"fgco2_glob_Seaflux.csv"))
SeaFlux_annual %>%
write_csv(paste0(path_preprocessing,
"fgco2_glob_Seaflux_annual.csv"))
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] lubridate_1.8.0 tidync_0.2.4 ggforce_0.3.3 metR_0.11.0
[5] scico_1.3.0 patchwork_1.1.1 collapse_1.7.0 forcats_0.5.1
[9] stringr_1.4.0 dplyr_1.0.7 purrr_0.3.4 readr_2.1.1
[13] tidyr_1.1.4 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
[17] workflowr_1.7.0
loaded via a namespace (and not attached):
[1] fs_1.5.2 bit64_4.0.5 RColorBrewer_1.1-2 httr_1.4.2
[5] rprojroot_2.0.2 tools_4.1.2 backports_1.4.1 bslib_0.3.1
[9] utf8_1.2.2 R6_2.5.1 DBI_1.1.2 colorspace_2.0-2
[13] withr_2.4.3 tidyselect_1.1.1 processx_3.5.2 bit_4.0.4
[17] compiler_4.1.2 git2r_0.29.0 cli_3.1.1 rvest_1.0.2
[21] RNetCDF_2.5-2 xml2_1.3.3 labeling_0.4.2 sass_0.4.0
[25] scales_1.1.1 checkmate_2.0.0 callr_3.7.0 digest_0.6.29
[29] rmarkdown_2.11 pkgconfig_2.0.3 htmltools_0.5.2 highr_0.9
[33] dbplyr_2.1.1 fastmap_1.1.0 rlang_0.4.12 readxl_1.3.1
[37] rstudioapi_0.13 jquerylib_0.1.4 generics_0.1.1 farver_2.1.0
[41] jsonlite_1.7.3 vroom_1.5.7 magrittr_2.0.1 ncmeta_0.3.0
[45] Rcpp_1.0.8 munsell_0.5.0 fansi_1.0.2 lifecycle_1.0.1
[49] stringi_1.7.6 whisker_0.4 yaml_2.2.1 MASS_7.3-55
[53] grid_4.1.2 parallel_4.1.2 promises_1.2.0.1 crayon_1.4.2
[57] haven_2.4.3 hms_1.1.1 knitr_1.37 ps_1.6.0
[61] pillar_1.6.4 reprex_2.0.1 glue_1.6.0 evaluate_0.14
[65] getPass_0.2-2 data.table_1.14.2 modelr_0.1.8 vctrs_0.3.8
[69] tzdb_0.2.0 tweenr_1.0.2 httpuv_1.6.5 cellranger_1.1.0
[73] gtable_0.3.0 polyclip_1.10-0 assertthat_0.2.1 xfun_0.29
[77] broom_0.7.11 later_1.3.0 ncdf4_1.19 ellipsis_0.3.2