Oscar, I believe that the raster values are in the wrong place in your
example. I think the below script corrects that. Best, Robert

library(rasterVis)
dat <- read.table('SST011970_032003.dat', header=FALSE)
loc <- read.table('SSTlonlat.dat', header=FALSE)

sp <- SpatialPointsDataFrame(loc, dat)
gridded(sp) <- TRUE
s <- brick(sp)
# (an alternative route would be rasterFromXYZ)

idx <- seq(as.Date('1970-01-01'), as.Date('2003-03-01'), by='month')
s <- setZ(s, idx)

hovmoller(s)

On Wed, Aug 17, 2011 at 2:03 PM, Oscar Perpiñan Lamigueiro <
oscar.perpinan@upm.es> wrote:

> 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@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
> >
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

