Get started with the oceanexplorer

Introduction

The World Ocean Atlas (WOA) of the US agency NOAA contains high-resolution and high-quality data for oceanographic variables, such as temperature, salinity and nutrients. This package facilitates easy access and exploration of this data, and targets three different audiences:

In this document I will explain the basic use cases of all three application types. But first a word on the back-end of this R package. This package heavily relies on geospatial data analysis facilitated by sf (Pebesma 2023a) for vectors and stars (Pebesma 2023b) for raster data (i.e., the native NOAA data format). I highly recommend reading the accompanying documentation of these packages if you intend to work with the NOAA datasets:

Shiny app

The shiny app can be found here: https://martinschobben.shinyapps.io/oceanexplorer/. The app allows exploration of the NOAA database and selected data can be extracted as a csv file.

Load NOAA data

The initial screen starts at the “parameter” tab of the left-most field which allows the selection of the oceanographic variable of interest.

The following document lists the technical details of the variable collection and presentation: NOAA World Ocean Atlas 2018 Product Documentation. The papers on this page give in-depth information on the variable of interest: https://www.ncei.noaa.gov/products/world-ocean-atlas.

Clicking the “load data” button extracts the data from the NOAA WOA database. This operation can take some time.

Filter NOAA data

The last action also automatically drops us in the “locations” tab (in the left most field), which allows us to select specific regions on the now displayed world map of the variable of interest.

Locations tab (Left)

This field allows filtering of the dataset.

Map tab (right)

This field allows changing visual aspects of the NOAA data. In addition the plot is interactive and can be clicked (single click). It is therefore possible to only use the right-hand side of the screen to select your data without touching any of the buttons and menus on the left-side.

Extract NOAA data

Now that you have filtered the data you required you can view the results in a table by clicking on the “table” tab on the right side of the screen.

RStudio addin

The RStudio addin has more-or-less the same functionality as the Shiny app except that it has fewer options. This tool is, however, great for integration in R scripts, as the addin emits the code used for your data selection and filtering operations. The emitted code is the “behind-the-scene” code used to generate the graphical output and is thus the backbone of the Shiny app and RStudio addin.

Clicking on the “done” button terminates the application and emits the code at the point where the cursor currently resides.

Using the oceanexplorer R code

The three main functionalities of the Shiny app and RStudio addin can also be performed programmatically.

Loading the package and data

Imagine we are interested in phosphate concentrations in the month December from the Agulhas Basin at a depth 0f 1000 meter below sealevel.

First, we extract the data by proving the variable, grid resolution, and the averaging period. Make sure to have an internet connection in order to connect to the NOAA server.

# load package
library(oceanexplorer)
# get data
(WOA <- get_NOAA("phosphate", 1, "December"))

This operation can take a while, but it can be sped-up during future calls by caching the data. This can be done by setting the cache argument to TRUE. As a default get_NOAA does not cache the data.

Plot

Then we can plot the phosphate data from a depth of 1000 meter below sea level.

plot_NOAA(WOA, depth = 1000)

Filter Agulhas Basin data point

Finally, we can filter a data point from, for example, the Agulhas Basin.

(pts <- filter_NOAA(WOA, depth = 1000, coord = list(lon = 20, lat = -46)))

We can then also project these extraction points on the world map for future reference.

plot_NOAA(WOA, depth = 1000, points = pts)

References

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/.