[R-sig-Geo] package raster: issue with "extent" and "stack"
Robert Hijmans
r.hijmans at gmail.com
Tue Mar 29 06:49:49 CEST 2011
Advait,
> I encounter two errors; A) when using extent to crop the rasters
> lims <- extent(rcmraster,180,185,300,305)
> Error in .local(x, ...) : unused argument(s) (180, 185, 300, 305)
> I also tried using lat-long values in place of the index to no avail.
I cannot reproduce the problem. You are not providing your sessionInfo(),
but I can see that you are not using the last version of raster. Perhaps
this problem goes away if you update raster. It is also good practice to
provide to make some effort to provide a self contained example of the
problem encountered. Such as below (which suggest to me that this works):
> r <- raster(nrow=356, ncol=507)
> r[] <- 1:ncell(r)
> s <- stack(r,r,r)
> lims <- extent(r,180,185,300,305)
> lims
class : Extent
xmin : 32.66272
xmax : 36.21302
ymin : -3.286517
ymax : -0.758427
if you use long/lat you would need to do something like
lims <- extent(-100, -50, 30, 40)
and B) using stack
s_crop <- stack(emitraster,rcmraster)
Error in function (classes, fdef, mtable) :
unable to find an inherited method for function "trim", for signature
"integer"
I do not know what you are trying to do here. Did you mean
s_crop <- crop(emitraster,rcmraster) # ?
Anyway, this works for me,
> b <- brick(s)
> ss <- stack(b,b)
But this probably goes wrong because you are using ncdf files; so that might
be a bug. I would happily download and look at those files if you could
establish first that the simple examples works for you like they work for
me, but things break if you use the files instead; and that you are using
the latest version.
Best,
Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/package-raster-issue-with-extent-and-stack-tp6216238p6217680.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list