numberAsPOSIXct {oce}R Documentation

Convert a Numeric Time to a POSIXct Time

Description

There are many varieties, according to the value of type as defined in ‘Details’.

Usage

numberAsPOSIXct(t, type, tz = "UTC")

Arguments

t

an integer corresponding to a time, in a way that depends on type.

type

the type of time (see “Details”).

tz

a string indicating the time zone, used only for unix and matlab times, since GPS times are always referenced to the UTC timezone.

Details

"vms" handles a convention used in the VMS operating system and for Modified Julian Day, in which t is the number of seconds past 1859-11-17T00:00:00 UTC. See reference 5.

Value

A POSIXct() time vector.

Author(s)

Dan Kelley

References

  1. Matlab times: https://www.mathworks.com/help/matlab/ref/datenum.html

  2. NCEP times: https://psl.noaa.gov/data/gridded/faq.html

  3. problem with NCEP times: https://github.com/dankelley/oce/issues/738

  4. EPIC times: software and manuals at https://www.pmel.noaa.gov/epic/download/index.html#epslib; see also Denbo, Donald W., and Nancy N. Soreide. “EPIC.” Oceanography 9 (1996). doi: 10.5670/oceanog.1996.10

  5. VMS times: https://en.wikipedia.org/wiki/Epoch_(computing)

See Also

numberAsHMS()

Other things related to time: ctimeToSeconds(), julianCenturyAnomaly(), julianDay(), numberAsHMS(), secondsToCtime(), unabbreviateYear()

Examples

numberAsPOSIXct(0)                     # unix time 0
numberAsPOSIXct(1, type="matlab")      # matlab time 1
numberAsPOSIXct(cbind(566, 345615), type="gps") # Canada Day, zero hour UTC
numberAsPOSIXct(cbind(2013, 1), type="yearday") # start of 2013

# Epic time, one hour into Canada Day of year 2018. In computing the
# Julian day, note that this starts at noon.
jd <- julianDay(as.POSIXct("2018-07-01 12:00:00", tz="UTC"))
numberAsPOSIXct(cbind(jd, 1e3 * 1 * 3600), type="epic", tz="UTC")


[Package oce version 1.7-2 Index]