[R-sig-Geo] insert NODATA_value -999.0 into asc file
Robert Hijmans
r.hijmans at gmail.com
Wed Jun 22 18:21:02 CEST 2011
> have a large number (several thousand) of asci files which were
> delivered to me without a NODATA_value -999.0 line in the header
If all your files are for the same area you could do something like
r <- raster(ncol=601, nrow=351, xmn=100000, xmx=701000, ymax=250000,
ymn=-101000)
filename <- 'file.asc'
v <- as.numeric( scan(filename, skip=6, what='character')
v[v==-999] <- NA
r1 <- setValues(r, v)
Else you could read the first couple of lines to adjust values in the
'raster' function.
Robert
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/insert-NODATA-value-999-0-into-asc-file-tp6497397p6504947.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
More information about the R-sig-Geo
mailing list