Last updated: 2022-04-29

Checks: 7 0

Knit directory: bgc_argo_r_argodata/

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(20211008) 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 8b582f0. 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:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    output/

Untracked files:
    Untracked:  code/OceanSODA_argo_extremes.R
    Untracked:  code/creating_dataframe.R
    Untracked:  code/creating_map.R
    Untracked:  code/merging_oceanSODA_Argo.R
    Untracked:  code/pH_data_timeseries.R

Unstaged changes:
    Modified:   analysis/_site.yml
    Deleted:    analysis/load_OceanSODA_biomes.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/argo_clim_pH_ucsd.Rmd) and HTML (docs/argo_clim_pH_ucsd.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 e61c08e pasqualina-vonlanthendinenna 2022-04-27 Build site.
html 10036ed pasqualina-vonlanthendinenna 2022-04-26 Build site.
html c03dd24 pasqualina-vonlanthendinenna 2022-04-20 Build site.
html 8805f99 pasqualina-vonlanthendinenna 2022-04-11 Build site.
Rmd f3ca885 pasqualina-vonlanthendinenna 2022-04-07 added OceanSODA-Argo SST comparison
html 968ad85 pasqualina-vonlanthendinenna 2022-03-29 Build site.
Rmd 5432acf pasqualina-vonlanthendinenna 2022-03-29 added january pH climatology
html dfd75e9 pasqualina-vonlanthendinenna 2022-03-29 Build site.
Rmd b9a42f9 pasqualina-vonlanthendinenna 2022-03-29 added january plots and changed pH anomaly detection to mean
html ca1bd55 pasqualina-vonlanthendinenna 2022-03-28 Build site.
Rmd 5112b5b pasqualina-vonlanthendinenna 2022-03-28 added code for reading metadata in argo_clim_pH
html b530d31 pasqualina-vonlanthendinenna 2022-03-25 Build site.
Rmd 34e771c pasqualina-vonlanthendinenna 2022-03-25 added commented out sio temp climatology
html 6dd0945 pasqualina-vonlanthendinenna 2022-03-25 Build site.
Rmd 5b93849 pasqualina-vonlanthendinenna 2022-03-25 added climatology pages

Task

Explore the January climatology of Argo pH of Matt Mazloff, UCSD

library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
✓ ggplot2 3.3.5     ✓ purrr   0.3.4
✓ tibble  3.1.6     ✓ dplyr   1.0.7
✓ tidyr   1.1.4     ✓ stringr 1.4.0
✓ readr   2.1.1     ✓ forcats 0.5.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
#library(ggOceanMaps)
library(oce)
Loading required package: gsw
#library(ncdf4)
library(stars)
Loading required package: abind
Loading required package: sf
Linking to GEOS 3.6.2, GDAL 3.2.0, PROJ 7.0.0; sf_use_s2() is TRUE
path_updata <- "/nfs/kryo/work/updata"
path_argo_clim_ph <- paste0(path_updata, "/argo_climatology/pH")
path_argo_clim_temp <- paste0(path_updata, "/argo_climatology/temperature")
path_emlr_utilities <- "/nfs/kryo/work/jenmueller/emlr_cant/utilities/files/"
path_argo <- '/nfs/kryo/work/updata/bgc_argo_r_argodata'
path_argo_preprocessed <- paste0(path_argo, "/preprocessed_bgc_data")

theme_set(theme_bw())

Read data

nc_pH <- 
read_ncdf(paste0(path_argo_clim_ph,"/PHclim_15March2022_Prelim.nc"),
                    var = c("pH"))
Warning in .get_nc_projection(meta$attribute, rep_var, all_coord_var): No
projection information found in nc file.
nc_pH <- as_tibble(nc_pH)

nc_lon <- 
read_ncdf(paste0(path_argo_clim_ph,"/PHclim_15March2022_Prelim.nc"),
                    var = c("longitude"))
Warning in .get_nc_projection(meta$attribute, rep_var, all_coord_var): No
projection information found in nc file.
nc_lon <- as_tibble(nc_lon)

nc_lat <- 
read_ncdf(paste0(path_argo_clim_ph,"/PHclim_15March2022_Prelim.nc"),
                    var = c("latitude"))
Warning in .get_nc_projection(meta$attribute, rep_var, all_coord_var): No
projection information found in nc file.
nc_lat <- as_tibble(nc_lat)

nc_depth <- 
read_ncdf(paste0(path_argo_clim_ph,"/PHclim_15March2022_Prelim.nc"),
                    var = c("depth"))
Warning in .get_nc_projection(meta$attribute, rep_var, all_coord_var): No
projection information found in nc file.
nc_depth <- as_tibble(nc_depth)

nc_pH <- nc_pH %>%
   mutate(ny = ny - 0.5,
          nx = nx - 0.5)

clim_argo_ph_jan <- full_join(nc_pH, nc_lat)
Joining, by = "ny"
clim_argo_ph_jan <- full_join(clim_argo_ph_jan, nc_lon)
Joining, by = "nx"
clim_argo_ph_jan <- full_join(clim_argo_ph_jan, nc_depth)
Joining, by = "nz"
clim_argo_ph_jan <- clim_argo_ph_jan %>%
   select(-c(starts_with("n"), "t"))

clim_argo_ph_jan <- clim_argo_ph_jan %>%
   mutate(depth = round(depth))

Maps

clim_argo_ph_jan %>%
   ggplot() +
   geom_tile(aes(longitude, latitude, fill = pH)) +
   facet_wrap(~depth) +
   scale_fill_viridis_c() +
   coord_quickmap()

Version Author Date
968ad85 pasqualina-vonlanthendinenna 2022-03-29
clim_argo_ph_jan %>%
   filter(pH != 0) %>%
   ggplot() +
   geom_tile(aes(longitude, latitude, fill = pH)) +
   facet_wrap(~depth) +
   scale_fill_viridis_c() +
   coord_quickmap()

Version Author Date
968ad85 pasqualina-vonlanthendinenna 2022-03-29
clim_argo_ph_jan %>%
   filter(pH != 0) %>%
   ggplot(aes(pH)) +
   geom_histogram() +
   facet_wrap(~depth) +
   scale_y_log10() +
   geom_vline(xintercept = 7.5)
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Warning: Transformation introduced infinite values in continuous y-axis
Warning: Removed 736 rows containing missing values (geom_bar).

Version Author Date
968ad85 pasqualina-vonlanthendinenna 2022-03-29

Harmonise data

clim_argo_ph_jan <- clim_argo_ph_jan %>%
   filter(pH != 0)

# harmonise data 

clim_argo_ph_jan <- clim_argo_ph_jan %>% 
  rename(lat = latitude,
         lon = longitude,
         clim_pH_jan = pH) %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon),
         month = 1)

