setGridDates.asPOSIXlt | R Documentation |
Internal utility for date format conversion to POSIX.lt
setGridDates.asPOSIXlt(grid, tz = "")
grid |
Input C4R grid |
tz |
Time zone to be coerced to. Default to |
The function attempts to identify the format of the grid dates and to perform an adequate conversion to POSIXlt-class, including the time zone identification.
If no tz is specified, the function tries to "guess" it from the input. Otherwise it is set to the current time zone, with a warning.
If no hour-minute-sec information is stored, the output will read 00:00:00
The C4R grid with transformed dates
J Bedia
Other dateutils:
fillGridDates()
,
getFirstChar()
,
isAlphaCharacter()
## Not run:
library(climate4R.datasets)
data("CMIP5_Iberia_hus850.rcp85")
# Dates are represented as character string
class(getRefDates(CMIP5_Iberia_hus850.rcp85))
# Conversion to POSIXlt
a <- setGridDates.asPOSIXlt(CMIP5_Iberia_hus850.rcp85)
range(getRefDates(a))
class(getRefDates(a))
## WARNING: Forcing a time zone will change the tz attribute, but not the time
# (i.e.: it will alter the actual times):
b <- setGridDates.asPOSIXlt(CMIP5_Iberia_hus850.rcp85, tz = "Europe/Madrid")
range(getRefDates(b))
# Therefore, tz should be used ONLY when the time zone is missing or wrongly specified in the
# input grid and we are sure about the actual TZ of our data
# It may also be used to change the representation of the time zone, e.g., changing
# the denomination GMT to the equivalent UTC:
c <- setGridDates.asPOSIXlt(CMIP5_Iberia_hus850.rcp85, tz = "UTC")
range(getRefDates(c))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.