Last updated: 2022-03-25

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 5b93849. 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
    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_temp_csio.Rmd) and HTML (docs/argo_clim_temp_csio.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 5b93849 pasqualina-vonlanthendinenna 2022-03-25 added climatology pages

Task

CSIO-MNR Argo temperature climatology of Li et al. (2017)

Li, H., F. Xu, W. Zhou, D. Wang, J. S. Wright, Z. Liu, and Y. Lin (2017), Development of a global gridded Argo data set with Barnes successive corrections, J. Geophys. Res.Oceans, 122, doi: 10.1002/2016JC012285.6

User Manual: Shaolei Lu,Zenghong Liu,Hong Li,Zhaoqin Li,Xiaofen Wu,Chaohui Sun,Jianping Xu.(2020). Manual of Global Ocean Argo gridded data set (BOA_Argo) (Version 2019), 14 pp https://argo.ucsd.edu/wp-content/uploads/sites/361/2020/07/User_Manual_BOA_Argo-2020.pdf

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)
Loading required package: ggspatial
Setting data download folder to a temporary folder /tmp/RtmpyCFvWc.
This means that any downloaded map data need to be downloaded again
when you restart R. To avoid this problem, change the default path to a
permanent folder on your computer. Add following lines to your
.Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
<- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
file.'~/Documents/ggOceanMapsLargeData'would make it in a writable
folder on most operating systems.
library(oce)
Loading required package: gsw

Load data

path_updata <- "/nfs/kryo/work/updata"
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())

January climatology

boa_clim_argo_temp_jan <- tidync::hyper_tibble(paste0(path_argo_clim_temp, "/BOA_Argo_monthly_01.nc"))
# 1 896 093 obs of 6 variables (2004-2019):
# temp (range between -3.9180 and 30.1866º)
# salt
# lon (range between 0.5 and 359.5)
# lat (range between -72.5 and 79.5)
# pres (range between 0 and 1975)
# time (15 days since 0000-01-01)
# range(boa_clim_argo_temp_jan$temp)
# -3.9180 to 30.1866 
# range(boa_clim_argo_temp_jan$lon)
# 0.5 to 359.5 by 1
# range(boa_clim_argo_temp_jan$lat)
# -72.5 to 79.5 by 1
# range(boa_clim_argo_temp_jan$pres)
# 0 to 1975 (58 pressure levels)
# table(boa_clim_argo_temp_jan$pres)
# pressure levels: 0, 5, 10-170 by 10, 180-460 by 20, 500-1300 by 50, 1400-1900 by 100, 1975 dbar 
# range(boa_clim_argo_temp_jan$time)
# days since 0000-01-01

# keep only data south of 30ºS
boa_clim_temp_jan_SO <- boa_clim_argo_temp_jan %>% 
  filter(lat <= -30) %>% 
  select(-salt)
# 766 434 obs of 5 variables 

# range(boa_clim_temp_jan_SO$temp)
# range(boa_clim_temp_jan_SO$lat)
# range(boa_clim_temp_jan_SO$lon)

boa_clim_temp_jan_SO <- boa_clim_temp_jan_SO %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon),
         depth = swDepth(pressure = pres, latitude = lat)) %>% 
  rename(clim_temp_jan = temp) %>% 
  mutate(month = rep(1, length(time)))

# range(boa_clim_temp_jan_SO$depth)
region_masks_all_1x1 <- read_rds(file = paste0(path_argo_preprocessed,
                                               '/region_masks_all_1x1.rds'))

region_masks_all_1x1 <- region_masks_all_1x1 %>%
  rename(biome = value) %>% 
  mutate(coast = as.character(coast))

region_masks_all_1x1 <- region_masks_all_1x1 %>%
  filter(region == 'southern',
         biome != 0) %>% 
  select(-region)

region_masks_all_1x1 <- region_masks_all_1x1 %>% 
  filter(coast == "0")

# WOA 18 basin mask

basinmask <-
  read_csv(
    paste(path_emlr_utilities,
          "basin_mask_WOA18.csv",
          sep = ""),
    col_types = cols("MLR_basins" = col_character())
  )

basinmask <- basinmask %>%
  filter(MLR_basins == unique(basinmask$MLR_basins)[1]) %>% 
  select(-c(MLR_basins, basin))