Write data to file

clim_argo_ph_jan %>% write_rds(file = paste0(path_argo_preprocessed, "/ucsd_ph_clim_jan.rds"))

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] stars_0.5-5     sf_1.0-5        abind_1.4-5     oce_1.5-0      
 [5] gsw_1.0-6       forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7    
 [9] purrr_0.3.4     readr_2.1.1     tidyr_1.1.4     tibble_3.1.6   
[13] ggplot2_3.3.5   tidyverse_1.3.1 workflowr_1.7.0

loaded via a namespace (and not attached):
 [1] fs_1.5.2           lubridate_1.8.0    httr_1.4.2         rprojroot_2.0.2   
 [5] tools_4.1.2        backports_1.4.1    bslib_0.3.1        utf8_1.2.2        
 [9] R6_2.5.1           KernSmooth_2.23-20 DBI_1.1.2          colorspace_2.0-2  
[13] withr_2.4.3        tidyselect_1.1.1   processx_3.5.2     compiler_4.1.2    
[17] git2r_0.29.0       cli_3.1.1          rvest_1.0.2        RNetCDF_2.5-2     
[21] xml2_1.3.3         labeling_0.4.2     sass_0.4.0         scales_1.1.1      
[25] classInt_0.4-3     callr_3.7.0        proxy_0.4-26       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_1.0.2        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     magrittr_2.0.1     ncmeta_0.3.0       Rcpp_1.0.8        
[45] munsell_0.5.0      fansi_1.0.2        lifecycle_1.0.1    stringi_1.7.6     
[49] whisker_0.4        yaml_2.2.1         grid_4.1.2         parallel_4.1.2    
[53] promises_1.2.0.1   crayon_1.4.2       haven_2.4.3        hms_1.1.1         
[57] knitr_1.37         ps_1.6.0           pillar_1.6.4       reprex_2.0.1      
[61] glue_1.6.0         evaluate_0.14      getPass_0.2-2      modelr_0.1.8      
[65] vctrs_0.3.8        tzdb_0.2.0         httpuv_1.6.5       cellranger_1.1.0  
[69] gtable_0.3.0       assertthat_0.2.1   xfun_0.29          lwgeom_0.2-8      
[73] broom_0.7.11       e1071_1.7-9        later_1.3.0        class_7.3-20      
[77] viridisLite_0.4.0  units_0.7-2        ellipsis_0.3.2