alignepochs: Adjusts the values in a CF-compliant netCDF time coordinate...

Description Usage Arguments Details Value Examples

View source: R/alignepochs.R

Description

The CF metadata standard requires a netCDF time coordinate variable to be represented as time elapsed from an epoch, e.g., "days since 1972-01-01". Different data sources may use different epochs and units that need to be aligned with one another to simplify analysis; this function will align them.

Usage

1
alignepochs(time, epoch = "days since 1950-01-01")

Arguments

time

A CF-style time variable

epoch

A CF time@units string

Details

The time input variable must have an attribute named "units" that follows the CF standard. Currently supported time units for conversion are "hours" and "days".

If the input variable also has a calendar attribute, that will be respected in the adjustment; otherwise, it will assume the data follows a standard (365.25-day) calendar. Recognized calendars are the same as those handled by the yearlength function.

Value

A time variable with adjusted epoch and offsets

Examples

1
2
3
4
time <- seq(365)-1
time@units <- "days since 1950-01-01"
time@calendar <- "noleap"
str(alignepochs(time, "hours since 1949-12-01"))

sethmcg/climod documentation built on Nov. 19, 2021, 11:12 p.m.