basinmask <- basinmask %>%
  filter(lat <= -30)
map <-
  read_rds(paste(path_emlr_utilities,
                 "map_landmask_WOA18.rds",
                 sep = ""))
map+
  geom_point(data = boa_clim_temp_jan_SO %>% filter(depth < 20),
             aes(x = lon,
                 y = lat),
             size = 0.2,
             pch = 2,
             alpha = 0.2)

boa_clim_sst_jan_SO <- boa_clim_temp_jan_SO %>% 
  filter(depth <= 20) %>% 
  group_by(lon, lat) %>% 
  summarise(clim_sst = mean(clim_temp_jan, na.rm = TRUE)) %>% 
  ungroup()
`summarise()` has grouped output by 'lon'. You can override using the `.groups` argument.
map+
  geom_tile(data = boa_clim_sst_jan_SO,
            aes(x = lon,
                y = lat,
                fill = clim_sst))+
  scale_fill_viridis_c()+
  lims(y = c(-80, -25))+
  labs(title = 'CSIO January climatological argo SST')
Warning: Removed 14609 rows containing missing values (geom_tile).

boa_clim_temp_jan_SO <- inner_join(boa_clim_temp_jan_SO, region_masks_all_1x1)
Joining, by = c("lon", "lat")
boa_clim_temp_jan_SO <- inner_join(boa_clim_temp_jan_SO,
                                    basinmask)
Joining, by = c("lon", "lat")
boa_clim_temp_jan_SO %>% 
  ggplot(aes(x = clim_temp_jan,
             y = depth))+
  geom_point(size = 0.2, pch = 1, fill = NA)+
  scale_y_reverse()+
  facet_grid(basin_AIP~biome)


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

loaded via a namespace (and not attached):
 [1] fs_1.5.2           sf_1.0-5           bit64_4.0.5        lubridate_1.8.0   
 [5] httr_1.4.2         rprojroot_2.0.2    tools_4.1.2        backports_1.4.1   
 [9] bslib_0.3.1        utf8_1.2.2         rgdal_1.5-28       R6_2.5.1          
[13] KernSmooth_2.23-20 rgeos_0.5-9        DBI_1.1.2          colorspace_2.0-2  
[17] raster_3.5-11      withr_2.4.3        sp_1.4-6           tidyselect_1.1.1  
[21] processx_3.5.2     bit_4.0.4          compiler_4.1.2     git2r_0.29.0      
[25] cli_3.1.1          rvest_1.0.2        RNetCDF_2.5-2      xml2_1.3.3        
[29] labeling_0.4.2     sass_0.4.0         scales_1.1.1       classInt_0.4-3    
[33] callr_3.7.0        proxy_0.4-26       digest_0.6.29      rmarkdown_2.11    
[37] pkgconfig_2.0.3    htmltools_0.5.2    highr_0.9          dbplyr_2.1.1      
[41] fastmap_1.1.0      tidync_0.2.4       rlang_0.4.12       readxl_1.3.1      
[45] rstudioapi_0.13    farver_2.1.0       jquerylib_0.1.4    generics_0.1.1    
[49] jsonlite_1.7.3     vroom_1.5.7        magrittr_2.0.1     ncmeta_0.3.0      
[53] Rcpp_1.0.8         munsell_0.5.0      fansi_1.0.2        lifecycle_1.0.1   
[57] terra_1.5-12       stringi_1.7.6      whisker_0.4        yaml_2.2.1        
[61] grid_4.1.2         parallel_4.1.2     promises_1.2.0.1   crayon_1.4.2      
[65] lattice_0.20-45    haven_2.4.3        hms_1.1.1          knitr_1.37        
[69] ps_1.6.0           pillar_1.6.4       codetools_0.2-18   reprex_2.0.1      
[73] glue_1.6.0         evaluate_0.14      getPass_0.2-2      modelr_0.1.8      
[77] vctrs_0.3.8        tzdb_0.2.0         httpuv_1.6.5       cellranger_1.1.0  
[81] gtable_0.3.0       assertthat_0.2.1   xfun_0.29          broom_0.7.11      
[85] e1071_1.7-9        later_1.3.0        viridisLite_0.4.0  ncdf4_1.19        
[89] class_7.3-20       units_0.7-2        ellipsis_0.3.2