Description Usage Arguments Details Value Examples
Returns the length of year (in days) associated with a particular calendar. The input can be a string naming a type of calendar, or a variable with an attribute named 'calendar' holding such a string.
1 |
time |
A variable with an attribute named 'calendar' or a string. The value of the attribute should be a string denoting the type of calendar according to the CF Metdata Conventions. |
Climate models often use a year with a length other than the real-world value of 365.2425 days. In netCDF files that comply with the CF Metadata Standard, this is recorded as the 'calendar' attribute of the time coordinate variable. Valid calendars are:
standard, gregorian: | 365.2425 days |
proleptic_gregorian: | 365.2425 days |
julian: | 365.25 days |
noleap, 365_day: | 365 days |
all_leap, 366_day: | 366 days |
360_day: | 360 days |
Note that although the real-world Gregorian calendar is a Julian calendar before October 15, 1582, accounting for this change would be challenging and would frequently run contrary to common usage, and so this function does not do so.
The length of the year for the given calendar, in days.
If the calendar is unknown, a warning is thrown and NA is
returned. If time
is a variable without a calendar, the
default year length of 365.2425 days is returned.
1 2 3 4 5 6 7 | yearlength("gregorian")
x <- seq(100)
yearlength(x)
x@calendar <- "noleap"
yearlength(x)
x@calendar <- "martian"
yearlength(x)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.