Dear list, I'm applying the 'crop' command of the raster pacakge to subset a RasterStack ('r') with a SpatialPolygonsDataFrame ('boundary'):
raster.crop <- crop(r, boundary, snap="out") and what I get is: Error: nrows > 0 is not TRUE The summary of the two previous objects are: > r class : RasterStack dimensions : 666, 211, 140526, 8 (nrow, ncol, ncell, nlayers) resolution : 0.05, 0.05 (x, y) extent : -76.3, -65.75, -50, -16.7 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0 names : Year.2003, Year.2004, Year.2005, Year.2006, Year.2007, Year.2008, Year.2009, Year.2010 min values : 0, 0, 0, 0, 0, 0, 0, 0 max values : 844.79, 706.53, 616.73, 888.75, 701.53, 853.47, 642.07, 986.31 > boundary class : SpatialPolygonsDataFrame features : 16 extent : -75.693, -66.419, -55.914, -17.498 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0 variables : 1 names : NOM_REG min values : 1 max values : 9 the previous 'crop' command worked perfectly with a different RasterStack object, with a similar spatial extent, and I don't now what is wrong here. The output of my sessionInfo() is: sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 14.04.2 LTS locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] colorspace_1.2-6 reshape2_1.4.1 rasterVis_0.40 latticeExtra_0.6-28 RColorBrewer_1.1-2 lattice_0.20-34 rgdal_1.1-10 hydroGOF_0.3-8-7 hydroTSM_0.4-8 xts_0.9-7 zoo_1.7-13 [12] raster_2.5-8 sp_1.2-3 loaded via a namespace (and not attached): [1] Rcpp_0.12.6 magrittr_1.5 maptools_0.8-39 viridisLite_0.1.3 FNN_1.1 stringr_1.0.0 plyr_1.8.4 tools_3.3.1 parallel_3.3.1 grid_3.3.1 gstat_1.1-3 e1071_1.6-7 [13] class_7.3-14 intervals_0.15.1 automap_1.0-14 ncdf4_1.15 stringi_1.1.1 spacetime_1.1-5 reshape_0.8.5 foreign_0.8-66 hexbin_1.27.1 Any idea about how to solve this issue is highly appreciated. Thanks in advance, Mauricio Zambrano-Bigiarini, PhD ===================================== Department of Civil Engineering Faculty of Engineering and Sciences Universidad de La Frontera PO Box 54-D, Temuco, Chile http://hzambran.github.io/ ===================================== mailto : mauricio.zambr...@ufrontera.cl work-phone : +56 45 259 2812 ===================================== "To accomplish great things, we must not only act, but also dream; not only plan, but also believe" (Anatole France) ===================================== Linux user #454569 -- Linux Mint user -- La información contenida en este correo electrónico y cualquier anexo o respuesta relacionada, puede contener datos e información confidencial y no puede ser usada o difundida por personas distintas a su(s) destinatario(s). Si usted no es el destinatario de esta comunicación, le informamos que cualquier divulgación, distribución o copia de esta información constituye un delito conforme a la ley chilena. Si lo ha recibido por error, por favor borre el mensaje y todos sus anexos y notifique al remitente. _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo