hi guys!

I am trying to optimise the extracting of a time series of NDVI data for
specific locations from a .hdr (envi file) containing 648 images. At the
moment I am doing the following:

> data <- readGDAL(file_in, offset=cOffset, region.dim=cRegion)
GIMMS_8208_FLOAT_BIL_australia has GDAL driver ENVI
and has 476 rows and 570 columns
>
> system.time(b <- brick(file_in))
   user  system elapsed
  0.171   0.001   0.173
> nlayers(b)
[1] 648
> # layerNames(b)
> xy <- cbind(148.15125,-35.65043)
> sp <- SpatialPoints(xy)
> system.time(data <- extract(b, sp))
   user  system elapsed
150.605   1.022 152.752
> ndvi <- ts(as.vector(data[1,]),start=c(1982,1),frequency=24)

This works correctly but the extract() is extremely slow, i.e. 152seconds
for one pixel.
Is there a faster/better way of doing this?

Alternatively I could use:
cOffset <- c(0,0)
cRegion <- c(1,1)

# read file and info
fileinfo <- GDALinfo(file_in)
bands <- fileinfo[[3]]
data <- readGDAL(file_in, offset=cOffset, region.dim=cRegion)
which is fast but then I still need to define the specific location (in
lat/long) when using readGDAL().

Thanks for your help.
Best,
Jan


> sessionInfo()
R version 2.13.0 (2011-04-13)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] C/en_US.UTF-8/C/C/C/C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] bfast_1.3         forecast_2.19     fracdiff_1.3-2    tseries_0.10-25
quadprog_1.5-4    MASS_7.3-14       strucchange_1.4-4
 [8] sandwich_2.2-7    zoo_1.7-2         raster_1.9-1      rgdal_0.6-33
 sp_0.9-84

	[[alternative HTML version deleted]]

