OISST Mainstays Workflows

About OISST Mainstays

OISST Mainstays is a collection of pre-processed OISST data resources that are stored in a shared location on Box. There a number of convenience functions in this package for working with this data effectively.

Loading Data Window

As a commonly used resource for high resolution sea surface temperature data it makes sense for us to have it on-hand rather than re-download from THREDDS as needed. For this reason there are numerous functions for grabbing data for specific areas and dates from our shared box drive.

oisst_window_load() is a convenience function that will load a subset of the OISST data using a table indicating the lat/lon/time you wish to access. This function also works for accessing pre-processed SST anomalies from the 1982-2011 climatology.

Using names to index time periods

The way the layers are names off box are such that individual days are nested as layers under their respective year. To get the average for a period of time you just need to grab the indices that match the time period of interest.

For months that is quite easy, as shown below using march as an example.

Extracting Daily Values with Point Locations

Another common need is to match temperature values in space and time with specific point locations. This is achieved with the

Extracting All Years/Dates from Raster Brick

The way the OISST data is organized with oisst_window_load lets us loop/apply an extraction by first matching up years and then by matching the day of the year.

The preparation steps are just to create a date key that matches the conventions that raster layers use. For that the dates cannot begin with a number, they begin with a capital “X” and underscores, hyphens, and spaces are replaced with a period.

Once we have a key for indexing the proper years and dates, or averages if we did some sort of manipulation, then you simply split the data by the year and match using those keys.

I use purrr::imap here which stands for indexed map. It takes a list as input and includes the name of the list items as a second input for whatever function you build. This lets me pass data and a matching name together which I use to index into the raster stacks.

Extracting Data with Shapefiles

Shapefile extractions for netcdf files can be accomplished more memory efficiently by first loading just the area needed using oisst_window_load.

From there you can use raster::mask and raster::crop to pull data using a specific shapefile.

For this demo I will use NMFS Trawl survey strata we usually use together to represent the Gulf of Maine.

From this shapefile we can pull its lat/lon limits and use them to load in just the oisst data we need to do a shapefile clip.

For this time around we will load the temperature anomalies so we can make a timeseries of those.