Skip to content
Prev 21406 / 29559 Next

raster - 4D Bricks

Hello,

Thanks for clarifying, I get that problem too.  If I get a chance I'll
have a closer look, but otherwise here's my notes for now.

Note that conversion to stack allows it to work:
library(raster)
Loading required package: sp
b <- brick('http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/godas/pottmp.2013.nc',
lvar=3, level=1, varname='pottmp')
dropLayer(stack(b), 1:2)

I presume you are getting this url read via the ncdf4 package? (And
not via the GDAL DODS driver, for example).

I get the same problem with subset() where i is longer than 1
(dropLayer is a wrapper around subset). Below is my subset traceback
and session info.

Cheers, Mike.

subset(x, 1:2)
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ?extent? for
signature ?"character"?
In addition: Warning message:
In .stackCDF(x, varname = varname, bands = bands) :
  pottmp has 4 dimensions, I am using the last one
8: stop(gettextf("unable to find an inherited method for function %s
for signature %s",
       sQuote(fdef at generic), sQuote(cnames)), domain = NA)
7: (function (classes, fdef, mtable)
   {
       methods <- .findInheritedMethods(classes, fdef, mtable)
       if (length(methods) == 1L)
           return(methods[[1L]])
       else if (length(methods) == 0L) {
           cnames <- paste0("\"", sapply(classes, as.character),
               "\"", collapse = ", ")
           stop(gettextf("unable to find an inherited method for
function %s for signature %s",
               sQuote(fdef at generic), sQuote(cnames)), domain = NA)
       }
       else stop("Internal error in finding inherited methods; didn't
return a unique method",
           domain = NA)
   })(list("character"), function (x, ...)
   standardGeneric("extent"), <environment>)
6: extent(x)
5: setExtent(x, value)
4: `extent<-`(`*tmp*`, value = <S4 object of class "Extent">)
3: .local(x, ...)
2: subset(x, 1:2)
1: subset(x, 1:2)

sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
[1] C

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

other attached packages:
[1] ncdf4_1.12    raster_2.2-31 sp_1.0-15

loaded via a namespace (and not attached):
[1] grid_3.1.0      lattice_0.20-29 tools_3.1.0
On Wed, Jul 30, 2014 at 5:45 PM, Mark Payne <markpayneatwork at gmail.com> wrote: