[R-sig-Geo] resample{raster}: Error "invalid 'y' type in 'x || y'"

Pierre Roudier pierre.roudier at gmail.com
Tue Apr 12 09:21:22 CEST 2011


Anna,

What is the version of raster you are using?

Best way to figure out is to post the output of the sessionInfo() command.

Pierre

2011/4/12 Anna Cord <anna.cord at gmx.de>:
> Dear list,
>
> I am trying to resample a raster layer to another raster layer (dieffernt resolution, different extent) using the "resample" function as implemented in the "raster" package.
>
> ----------------------------
>
> 1. The raster layer to be resampled:
>> test
> class       : RasterLayer
> dimensions  : 7272, 12660, 92063520  (nrow, ncol, ncell)
> resolution  : 0.0025, 0.0025  (x, y)
> extent      : -118.3616, -86.71156, 14.53515, 32.71515  (xmin, xmax, ymin, ymax)
> projection  : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
> values      : C:/DOKUME~1/Anna/LOKALE~1/Temp/R_raster_tmp/raster_tmp_4863583632.grd
> min value   : 0
> max value   : 1
>
> ------------------
>
> 2. The reference raster layer:
>> land.cover
> class       : RasterLayer
> dimensions  : 7059, 12289, 86748051  (nrow, ncol, ncell)
> resolution  : 0.002575715, 0.002575715  (x, y)
> extent      : -118.3631, -86.71017, 14.53329, 32.71526  (xmin, xmax, ymin, ymax)
> projection  : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0
> values      : F:/R/land_cover/NALCMS_land_cover_2005.tif
> min value   : 0
> max value   : 255
>
> -----------------
>
> The following error occurs:
>
> out <- resample(test, land.cover, method='bilinear')
> "Error in resample(test, land.cover, method = "bilinear") :
>  unused argument(s) (method = "bilinear")"
>
> out <- resample(test, land.cover)
> Error in missing(size) || size == 1 : invalid 'y' type in 'x || y'
>
> ---------------
>
> Interestingly, the same happens when using the example as provided in the package description:
>
> r <- raster(nrow=3, ncol=3)
> r[] <- 1:ncell(r)
> s <- raster(nrow=10, ncol=10)
> s <- resample(r, s, method='bilinear')
> Error in resample(r, s, method = "bilinear") :
>  unused argument(s) (method = "bilinear")
>
> s <- resample(r, s)
> Error in missing(size) || size == 1 : invalid 'y' type in 'x || y'
>
> Any ideas? I couldn't found any similar thread...
>
> Thanks a lot in advance,
> Anna
>
>
>
>
> --
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
Scientist
Landcare Research, New Zealand



More information about the R-sig-Geo mailing list