Last updated: 2021-11-26

Checks: 7 0

Knit directory: bgc_argo_r_argodata/

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(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 1305d6b. 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:    output/

Untracked files:
    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/oxygen_data.Rmd) and HTML (docs/oxygen_data.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 1305d6b pasqualina-vonlanthendinenna 2021-11-26 Build site.
html 5e2b8a5 pasqualina-vonlanthendinenna 2021-11-26 Build site.
html 3df4daf pasqualina-vonlanthendinenna 2021-11-26 Build site.
html 7a01367 pasqualina-vonlanthendinenna 2021-11-12 Build site.
Rmd 59073c1 pasqualina-vonlanthendinenna 2021-11-12 added NE Pacific oxygen
html 273ed2c pasqualina-vonlanthendinenna 2021-11-12 Build site.
Rmd 06b6be7 pasqualina-vonlanthendinenna 2021-11-12 added NE Pacific oxygen
html 284003d pasqualina-vonlanthendinenna 2021-11-11 Build site.
Rmd fb668ef pasqualina-vonlanthendinenna 2021-11-11 added oxygen data page
Rmd f7807db pasqualina-vonlanthendinenna 2021-11-11 added oxygen data page

Task

Explore BGC-Argo oxygen data through timeseries and climatological maps

path_argo <- '/nfs/kryo/work/updata/bgc_argo_r_argodata'
path_emlr_utilities <- "/nfs/kryo/work/jenmueller/emlr_cant/utilities/files/"

Load oxygen data

Load in delayed-mode, adjusted oxygen data from the BGC-Argo synthetic profile files

path_argo_preprocessed <- paste0(path_argo, "/preprocessed_bgc_data")

oxy_merge <-
  read_rds(file = paste0(path_argo_preprocessed, "/bgc_merge.rds")) %>% 
  select(
    -c(nitrate_adjusted_error:ph_in_situ_total_adjusted_error),
    -c(profile_nitrate_qc, profile_ph_in_situ_total_qc)
  )

Southern Ocean surface oxygen

Focus on surface oxygen (top 10 m of the watercolumn) in the Southern Ocean, south of 30ºS

# select only best pH data (with QC flag 1) below 30ºS, for the top 10 m of the watercolumn
oxy_surface <- oxy_merge %>%
  mutate(depth = swDepth(pres_adjusted, latitude = lat), .before = pres_adjusted) %>%
  filter(doxy_adjusted_qc == '1',   # keep only 'good' data
         lat <= -30,                   # keep only data at or south of 30ºS
         depth <= 10) %>%              # keep only data above or at 10 m depth
  mutate(
    year = year(date),     # separate the year and month from the date column
    month = month(date), .after = n_prof
  )

# check the correct latitudes, QC flags, and depth levels have been filtered
# max(oxy_surface$lat)
# min(oxy_surface$lat)
# table(oxy_surface$doxy_adjusted_qc)
# max(oxy_surface$depth)
# max(oxy_surface$date)
# min(oxy_surface$date)

Monthly climatological map

Create a map of climatological monthly oxygen values, from January 2013 to August 2021, for the region south of 30ºS

# average oxygen values in the top 10 m for each month in each 2 x 2º longitude/latitude grid 
oxy_mean <- oxy_surface %>%
  group_by(lat, lon, month) %>%
  summarise(oxy_ave_month = mean(doxy_adjusted))
`summarise()` has grouped output by 'lat', 'lon'. You can override using the `.groups` argument.
# read in the map from updata
map <-
  read_rds(paste(path_emlr_utilities,
                 "map_landmask_WOA18.rds",
                 sep = ""))

# map a monthly climatology of surface oxygen (Jan 2013 - September 2021)
map +
  geom_tile(data = oxy_mean,
            aes(lon, lat, fill = oxy_ave_month)) +
  lims(y = c(-85, -25)) +
  scale_fill_gradientn(colors = oceColorsJet(n = oxy_mean$oxy_ave_month)) +
  labs(x = 'lon',
       y = 'lat',
       fill = 'dissolved oxygen \n(µmol kg-1)',
       title = 'Monthly average surface dissolved oxygen values (Jan 2013-Sep 2021)') +
  theme(legend.position = 'bottom')+
  facet_wrap(~month)
Warning in seq.int(0, 1, length.out = n): first element used of 'length.out'
argument
Warning: Raster pixels are placed at uneven vertical intervals and will be
shifted. Consider using geom_tile() instead.
Warning: Removed 153708 rows containing missing values (geom_raster).

Version Author Date
3df4daf pasqualina-vonlanthendinenna 2021-11-26
284003d pasqualina-vonlanthendinenna 2021-11-11

Monthly timeseries

Plot a timeseries of monthly-mean dissolved oxygen for the region south of 30ºS for the upper 10 m of the watercolumn

# plot a timeseries of monthly values over the whole southern ocean south of 30ºS
oxy_month <- oxy_surface %>%
  group_by(year, month) %>%
  summarise(oxy_ave = mean(doxy_adjusted))
`summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
# timeseries of monthly pH values over 2013-2021 (separate panels for each month)
oxy_month %>%
  ggplot(aes(x = year, y = oxy_ave)) +
  facet_wrap(~month) +
  geom_line() +
  geom_point() +
  scale_x_continuous(breaks = seq(2013, 2021, 2))+
  labs(x = 'year', 
       y = 'dissolved O2 (µmol kg-1)', 
       title = 'monthly mean dissolved oxygen (Jan 2013-Sep 2021, south of 30ºS)')

Version Author Date
284003d pasqualina-vonlanthendinenna 2021-11-11

Monthly average dissolved oxygen, per year (January 2013 - December 2020; plotting only full years), over the whole region south of 30ºS

# timeseries of monthly oxygen values for each year (separate years on the same plot)
oxy_month %>%
  filter(year != 2021) %>%    # keep only years with full data 
  ggplot(aes(x = month, y = oxy_ave, group = year, col = as.character(year)))+
  geom_line()+
  geom_point()+
  scale_x_continuous(breaks = seq(1, 12, 1))+
  labs(x = 'month',
       y = 'dissolved O2 (µmol kg-1)',
       title = 'monthly mean dissolved oxygen (Jan 2013-Dec 2020, south of 30ºS)',
       col = 'year')

Version Author Date
284003d pasqualina-vonlanthendinenna 2021-11-11

Northeast Pacific surface oxygen

Focus on surface oxygen (upper 10 m) in the north-east Pacific (10ºN - 70ºN, -190ºE, -140ºE)

# select only best oxygen data (with QC flag 1) between 10 and 70ºN, and 190 and 140ºW, for the top 10 m of the watercolumn
oxy_nepacific <- oxy_merge %>%
  mutate(depth = swDepth(pres_adjusted, latitude = lat), .before = pres_adjusted) %>%
  filter(doxy_adjusted_qc == '1',   # keep only 'good' data
        between(lat, 10, 70),
        between(lon, 190, 240),                   # keep only data for the NE Pacific
        depth <= 10) %>%              # keep only data above or at 10 m depth
  mutate(
    year = year(date),     # separate the year and month from the date column
    month = month(date), .after = n_prof
  )
# longitudes larger than -180ºE are lon-380 

Monthly climatological map

Create a map of climatological monthly surface oxygen values, in the north-east Pacific ocean (10ºN - 70ºN, -190ºE, -140ºE), for January 2013 - August 2021

# average oxygen values in the top 10 m for each month in each 2 x 2º longitude/latitude grid 
oxy_mean_nepacific <- oxy_nepacific %>%
  group_by(lat, lon, month) %>%
  summarise(oxy_ave_month = mean(doxy_adjusted))
`summarise()` has grouped output by 'lat', 'lon'. You can override using the `.groups` argument.
# map a monthly climatology of surface oxygen (Jan 2013 - August 2021)
map +
  geom_tile(data = oxy_mean_nepacific,
            aes(lon, lat, fill = oxy_ave_month)) +
  lims(y = c(5, 60), 
       x = c(180, 250)) +
  scale_fill_gradientn(colors = oceColorsJet(n = oxy_mean_nepacific$oxy_ave_month)) +
  labs(x = 'lon',
       y = 'lat',
       fill = 'dissolved oxygen \n(µmol kg-1)',
       title = 'Monthly average surface dissolved oxygen (Jan 2013-Aug 2021)') +
  theme(legend.position = 'right')+
  facet_wrap(~month)
Warning in seq.int(0, 1, length.out = n): first element used of 'length.out'
argument
Warning: Removed 219516 rows containing missing values (geom_raster).

Version Author Date
3df4daf pasqualina-vonlanthendinenna 2021-11-26
273ed2c pasqualina-vonlanthendinenna 2021-11-12

Monthly timeseries

Timeseries of monthly mean oxygen for the northeast Pacific from January 2013 to August 2021

# plot a timeseries of monthly values over the whole NE Pacific
oxy_month_nepacific <- oxy_nepacific %>%
  group_by(year, month) %>%
  summarise(oxy_ave = mean(doxy_adjusted))
`summarise()` has grouped output by 'year'. You can override using the `.groups` argument.
# timeseries of monthly pH values over 2013-2021 (separate panels for each month)
oxy_month_nepacific %>%
  ggplot(aes(x = year, y = oxy_ave)) +
  facet_wrap(~month) +
  geom_line() +
  geom_point() +
  scale_x_continuous(breaks = seq(2013, 2021, 2))+
  labs(x = 'year', 
       y = 'dissolved O2 (µmol kg-1)', 
       title = 'monthly mean dissolved oxygen (Jan 2013-Aug 2021, NE Pacific)')

Version Author Date
273ed2c pasqualina-vonlanthendinenna 2021-11-12

Timeseries of monthly surface oxygen, per year, in the NE Pacific

# timeseries of monthly oxygen values for each year (separate years on the same plot)
oxy_month_nepacific %>%
  filter(year != 2021) %>%    # keep only years with full data
  ggplot(aes(x = month, y = oxy_ave, group = year, col = as.character(year)))+
  geom_line()+
  geom_point()+
  scale_x_continuous(breaks = seq(1, 12, 1))+
  labs(x = 'month',
       y = 'dissolved O2 (µmol kg-1)',
       title = 'monthly mean dissolved oxygen (Jan 2013-Dec 2020, NE Pacific)',
       col = 'year')

Version Author Date
273ed2c pasqualina-vonlanthendinenna 2021-11-12

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] oce_1.4-0           testthat_3.0.4      sf_1.0-2           
 [4] gsw_1.0-6           lubridate_1.7.9     argodata_0.0.0.9000
 [7] forcats_0.5.0       stringr_1.4.0       dplyr_1.0.5        
[10] purrr_0.3.4         readr_1.4.0         tidyr_1.1.3        
[13] tibble_3.1.3        ggplot2_3.3.5       tidyverse_1.3.0    
[16] workflowr_1.6.2    

loaded via a namespace (and not attached):
 [1] httr_1.4.2         sass_0.4.0         jsonlite_1.7.2     modelr_0.1.8      
 [5] bslib_0.2.5.1      assertthat_0.2.1   highr_0.8          blob_1.2.1        
 [9] cellranger_1.1.0   yaml_2.2.1         pillar_1.6.2       backports_1.1.10  
[13] glue_1.4.2         digest_0.6.27      promises_1.2.0.1   rvest_0.3.6       
[17] colorspace_2.0-2   htmltools_0.5.1.1  httpuv_1.6.2       pkgconfig_2.0.3   
[21] broom_0.7.9        haven_2.3.1        scales_1.1.1       whisker_0.4       
[25] later_1.3.0        git2r_0.27.1       proxy_0.4-26       generics_0.1.0    
[29] farver_2.1.0       ellipsis_0.3.2     withr_2.4.2        cli_3.0.1         
[33] magrittr_2.0.1     crayon_1.4.1       readxl_1.3.1       evaluate_0.14     
[37] fs_1.5.0           fansi_0.5.0        xml2_1.3.2         class_7.3-17      
[41] tools_4.0.3        hms_0.5.3          lifecycle_1.0.0    munsell_0.5.0     
[45] reprex_0.3.0       compiler_4.0.3     jquerylib_0.1.4    e1071_1.7-8       
[49] RNetCDF_2.4-2      rlang_0.4.11       classInt_0.4-3     units_0.7-2       
[53] grid_4.0.3         rstudioapi_0.13    labeling_0.4.2     rmarkdown_2.10    
[57] gtable_0.3.0       DBI_1.1.1          R6_2.5.1           knitr_1.33        
[61] utf8_1.2.2         rprojroot_2.0.2    KernSmooth_2.23-17 stringi_1.5.3     
[65] Rcpp_1.0.7         vctrs_0.3.8        dbplyr_1.4.4       tidyselect_1.1.0  
[69] xfun_0.25