[R-sig-Geo] Time vs. Longitude (Hovmueller Diagram)

Oscar Perpiñan Lamigueiro oscar.perpinan at upm.es
Wed Aug 17 23:03:36 CEST 2011


Hi,

You will find a hovmoller function in the rasterVis package:
http://rastervis.r-forge.r-project.org/

With your data:

library(raster)
library(rasterVis)

dat <- read.table('SST011970_032003.dat', header=FALSE)
loc <- read.table('SSTlonlat.dat', header=FALSE)
rasterList <- lapply(dat, function(x)raster(matrix(x, nrow=84, ncol=30),
                                            xmn=min(loc[[1]]),
                                            xmx=max(loc[[1]]),
                                            ymn=min(loc[[2]]),
                                            ymx=max(loc[[2]]),
                                            crs=CRS("+proj=longlat
                                            +datum=WGS84"))) 
s <- stack(rasterList) 
idx <- seq(as.Date('1970-01-01'), as.Date('2003-03-01'), by='month') 
s <- setZ(s, idx)

hovmoller(s)

Best,

Oscar.



-------------
Oscar Perpiñán Lamigueiro
Dpto. de Ingeniería Eléctrica
EUITI-UPM

http://procomun.wordpress.com

 El Wed, 17 Aug 2011 16:53:15 +1000
Jianyun Wu <jianyun.fred.wu at gmail.com> escribió:
> Hi Michael,
> Thanks for the reply.
> The data file can be rechieved from the following link:
> 
> ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data
> 
> SST011970_032003.dat<ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/SST011970_032003.dat>
> SSTdata_descrip.txt<ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/SSTdata_descrip.txt>
> SSTlandmask.dat<ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/SSTlandmask.dat>
> SSTlonlat.dat<ftp://ftp.wiley.com/public/sci_tech_med/spatio_temporal_data/SSTlonlat.dat>
> I will try the suggestion you provided, and wait for further comments.
> 
> Thank you very much
> 
> Fred
> 



More information about the R-sig-Geo mailing list