Last updated: 2022-03-31

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 11915d8. 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

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 11915d8 pasqualina-vonlanthendinenna 2022-03-31 loaded in Mayot biomes and Roemmich temp climatology
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

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)
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())

map <-
  read_rds(paste(path_emlr_utilities,
                 "map_landmask_WOA18.rds",
                 sep = ""))
# RECCAP2-ocean region mask

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))

# 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))

CSIO-MNR 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)
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)

Version Author Date
6dd0945 pasqualina-vonlanthendinenna 2022-03-25
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 = 'Li et al. CSIO January climatological argo SST')
Warning: Removed 14609 rows containing missing values (geom_tile).

Version Author Date
6dd0945 pasqualina-vonlanthendinenna 2022-03-25
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)

Version Author Date
6dd0945 pasqualina-vonlanthendinenna 2022-03-25

UCSD climatology

Roemmich and Gilson UCSD argo temperature climatology

# clim_argo_temp_jan_2022 <- tidync::hyper_tibble(paste0(path_argo_clim_temp, "/RG_ArgoClim_202201_2019.nc"))
# 
# range(clim_argo_temp_jan_2022$LONGITUDE)
# # range between 20.5 and 379.5 
# range(clim_argo_temp_jan_2022$LATITUDE)
# # range between -64.5 and 79.5 
# range(clim_argo_temp_jan_2022$TIME)
# table(clim_argo_temp_jan_2022$TIME)
# # time = 216.5 in the whole dataset (216.5 months since January 1 2004, corresponds to 15-01-2022)
# 
# clim_argo_temp_2004_2018 <- tidync::hyper_tibble(paste0(path_argo_clim_temp, "/RG_ArgoClim_Temperature_2019.nc"))
# range(clim_argo_temp$LONGITUDE)
# # 20.5 to 379.5
# table(clim_argo_temp$LONGITUDE)
# # 1 degree intervals
# range(clim_argo_temp$LATITUDE)
# # -64.5 to 79.5
# range(clim_argo_temp$TIME)
# # 0.5 to 179.5 
# # -> 01-01-2014 to 31-12-2018, centered on the 15th of each month
# range(clim_argo_temp$ARGO_TEMPERATURE_ANOMALY)
# # -12.543 to 13.413 
# range(clim_argo_temp$PRESSURE)
# # 2.5 to 1975.0 
# 
clim_argo_temp_year_mean <- tidync::hyper_tibble(paste0(path_argo_clim_temp, "/RG_ArgoClim_33pfit_2019_mean.nc"))
# yearly mean temperature values in each 1/6 lat/lon grid (1 value for the year) 

# # 2004-2018
# # 66 030 591 obs of 6 variables, with columns: 
# # ARGO_TEMPERATURE_MEAN
# # ARGO_SALINITY_MEAN
# # BATHYMETRY_MASK
# # LONGITUDE between 20.083 and 379.917º (1/6 degree intervals)
# # LATITUDE between -64.5 and 79.5º 
# # PRESSURE between 2.5 and 1975.0 dbar 
# range(clim_argo_temp$LONGITUDE)
# # 20.083 to 379.917
# range(clim_argo_temp$LATITUDE)
# # -64.5 to 79.5
# range(clim_argo_temp$ARGO_TEMPERATURE_MEAN)
# # -1.880 to 30.516 
# range(clim_argo_temp$PRESSURE)
# # 2.5 to 1975.0 
# table(clim_argo_temp$PRESSURE)
# # pressure levels: 2.5 dbar, 10-170 dbar by 10, 182.5, 200-440 dbar by 20, 462.5, 500-1350 dbar by 50, 12412.5, 1500-1900 dbar by 100, 1975 dbar
# 
clim_argo_temp_monthly_anomaly <- tidync::hyper_tibble(paste0(path_argo_clim_temp, "/RG_ArgoClim_33pfit_2019_annual.nc"))
# monthly temperature anomaly from the annual mean, from January (time = 0.5) to December (time = 11.5), in each 1/2 lon/lat grid

# # 88 035 468 obs of 6 variables, with columns:
# # ARGO_TEMPERATURE_ANNUAL_ANOMALY range between -9.270 and 10.982, with some values of 9.9692e+36 
# # ARGO_SALINITY_ANNUAL_ANOMALY
# # LONGITUDE range between 20.25 and 379.75º, in 0.5º intervals
# # LATITUDE range between -64.75 and 79.75º, in 0.5º intervals
# # PRESSURE range between 2.5 and 1975 dbar 
# # TIME ranging from 0.5 to 11.5 (15 January to 15 December)
# range(clim_argo_temp$TIME)
# # 0.5 to 11.5 -> 15-January to 15-December 
# range(clim_argo_temp$ARGO_TEMPERATURE_ANNUAL_ANOMALY)
# table(round(clim_argo_temp$ARGO_TEMPERATURE_ANNUAL_ANOMALY, digits = 0))
# clim_argo_temp_filtered <- clim_argo_temp %>% 
#   filter(ARGO_TEMPERATURE_ANNUAL_ANOMALY < 10^35)
# range(clim_argo_temp_filtered$ARGO_TEMPERATURE_ANNUAL_ANOMALY)
# # -9.270 to 10.982 
# range(clim_argo_temp$LONGITUDE)
# # 20.25 to 379.75 (every 0.5 degrees)
# range(clim_argo_temp$LATITUDE)
# # -64.75 to 79.75 (every 0.5 degrees)
# range(clim_argo_temp$PRESSURE)
# # 2.5 to 1975.0 dbar


