satinMean: Averaging ocean data by time period

View source: R/satinMean.R

satinMeanR Documentation

Averaging ocean data by time period

Description

This function allows to average ocean data by a selected time period. For example, from daily data, the user may want to obtain weekly, monthly, quarterly or even yearly averages.

Usage

satinMean(X, by = "%m", depth = NULL)

Arguments

X

a satin object as returned by read.nasaoc, read.ghrsst, read.osunpp, or read.cmems.

by

a character string specifying the averaging time period, see details.

depth

an integer referring to a given depth level (defaults to 1). Only meaningful for Copernicus data that includes variables at different depths.

Details

Accepted strings in by follow the notation of conversion specifications described in strptime. Currently implemented: "%Y", "%m", "%Y-%m", "%j", "%qtr", "%Y-%qtr", "%sem", "%Y-%sem", "%U", "%V", "%W", "%Y-%U", "%Y-%V", "%Y-%W". This includes two non-standard strings and their combinations with year: "%qtr", and "%sem", for quarter and semester, respectively, which are passed to lubridate's functions of the same names. This function is meant to be used in combination with anomaly to obtain anomalies with respect to an average period.

Value

An object of class "satin" (see satin-class for details) where the third dimension in the data array accomodates averages by time period. An extra element (labels) is included in the slot attribs to identify the time period used for the averages.

Author(s)

Héctor Villalobos and Eduardo González-Rodríguez

See Also

anomaly for calculating anomalies of ocean data, and climatology for climatologies.

Examples

if(interactive()){
sst.ym <- satinMean(sst, by = "%Y-%m") # sst is a satin object with 240 weekly
                                         # images, totalling five years of data.

sst.ym # this will have 60 time periods, one for every month and year.

sst.m <- satinMean(sst, by = "%m") # this will produce 12 monthly periods
}

satin documentation built on Sept. 23, 2022, 1:06 a.m.