The goal of oceanexplorer is to enable easy access and exploration of the World Ocean Atlas of the US agency NOAA.
Demo of the ocean explorer appCheck the app here: https://martinschobben.shinyapps.io/oceanexplorer/
This project was funded by ERC Starting grant number 802835, OceaNice, awarded to Peter Bijl.
The construction of the R (R Core Team 2023) package oceanexplorer and associated documentation was aided by the packages; devtools (Wickham, Hester, et al. 2022), roxygen2 (Wickham, Danenberg, et al. 2022), testthat (Wickham 2023), shinytest (Chang, Csárdi, and Wickham 2023), vdiffr (Henry et al. 2023), knitr (Xie 2014 ; Xie 2015), rmarkdown (Xie, Allaire, and Grolemund 2018; Xie, Dervieux, and Riederer 2020), and the superb guidance in the book: R packages: organize, test, document, and share your code, by Wickham (2015).
Data transformation, cleaning and visualization is performed with: dplyr (Wickham, François, et al. 2023), and ggplot2 (Wickham, Chang, et al. 2023).
In addition, this package relies on a set of packages for spatial data analysis: sf (Pebesma 2023a) and stars (Pebesma 2023b).
The app is build with shiny (Chang et al. 2022) and the guidance in the book: Mastering Shiny: Build Interactive Apps, Reports & Dashboards (Wickham 2020) was a great help in learning how to develop such applications. Furthermore, the packages shinyjs (Attali 2021), waiter (Coene 2022), bslib (Sievert, Cheng, and Aden-Buie 2023) and thematic (Sievert, Schloerke, and Cheng 2023) ensure user-friendliness of the interface and visually pleasing graphics.
You can install the latest version of oceanexplorer from CRAN
# Install oceanexplorer from CRAN:
install.packages("oceanexplorer")
The package allows extraction of global databases of several physical and chemical parameters of the ocean from the NOAA World Ocean Atlas.
library(oceanexplorer)
# obtain the NOAA world ocean atlas for oxygen content
oxy_global <- get_NOAA("oxygen", 1, "annual")
Slice a specific interval from the array with filter_NOAA()
, like so:
# filter a depth of 200 meters to show OMZs
(oxy_omz <- filter_NOAA(oxy_global, depth = 200))
#> stars object with 2 dimensions and 1 attribute
#> attribute(s):
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
#> o_an 0.9701567 164.1833 218.6721 206.2584 266.9612 359.0279 26041
#> dimension(s):
#> from to offset delta refsys x/y
#> lon 1 360 -180 1 WGS 84 [x]
#> lat 1 180 -90 1 WGS 84 [y]
In addition, the sliced array can be plotted, like so:
# plot the NOAA world ocean atlas for oxygen content
plot_NOAA(oxy_omz, depth = NULL)
The same plot can be produced by taking the original data and supplying
a value to the depth
argument and specifying the range of oxygen
content to oxy_omz
.
# plot the NOAA world ocean atlas for oxygen content
plot_NOAA(oxy_global, depth = 200, rng = range(oxy_omz[[1]]))
Lastly, the package can launch a Shiny app for interactive exploration of the datasets.
# launch an interactive shiny session
NOAA_app()
The RStudio addin can be launched within the RStudio viewer pain by
executing the following code, or by using the Addins
drop down menu in
the task-bar.
# launch an interactive shiny session
NOAA_addin()
Please note that the oceanexplorer project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Attali, Dean. 2021. Shinyjs: Easily Improve the User Experience of Your Shiny Apps in Seconds. https://deanattali.com/shinyjs/.
Chang, Winston, Joe Cheng, JJ Allaire, Carson Sievert, Barret Schloerke, Yihui Xie, Jeff Allen, Jonathan McPherson, Alan Dipert, and Barbara Borges. 2022. Shiny: Web Application Framework for r. https://shiny.rstudio.com/.
Chang, Winston, Gábor Csárdi, and Hadley Wickham. 2023. Shinytest: Test Shiny Apps. https://github.com/rstudio/shinytest.
Coene, John. 2022. Waiter: Loading Screen for Shiny. https://waiter.john-coene.com/.
Henry, Lionel, Thomas Lin Pedersen, T Jake Luciani, Matthieu Decorde, and Vaudor Lise. 2023. Vdiffr: Visual Regression Testing and Graphical Diffing. https://vdiffr.r-lib.org/.
Pebesma, Edzer. 2023a. Sf: Simple Features for r. https://r-spatial.github.io/sf/.
———. 2023b. Stars: Spatiotemporal Arrays, Raster and Vector Data Cubes. https://r-spatial.github.io/stars/.
R Core Team. 2023. R: A Language and Environment for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. https://www.R-project.org/.
Sievert, Carson, Joe Cheng, and Garrick Aden-Buie. 2023. Bslib: Custom Bootstrap ’Sass’ Themes for Shiny and Rmarkdown. https://rstudio.github.io/bslib/.
Sievert, Carson, Barret Schloerke, and Joe Cheng. 2023. Thematic: Unified and Automatic Theming of Ggplot2, Lattice, and Base r Graphics. https://rstudio.github.io/thematic/.
Wickham, Hadley. 2015. R Packages: Organize, Test, Document, and Share Your Code. O’Reilly Media, Inc. https://r-pkgs.org/.
———. 2020. Mastering Shiny: Build Interactive Apps, Reports & Dashboards. O’Reilly Media, Inc. https://mastering-shiny.org/.
———. 2023. Testthat: Unit Testing for r. https://testthat.r-lib.org.
Wickham, Hadley, Winston Chang, Lionel Henry, Thomas Lin Pedersen, Kohske Takahashi, Claus Wilke, Kara Woo, Hiroaki Yutani, and Dewey Dunnington. 2023. Ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics. https://ggplot2.tidyverse.org.
Wickham, Hadley, Peter Danenberg, Gábor Csárdi, and Manuel Eugster. 2022. Roxygen2: In-Line Documentation for r. https://roxygen2.r-lib.org/.
Wickham, Hadley, Romain François, Lionel Henry, Kirill Müller, and Davis Vaughan. 2023. Dplyr: A Grammar of Data Manipulation. https://dplyr.tidyverse.org.
Wickham, Hadley, Jim Hester, Winston Chang, and Jennifer Bryan. 2022. Devtools: Tools to Make Developing r Packages Easier. https://devtools.r-lib.org/.
Xie, Yihui. 2014. “Knitr: A Comprehensive Tool for Reproducible Research in R.” In Implementing Reproducible Computational Research, edited by Victoria Stodden, Friedrich Leisch, and Roger D. Peng. Chapman; Hall/CRC.
———. 2015. Dynamic Documents with R and Knitr. 2nd ed. Boca Raton, Florida: Chapman; Hall/CRC. https://yihui.org/knitr/.
Xie, Yihui, J. J. Allaire, and Garrett Grolemund. 2018. R Markdown: The Definitive Guide. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown.
Xie, Yihui, Christophe Dervieux, and Emily Riederer. 2020. R Markdown Cookbook. Boca Raton, Florida: Chapman; Hall/CRC. https://bookdown.org/yihui/rmarkdown-cookbook.