# put both dataframes onto 1/1 lon/lat grid and calculate mean temperature / mean anomaly in each grid 

clim_argo_temp_monthly_anomaly <- clim_argo_temp_monthly_anomaly %>% 
  select(-ARGO_SALINITY_ANNUAL_ANOMALY) %>% 
  rename(lon = LONGITUDE,
         lat = LATITUDE,
         pressure = PRESSURE,
         temp_annual_anomaly = ARGO_TEMPERATURE_ANNUAL_ANOMALY,
         time = TIME) %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon)) %>% 
  mutate(lat = cut(lat, seq(-90, 90, 1), seq(-89.5, 89.5, 1)),
         lat = as.numeric(as.character(lat)),
         lon = cut(lon, seq(20, 380, 1), seq(20.5, 379.5, 1)),
         lon = as.numeric(as.character(lon))) %>% 
  mutate(depth = swDepth(pressure = pressure, latitude = lat),
         .after = pressure) %>% 
  filter(lat < -30)

clim_argo_temp_monthly_anomaly <- clim_argo_temp_monthly_anomaly %>% 
  group_by(lon, lat, depth, time) %>% 
  summarise(temp_monthly_anomaly = mean(temp_annual_anomaly, na.rm = TRUE)) %>% 
  ungroup()
`summarise()` has grouped output by 'lon', 'lat', 'depth'. You can override using the `.groups` argument.
clim_argo_temp_year_mean <- clim_argo_temp_year_mean %>% 
  select(-ARGO_SALINITY_MEAN) %>% 
  rename(lon = LONGITUDE,
         lat = LATITUDE,
         temp_annual_mean = ARGO_TEMPERATURE_MEAN,
         pressure = PRESSURE) %>% 
  mutate(lon = if_else(lon < 20, lon + 360, lon)) %>% 
  mutate(lat = cut(lat, seq(-90, 90, 1), seq(-89.5, 89.5, 1)),
         lat = as.numeric(as.character(lat)),
         lon = cut(lon, seq(20, 380, 1), seq(20.5, 379.5, 1)),
         lon = as.numeric(as.character(lon))) %>% 
  mutate(depth = swDepth(pressure = pressure, latitude = lat),
         .after = pressure) %>% 
  filter(lat < -30)

clim_argo_temp_year_mean <- clim_argo_temp_year_mean %>% 
  group_by(lon, lat, depth) %>% 
  summarise(temp_annual_clim = mean(temp_annual_mean, na.rm = TRUE)) %>% 
  ungroup()
`summarise()` has grouped output by 'lon', 'lat'. You can override using the `.groups` argument.
# 
clim_argo_temp_ucsd <- left_join(clim_argo_temp_monthly_anomaly,
                                 clim_argo_temp_year_mean)
Joining, by = c("lon", "lat", "depth")
clim_argo_temp_ucsd <- clim_argo_temp_ucsd %>% 
  mutate(temp_clim_month = temp_annual_clim + temp_monthly_anomaly,
         depth = round(depth, digits = 0))
map+
  geom_point(data = clim_argo_temp_ucsd %>% 
              filter(depth < 5),
            aes(x = lon,
                y = lat),
            size = 0.2)+
  facet_wrap(~time, ncol = 2)+
  lims(y = c(-80, -30))
Warning: Removed 180180 rows containing missing values (geom_tile).

clim_jan_sst_ucsd <- clim_argo_temp_ucsd %>% 
  filter(time == 0.5,
         depth <= 20) %>% 
  group_by(lon, lat) %>% 
  summarise(clim_sst_jan = mean(temp_clim_month, na.rm = TRUE)) %>% 
  ungroup()
`summarise()` has grouped output by 'lon'. You can override using the `.groups` argument.
map+
  geom_tile(data = clim_jan_sst_ucsd,
            aes(x = lon,
                y = lat, 
                fill = clim_sst_jan))+
  scale_fill_viridis_c()+
  lims(y = c(-80, -30))+
  labs(title = 'Roemmich & Gilson UCSD January Climatological Argo SST')
Warning: Removed 15015 rows containing missing values (geom_tile).

map+
  geom_tile(data = clim_argo_temp_ucsd %>% 
              filter(time == 0.5),
            aes(x = lon, 
                y = lat, 
                fill = temp_clim_month))+
  scale_fill_viridis_c()+
  facet_wrap(~depth)+
  lims(y = c(-80, -30))
Warning: Removed 2402400 rows containing missing values (geom_tile).


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       forcats_0.5.1   stringr_1.4.0  
 [5] dplyr_1.0.7     purrr_0.3.4     readr_2.1.1     tidyr_1.1.4    
 [9] tibble_3.1.6    ggplot2_3.3.5   tidyverse_1.3.1 workflowr_1.7.0

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