tsl_formats | R Documentation |
This set of functions converts date-time objects to model's time-slices in a given format, and vice versa, maps time-slices to date-time, and extracts year, month, day of the year, hour.
tsl_formats
tsl_sets
dtm2tsl(dtm, format = "d365_h24", d366.as.na = grepl("d365", format))
tsl2dtm(
tsl,
format = tsl_guess_format(tsl),
tmz = "UTC",
year = NULL,
mday = NULL
)
dtm |
vector of timepoints in Date format |
format |
character, format of the slices |
d366.as.na |
logical, if |
tsl |
character vector with time-slices |
tmz |
time-zone |
year |
year, used when time-slices don't store year |
mday |
day of month, for time slices without the information |
A character vector with formats:
daily time-slices, 365 a year (leap year's 366th day is disregarded)
time slices with year-day numbers and hours, 8760 in total
etc.
An object of class list
of length 1.
Character vector with time-slices names
Vector in Date-Time format
dtm2tsl(lubridate::now())
dtm2tsl(lubridate::ymd("2020-12-31"))
dtm2tsl(lubridate::ymd("2020-12-31"), d366.as.na = FALSE)
dtm2tsl(lubridate::now(tzone = "UTC"), format = "d365")
dtm2tsl(lubridate::ymd("2020-12-31"), format = "d365")
dtm2tsl(lubridate::ymd("2020-12-31"), format = "d365", d366.as.na = FALSE)
dtm2tsl(lubridate::ymd("2020-12-31"), format = "d366")
tsl <- c("y2007_d365_h15", NA, "d151_h22", "d001", "m10_h12")
tsl2dtm(tsl[1])
tsl2dtm(tsl[1:2])
tsl2dtm(tsl[2])
tsl2dtm(tsl[3])
tsl2dtm(tsl[4])
tsl2dtm(tsl[3], year = 2010)
tsl2dtm(tsl[4], year = 1900)
tsl2dtm(tsl[3:4], year = 1900)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.