sidfex.ydoy2reltime: Convert Year and DayOfYear to Days Since a Reference Time

View source: R/sidfex.ydoy2reltime.R

sidfex.ydoy2reltimeR Documentation

Convert Year and DayOfYear to Days Since a Reference Time

Description

Convert Year and DayOfYear to days since a reference time based on the Gregorian calendar

Usage

sidfex.ydoy2reltime(Year, DayOfYear, RefYear = 2017, RefDayOfYear = 1.0)

Arguments

Year

an integer scalar or vector specifying the year. Can also be character which will be coerced with as.integer.

DayOfYear

a numeric scalar or vector specifying the day of the year. Can also be character which will be coerced with as.numeric.

RefYear

an integer scalar specifying the reference year. Can also be character which will be coerced with as.integer.

RefDayOfYear

a numeric scalar specifying the reference day of year. Can also be character which will be coerced with as.numeric.

Value

a numeric vector of the same length as DayOfYear.

Note

If Year has length 1 and DayOfYear has length >1, the same Year will be used for all values.

The convention for the day of the year is that January 1st begins with DayOfYear=1.0, that is, DayOfYear=1.5 corresponds to January 1st 12:00.

Author(s)

Helge Goessling

Examples

y = c(2015,2015,2015,2016,2016,2016,2017,2017,2017)
doy = rep(c(1,180,365),3)
DaysSinceRef = sidfex.ydoy2reltime(Year=y,DayOfYear=doy,RefYear=2016,RefDayOfYear=1)
print(DaysSinceRef)

helgegoessling/SIDFEx documentation built on March 15, 2024, 2:26 p.m.