Hi,

I am trying to assign a unique ID number to each tile in a large raster
file.

My code is below:

##Write tile indexed MODIS file
#Prelims
nColVal<-190
outFileName <- 'tmp.grd'

#Set up raster
out <- raster(nrow=20000,ncol=nColVal)#modisRasterAll

##Get number of colums and blocksize
outCol <- ncol(out)
bs <- blockSize(out)

##Write to file
out <- writeStart(out,outFileName,overwrite=TRUE)
for(i in 1:bs$n){
  print(i)
  out <-
writeValues(out,((outCol*(bs$row[i]-1))+1):((bs$row[i]+bs$nrows[i]-1)*outCol),bs$row[i])
}
out <- writeStop(out)

tail(out)

When I run this code with nColVal=190, I get the expected result from
tail(out): a sequence of numbers.  However, when I run this code with
nColVal=1900, I do not and instead get
"37999996 38000000 38000000 38000000" for out[20000,1897:1900].

I would like to get instead "37999997 37999998 37999999 38000000".

Thanks for any assistance,

Ted Rosenbaum
Department of Economics
Yale University

	[[alternative HTML version deleted]]

