Error with disaggregate
Ned,
I see nothing wrong with your code. Works for me on Win7. Perhaps
because of a fix in the chunk size (blockSize) computation in the
development version.
Can you check if it works with that version?
install.packages("raster", repos="http://R-Forge.R-project.org")
I do not understand the error message though, as you should be writing
fewer bytes then 2^31
2^31 / (8*ncell(c))
[1] 4.532697 This may go away if you add a filename, and perhaps a datatype (FLT4S) argument c <- disaggregate(b, fact=32, filename='dis.tif', datatype='FLT4S') Or if you set rasterOptions(chunksize= ) temporarily to something lower. I note that I should add a "block_fun" method to do this in one step Robert
On Tue, Feb 18, 2014 at 9:47 AM, Ned Horning <horning at amnh.org> wrote:
Hi - I am trying calculate the sum of blocks of Landsat pixels (30m resolution) that fit within MODIS pixels 960m resolution) and store that values at the Landsat cell size. To accomplish that I am running aggregate with the "sum" function on a Landsat band and then I run disaggregate on the result to get the resolution back to the Landsat pixel size. When I do this the disaggregate function gives me the following error: -- Error in writeBin(v, x at file@con, size = x at file@dsize) : only 2^31-1 bytes can be written in a single writeBin() call -- I can recreate the error with this script: -- a <- raster(nrows=7776, ncols=7616, xmn=718335, xmx=946815, ymn=-757485, ymx=-524205, crs="+proj=utm +zone=35 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0") a[] <- 1 b <- aggregate(a, fact=32, fun=sum) c <- disaggregate(b, fact=32) -- I am running R 3.0.2 on Ubuntu 12.04 with version 2.2-12 of the raster package. Please let me know if you see any problems with my code. Thanks. Ned
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo