[STATSGRASS] Raster time series and R - timezones?

Roger Bivand Roger.Bivand at nhh.no
Mon Jun 19 15:03:33 EDT 2006


On Mon, 19 Jun 2006, Markus Neteler wrote:

> Hi,
> 
> I am processing daily time series of MODIS but cannot
> figure out how to use time stamps properly. With r.what
> I am looping over the maps and add a timestamp like
> this "7 Apr 2006 10:30:00 UTC" to each extracted value.
> 
> Then, in R I want to analyze the time series but I
> wonder how to tell R about the time zone:
> 
> 
> > mytime <- "7 May 2006 10:30:00 UTC"
> > strptime(mytime,"%d %b %Y %H:%M:%S")
> [1] "2006-04-07 10:30:00"
> 
> -> UTC lost
> 
> > ISOdate(2006, 4, 7, hour = 12, min = 0, sec = 0, tz = "GMT")
> [1] "2006-04-07 12:00:00 GMT"
> > ISOdate(2006, 4, 7, hour = 12, min = 0, sec = 0, tz = "CEST")
> [1] "2006-04-07 12:00:00 CEST"
> > ISOdate(2006, 4, 7, hour = 12, min = 0, sec = 0, tz = "CESddT")
> [1] "2006-04-07 12:00:00 CESddT"
> 
> -> tz accepts apparently nonsense as well?
> 
> > mytime <- "7 Feb 2006 10:30:00 UTC"
> > strptime(mytime,"%d %b %Y %H:%M:%S")
> [1] "2006-02-07 10:30:00"
> 
> -> do we keep daylight saving?
> 
> > mytime <- "7 May 2006 10:30:00 UTC"
> > strptime(mytime,"%d %b %Y %H:%M:%S")
> [1] NA
> 
> > mytime <- "7 Mai 2006 10:30:00 UTC"
> > strptime(mytime,"%d %b %Y %H:%M:%S")
> [1] "2006-05-07 10:30:00"
> 
> -> seems to be LOCALE depend which is pretty risky
>    if I share my scripts worldwide
> 
> I would appreciate hints...

If nobody replies this evening here, I would re-read the R News note:

Gabor Grothendieck and Thomas Petzoldt. R help desk: Date and time classes 
in R. R News, 4(1):29-32, June 2004.

and if that doesn't help, ask on R-help (with the output of your
Sys.getlocale() and sessionInfo() - the help pages do say that different
platforms implement date/time functions differently, so cross-platform
consistency may be asking too much).

I don't use date/time classes regularly, so cannot offer better advice.

Roger

> thanks
> 
>  Markus
> 
> PS: If you confirm that this question is appropriate for
>     the R-user ML, I'll ask there :-)
> 
> _______________________________________________
> statsgrass mailing list
> statsgrass at grass.itc.it
> http://grass.itc.it/mailman/listinfo/statsgrass
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the grass-stats mailing list