[Raster-commits] r281 - in pkg/raster: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Feb 12 16:11:46 CET 2009
Author: rhijmans
Date: 2009-02-12 16:11:46 +0100 (Thu, 12 Feb 2009)
New Revision: 281
Modified:
pkg/raster/R/Merge.R
pkg/raster/R/aggregate.R
pkg/raster/R/crop.R
pkg/raster/R/disaggregate.R
pkg/raster/R/init.R
pkg/raster/R/linesToRaster.R
pkg/raster/R/mCalc.R
pkg/raster/R/neighborhood.R
pkg/raster/R/polygonToRaster.R
pkg/raster/R/reclass.R
pkg/raster/R/sOverlay.R
pkg/raster/R/writeGDAL.R
pkg/raster/man/LinesToRaster.Rd
pkg/raster/man/PolygonsToRaster.Rd
pkg/raster/man/aggregate-methods.Rd
pkg/raster/man/crop.Rd
pkg/raster/man/disaggregate.Rd
pkg/raster/man/init.Rd
pkg/raster/man/neighborhood.Rd
pkg/raster/man/reclass.Rd
Log:
Modified: pkg/raster/R/Merge.R
===================================================================
--- pkg/raster/R/Merge.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/Merge.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -6,15 +6,8 @@
# Licence GPL v3
-
-if (!isGeneric("merge")) {
- setGeneric("merge", function(x, y, ...)
- standardGeneric("merge"))
-}
-
-
setMethod('merge', signature(x='RasterLayer', y='RasterLayer'),
-function(x,y,...,tolerance=0.05, filename="", overwrite=FALSE ){
+function(x,y,...,tolerance=0.05, filename="", overwrite=FALSE, filetype='raster', track=-1 ){
rasters <- list(...)
if (length(rasters) > 0) {
@@ -33,14 +26,16 @@
outraster <- setRaster(rasters[[1]], filename)
# bndbox <- newBbox(bb[1,1], bb[1,2], bb[2,1], bb[2,2])
outraster <- setBbox(outraster, bb, keepres=TRUE, snap=FALSE)
-
+
isint <- TRUE
for (i in 1:length(rasters)) {
- if (rasters[[i]]@file at datatype != 'INT4S') {
+ if (rasters[[i]]@file at datatype != 'integer') {
isInt <- FALSE
}
}
- if (isInt) { outraster <- setDatatype(outraster, 'INT4S') }
+ if (isInt) {
+ outraster <- setDatatype(outraster, 'INT4S')
+ }
rowcol <- matrix(0, ncol=3, nrow=length(rasters))
for (i in 1:length(rasters)) {
@@ -73,12 +68,14 @@
}
if (filename(outraster) != '') {
outraster <- setValues(outraster, rd, r)
- outraster <- writeRaster(outraster, overwrite=overwrite)
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
} else {
v <- c(v, rd)
}
}
- if (filename(outraster) == '') { outraster <- setValues(outraster, v) }
+ if (filename(outraster) == '') {
+ outraster <- setValues(outraster, v)
+ }
return(outraster)
}
)
Modified: pkg/raster/R/aggregate.R
===================================================================
--- pkg/raster/R/aggregate.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/aggregate.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -8,7 +8,7 @@
setMethod('aggregate', signature(x='RasterLayer'),
-function(x, fact=2, fun=mean, expand=TRUE, rm.NA=TRUE, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S') {
+function(x, fact=2, fun=mean, expand=TRUE, rm.NA=TRUE, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1) {
if (length(fact)==1) {
fact <- round(fact)
if (fact < 2) { stop('fact should be > 1') }
@@ -55,12 +55,12 @@
}
} else if ( dataSource(x) == 'disk') {
-
+ starttime <- proc.time()
+
cols <- rep(rep(1:csteps,each=xfact)[1:ncol(x)], times=yfact)
rows <- rep(1, each=(ncol(x) * yfact))
v <- vector(length=0)
- for (r in 1:rsteps)
- {
+ for (r in 1:rsteps) {
startrow <- 1 + (r - 1) * yfact
if ( r==rsteps) {
endrow <- min(nrow(x), startrow + yfact - 1)
@@ -84,6 +84,13 @@
outRaster <- setValues(outRaster, vals, r)
outRaster <- writeRaster(outRaster, overwrite=overwrite, filetype=filetype)
}
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
}
if (filename(outRaster) == "") {
outRaster <- setValues(outRaster, v)
Modified: pkg/raster/R/crop.R
===================================================================
--- pkg/raster/R/crop.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/crop.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -3,17 +3,12 @@
# International Rice Research Institute
#contact: r.hijmans at gmail.com
# Date : October 2008
-# Version 0,7
+# Version 0.8
# Licence GPL v3
-#resample <- function(raster, xmin, xmax, ymin, ymax, ncols, nrows, method="bilinear", filename="", overwrite=FALSE) {
-# stop("sorry, not implemented yet")
-#}
+crop <- function(raster, bndbox, filename="", overwrite=FALSE, filetype='raster', track=-1) {
-
-
-crop <- function(raster, bndbox, filename="", overwrite=FALSE) {
# we could also allow the raster to expand but for now let's not and first make a separate expand function
bb <- bbIntersect(c(raster, bndbox))
bb <- snapBbox(bb, raster)
@@ -29,30 +24,36 @@
outraster <- setValues(outraster, values(raster)[selected_cells])
outraster <- setMinMax(outraster)
if (filename(outraster) != "" ) {
- outraster <- try(writeRaster(outraster, overwrite=overwrite))
+ outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
}
} else if ( dataSource(raster) == 'disk') {
-
+ starttime <- proc.time()
first_col <- colFromX(raster, xmin(outraster) + 0.5 * xres(outraster))
first_row <- rowFromY(raster, ymax(outraster) - 0.5 * yres(outraster))
last_row <- first_row + nrow(outraster) - 1
rownr <- 1
v <- vector(length=0)
for (r in first_row:last_row) {
- raster <- readPartOfRow(raster, r, first_col, ncol(outraster) )
+ raster <- readPartOfRow( raster, r, first_col, ncol(outraster) )
if (filename(outraster) == '') {
v <- c(v, values(raster))
} else {
outraster <- setValues(outraster, values(raster), rownr)
- outraster <- writeRaster(outraster, overwrite=overwrite)
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
}
rownr <- rownr + 1
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /rownr
+ ttg <- round(tpr/60 * (nrow(raster) - rownr), digits=1)
+ cat('row', rownr, '-', ttg, 'minutes to go\n')
+ }
}
- if (filename(outraster) == '') { outraster <- setValues(outraster, v) }
-
+ if (filename(outraster) == '') {
+ outraster <- setValues(outraster, v)
+ }
}
return(outraster)
}
-
-
Modified: pkg/raster/R/disaggregate.R
===================================================================
--- pkg/raster/R/disaggregate.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/disaggregate.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -6,7 +6,7 @@
# Licence GPL v3
-disaggregate <- function(raster, fact=2, filename="", overwrite=FALSE) {
+disaggregate <- function(raster, fact=2, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1) {
if (length(fact)==1) {
fact <- round(fact)
if (fact < 2) { stop('fact should be > 1') }
@@ -21,6 +21,7 @@
}
outraster <- setRaster(raster, filename)
+ outraster <- setDatatype(outraster, datatype)
outraster <- setRowCol(outraster, nrow(raster) * yfact, ncol(raster) * xfact)
if ( dataContent(raster)=='all') {
@@ -29,9 +30,12 @@
rows <- rep(1:nrow(raster), each=ncol(raster)*xfact*yfact)
cells <- cellFromRowCol(raster, rows, cols)
outraster <- setValues(outraster, values(raster)[cells])
- if (filename(outraster) != "") {writeRaster(outraster, overwrite=overwrite)}
+ if (filename(outraster) != "") {
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+ }
} else if ( dataSource(raster) == 'disk') {
+ starttime <- proc.time()
v <- vector(length=0)
cols <- rep(1:ncol(raster), each=xfact)
@@ -43,11 +47,20 @@
v <- c(v, values(raster)[cols])
} else {
outraster <- setValues(outraster, values(raster)[cols], (r-1) * xfact + i)
- outraster <- writeRaster(outraster, overwrite=overwrite)
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
}
}
}
- if (filename(outraster) == '') { outraster <- setValues(outraster, v) }
+ if (filename(outraster) == '') {
+ outraster <- setValues(outraster, v)
+ }
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
}
return(outraster)
}
Modified: pkg/raster/R/init.R
===================================================================
--- pkg/raster/R/init.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/init.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -5,10 +5,10 @@
# Licence GPL v3
-init <- function(raster, fun=runif, filename="", overwrite=FALSE, asInt=FALSE) {
+init <- function(raster, fun=runif, filename="", overwrite=FALSE, datatype = 'FLT4S', filetype='raster', track=-1) {
filename <- trim(filename)
outraster <- setRaster(raster, filename)
- if (asInt) {setDatatype(outraster, 'integer') }
+ outraster <- setDatatype(raster, datatype)
if ( dataContent(raster) == 'all' | dataSource(raster) == 'ram' ) {
n <- ncell(raster)
@@ -18,6 +18,7 @@
}
} else if (dataSource(raster) == 'disk') {
+ starttime <- proc.time()
n <- length(ncol(raster))
v <- vector(length=0)
@@ -26,9 +27,15 @@
v <- c(v, fun(n))
} else {
outraster <- setValues(outraster, fun(n), r)
- outraster <- writeRaster(outraster, overwrite=overwrite)
+ outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
}
- }
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
+ }
if (filename(outraster) == "") {
outraster <- setValues(outraster, v)
}
Modified: pkg/raster/R/linesToRaster.R
===================================================================
--- pkg/raster/R/linesToRaster.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/linesToRaster.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -87,7 +87,7 @@
}
-linesToRaster <- function(spLines, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", datatype='FLT4S') {
+linesToRaster <- function(spLines, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", filetype='raster', datatype='FLT4S', track=-1) {
filename <- trim(filename)
if (updateRaster) {
@@ -148,6 +148,7 @@
rxmn <- xmin(raster) + 0.1 * xres(raster)
rxmx <- xmax(raster) - 0.1 * xres(raster)
for (r in 1:nrow(raster)) {
+ starttime <- proc.time()
rv <- rep(NA, ncol(raster))
ly <- yFromRow(raster, r)
@@ -192,8 +193,16 @@
v <- c(v, rv)
} else {
raster <- setValues(raster, values=rv, rownr=r)
- raster <- writeRaster(raster)
+ raster <- writeRaster(raster, filetype=filetype)
}
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
+
}
if (filename == "") {
raster <- setValues(raster, v)
Modified: pkg/raster/R/mCalc.R
===================================================================
--- pkg/raster/R/mCalc.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/mCalc.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -43,6 +43,14 @@
ttg <- round(tpr/60 * (nrow(x) - r), digits=1)
cat('row', r, '-', ttg, 'minutes to go\n')
}
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(x) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
+
}
if (filename(outraster) == "") {
outraster <- setValues(outraster, v)
Modified: pkg/raster/R/neighborhood.R
===================================================================
--- pkg/raster/R/neighborhood.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/neighborhood.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -41,7 +41,7 @@
}
-neighborhood <- function(raster, fun=mean, filename="", ngb=3, keepdata=TRUE, overwrite=FALSE, asInt=FALSE) {
+neighborhood <- function(raster, fun=mean, filename="", ngb=3, keepdata=TRUE, overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1) {
ngb <- round(ngb)
if ((ngb / 2) == floor(ngb/2)) { stop("only odd neighborhoods are supported") }
if (ngb == 1) { stop("ngb should be 3 or larger") }
@@ -49,7 +49,7 @@
filename <- trim(filename)
ngbgrid <- setRaster(raster, filename)
- if (asInt) {setDatatype(ngbgrid, 'INT4S') }
+ ngbgrid <- setDatatype(ngbgrid, datatype)
# first create an empty matrix with nrows = ngb and ncols = raster at ncols
ngbdata1 <- array(data = NA, dim = c(ngb, ncol(raster)))
@@ -58,6 +58,8 @@
rr <- 1
v <- vector(length=0)
for (r in 1:nrow(raster)) {
+ starttime <- proc.time()
+
if (dataContent(raster)=='all') {
rowdata <- valuesRow(raster, r)
} else {
@@ -68,12 +70,20 @@
ngbvals <- .calc.ngb(ngbdata, ngb, fun, keepdata)
if (filename != "") {
ngbgrid <- setValues(ngbgrid, ngbvals, rr)
- ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite)
+ ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
} else {
v <- c(v, ngbvals)
}
rr <- rr + 1
}
+
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
+
}
ngbdata1 <- array(data = NA, dim = c(ngb, raster at ncols))
@@ -82,7 +92,7 @@
ngbvals <- .calc.ngb(ngbdata, ngb, fun, keepdata)
if (filename != "") {
ngbgrid <- setValues(ngbgrid, ngbvals, rr)
- ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite)
+ ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
} else {
v <- c(v, ngbvals)
}
Modified: pkg/raster/R/polygonToRaster.R
===================================================================
--- pkg/raster/R/polygonToRaster.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/polygonToRaster.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -60,7 +60,7 @@
-polygonsToRaster <- function(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", datatype='FLT4S', trackRows=c(100, 500, 1:(round(nrow(raster)/1000)) * 1000)) {
+polygonsToRaster <- function(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", filetype='raster', datatype='FLT4S', track=c(100, 500, 1:(round(nrow(raster)/1000)) * 1000)) {
filename <- trim(filename)
starttime <- proc.time()
@@ -153,16 +153,16 @@
} else {
rv[over] <- subpol[i,4]
}
- print(paste('exit node intersection on row:', r))
+ # print(paste('exit node intersection on row:', r))
} else {
for (k in 1:round(nrow(intersection)/2)) {
l <- (k * 2) - 1
x1 <- x[l]
x2 <- x[l+1]
- if (is.na(x2)) {
- txt <- paste('something funny at row:', r, 'polygon:',j)
- stop(txt)
- }
+ #if (is.na(x2)) {
+ # txt <- paste('something funny at row:', r, 'polygon:',j)
+ # stop(txt)
+ #}
if (x1 > rxmx) { next }
if (x2 < rxmn) { next }
# adjust to skip first cell if the center is not covered by this polygon
@@ -204,10 +204,10 @@
v <- c(v, rv)
} else {
raster <- setValues(raster, values=rv, rownr=r)
- raster <- writeRaster(raster, overwrite=overwrite)
+ raster <- writeRaster(raster, overwrite=overwrite, filetype=filetype)
}
- if (r %in% trackRows) {
+ if (r %in% track) {
elapsed <- (proc.time() - starttime)[3]
tpr <- round((elapsed /r), digits=2)
print(paste('row', r, '--', tpr, 'seconds/row --', nrow(raster)+1-r, " rows to go"))
Modified: pkg/raster/R/reclass.R
===================================================================
--- pkg/raster/R/reclass.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/reclass.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -4,7 +4,7 @@
# Version 0,6
# Licence GPL v3
-reclass <- function(raster, rclmat, filename="", overwrite=FALSE, asInt=FALSE) {
+reclass <- function(raster, rclmat, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1) {
if (class(raster) != 'RasterLayer' ) {
stop('first two arguments should be objects of class "RasterLayer"')
}
@@ -18,13 +18,9 @@
print(rclmat)
outraster <- setRaster(raster, filename)
- if (asInt) {
- outraster <- setDatatype(outraster, "INT4S")
- res <- vector(mode = "integer", length = ncol(raster))
- } else {
- outraster <- setDatatype(outraster, "FLT4S")
- res <- vector(mode = "numeric", length = ncol(raster))
- }
+ outraster <- setDatatype(outraster, datatype)
+
+ res <- vector(length = ncol(raster))
if ( dataContent(raster) == 'all' | dataContent(raster) == 'sparse') {
res <- values(raster)
@@ -42,10 +38,11 @@
outraster <- setValues(outraster, res, dataIndices(raster))
}
if (filename(outraster) != "" ) {
- outraster <- writeRaster(outraster, overwrite=overwrite)
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
}
} else {
+ starttime <- proc.time()
for (r in 1:nrow(raster)) {
raster <- readRow(raster, r)
res <- values(raster)
@@ -57,8 +54,14 @@
}
}
outraster <- setValues(outraster, res, r)
- outraster <- writeRaster(outraster, overwrite=overwrite)
- }
+ outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+ }
+ if (r %in% track) {
+ elapsed <- (proc.time() - starttime)[3]
+ tpr <- elapsed /r
+ ttg <- round(tpr/60 * (nrow(raster) - r), digits=1)
+ cat('row', r, '-', ttg, 'minutes to go\n')
+ }
}
return(outraster)
}
Modified: pkg/raster/R/sOverlay.R
===================================================================
--- pkg/raster/R/sOverlay.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/sOverlay.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -1,7 +1,7 @@
setMethod('overlay', signature(x='RasterStack', y='missing'),
-function(x, y, fun, indices=1:nlayers(x), filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1, ...){
+function(x, y, fun, indices=1:nlayers(x), filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1){
if (missing(fun)) {
stop("you must supply a function 'fun'. E.g., 'fun=function(x,y){return(x+y)}'")
@@ -10,3 +10,4 @@
warning('not implemented yet')
}
)
+
Modified: pkg/raster/R/writeGDAL.R
===================================================================
--- pkg/raster/R/writeGDAL.R 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/R/writeGDAL.R 2009-02-12 15:11:46 UTC (rev 281)
@@ -84,9 +84,9 @@
.writeGDALrow <- function(raster, gdalfiletype, overwrite, mvFlag, options ) {
rownr <- rowFromCell(raster, dataIndices(raster)[1])
- if (rownr %in% c(1, 10, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 20000, 30000, 40000, 50000, 100000)) {
- print( paste("writing row", rownr, "at:", format(Sys.time(), "%H:%M:%S")))
- }
+# if (rownr %in% c(1, 10, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 20000, 30000, 40000, 50000, 100000)) {
+# print( paste("writing row", rownr, "at:", format(Sys.time(), "%H:%M:%S")))
+# }
if ( rownr == 1) {
transient <- .getGDALtransient(raster, gdalfiletype, overwrite, mvFlag, options)
attr(raster, "transient") <- transient
Modified: pkg/raster/man/LinesToRaster.Rd
===================================================================
--- pkg/raster/man/LinesToRaster.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/LinesToRaster.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -7,7 +7,7 @@
Lines to raster conversion. Lines are raserized.
}
\usage{
-linesToRaster(spLines, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", datatype='FLT4S')
+linesToRaster(spLines, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", filetype='raster', datatype='FLT4S', track=-1)
}
\arguments{
@@ -17,8 +17,10 @@
\item{filename}{ output filename }
\item{overwrite}{ logical. if \code{TRUE} ouput file will be overwritten if it exists }
\item{updateRaster}{logical. If \code{TRUE} the values of the input RasterLayer are updated where the polygons overlap cells }
+ \item{updateValue}{character. Select cells to be updated (if \code{updateRaster == TRUE}) by their current values. Either 'all', 'NA', '!NA', or 'zero' }
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
\item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
- \item{updateValue}{character. Select cells to be updated (if \code{updateRaster == TRUE}) by their current values. Either 'all', 'NA', '!NA', or 'zero' }
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
Modified: pkg/raster/man/PolygonsToRaster.Rd
===================================================================
--- pkg/raster/man/PolygonsToRaster.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/PolygonsToRaster.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -7,7 +7,7 @@
Two algorithms for polygon to raster conversion. The polygons are rasterized. Either values associated with each polygon, or a polygon ID is transferred. Holes in polygons are recognized by polygonsToRaster, but not by polygonsToRaster2.
}
\usage{
-polygonsToRaster(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", datatype='FLT4S', trackRows=c(100, 500, 1:(round(nrow(raster)/1000)) * 1000))
+polygonsToRaster(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", filetype='raster', datatype='FLT4S', track=c(100, 500, 1:(round(nrow(raster)/1000)) * 1000))
}
\arguments{
@@ -18,8 +18,9 @@
\item{overwrite}{ logical. if \code{TRUE} ouput file will be overwritten if it exists }
\item{updateRaster}{logical. If \code{TRUE} the values of the input RasterLayer are updated where the polygons overlap cells }
\item{updateValue}{character. Select cells to be updated (if \code{updateRaster == TRUE}) by their current values. Either 'all', 'NA', '!NA', or 'zero' }
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
\item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
- \item{trackRows}{vector of row numbers for which the function will report that they have been processed. To track progress on very large files }
+ \item{track}{vector of row numbers for which the function will report that they have been processed. To track progress on very large files }
}
\details{
Modified: pkg/raster/man/aggregate-methods.Rd
===================================================================
--- pkg/raster/man/aggregate-methods.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/aggregate-methods.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -13,14 +13,15 @@
\item{x}{ a RasterLayer object}
-\item{filename}{output filename for a new raster}
\item{fun}{function used to aggregate values. It should return one number. E.g. mean or max}
\item{fact}{degree of aggregation or disaggregation expressed as number of cells (horizontally and vertically). See details}
\item{expand}{if \code{expand == TRUE} grids will get larger if \code{factor} if the number of the division of the columns or rows with factor does not return an integer}
\item{rm.NA}{if \code{rm.NA == TRUE}, remove NA cells from calculations}
+ \item{filename}{output filename}
+ \item{overwrite}{logical. If \code{TRUE}, "filename" will be overwritten if it exists}
\item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
\item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
- \item{overwrite}{if TRUE, "filename" will be overwritten if it exists}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
}
Modified: pkg/raster/man/crop.Rd
===================================================================
--- pkg/raster/man/crop.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/crop.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -6,7 +6,7 @@
crop returns a subset of the input RasterLayer as specified by a the supplied bounding box (or object that has a bounding box). Areas in the bounding box outside of the intput RasterLayer are ignored.
}
\usage{
-crop(raster, bndbox, filename="", overwrite=FALSE)
+crop(raster, bndbox, filename="", overwrite=FALSE, filetype='raster', track=-1)
}
\arguments{
@@ -14,6 +14,8 @@
\item{bndbox}{BoundingBox object, or any object that is or has a bounding box (see below)}
\item{filename}{character. Output filename for a new raster}
\item{overwrite}{if \code{TRUE}, the file will be overwritten if it exists}
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
@@ -27,7 +29,7 @@
\author{Robert J. Hijmans}
\seealso{
-\code{\link[raster]{expand}}, \code{\link[raster]{Merge}}
+\code{\link[raster]{expand}}, \code{\link[raster]{merge}}
}
\examples{
Modified: pkg/raster/man/disaggregate.Rd
===================================================================
--- pkg/raster/man/disaggregate.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/disaggregate.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -6,7 +6,7 @@
Disaggregate a raster to create a new raster
}
\usage{
-disaggregate(raster, fact=2, filename="", overwrite=FALSE)
+disaggregate(raster, fact=2, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1)
}
\arguments{
@@ -14,6 +14,9 @@
\item{filename}{output filename for a new raster}
\item{fact}{degree of aggregation or disaggregation expressed as number of cells (horizontally and vertically). See details}
\item{overwrite}{if TRUE, "filename" will be overwritten if it exists}
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
+ \item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
Modified: pkg/raster/man/init.Rd
===================================================================
--- pkg/raster/man/init.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/init.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -7,15 +7,17 @@
Set values for a new raster (from scratch)
}
\usage{
-init(raster, fun=runif, filename="", overwrite=FALSE, asInt = FALSE)
+init(raster, fun=runif, filename="", overwrite=FALSE, datatype='FLT4S', filetype='raster', track=-1)
}
\arguments{
\item{raster}{A RasterLayer object}
\item{fun}{The function to be applied}
\item{filename}{Output filename for a new raster; if NA the result is not written to a file but returned with the RasterLayer object, in the data slot}
- \item{overwrite}{Logical to indicate whether an existing output file should be overwritten}
- \item{asInt}{logical. If \code{TRUE}, output will be integer values}
+ \item{overwrite}{Logical. if \code{TRUE}, the file will be overwritten if it exists}
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
+ \item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
Modified: pkg/raster/man/neighborhood.Rd
===================================================================
--- pkg/raster/man/neighborhood.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/neighborhood.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -7,17 +7,19 @@
Neighborhood calculations
}
\usage{
-neighborhood(raster, fun=mean, filename="", ngb=3, keepdata=TRUE, overwrite=FALSE, asInt=FALSE)
+neighborhood(raster, fun=mean, filename="", ngb=3, keepdata=TRUE, overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1)
}
\arguments{
\item{raster}{A RasterLayer object}
\item{fun}{The function to be applied}
- \item{filename}{Output filename for a new raster; if NA the result is not written to a file but returned with the RasterLayer object, in the data slot}
+ \item{filename}{Output filename for a new raster}
\item{ngb}{Neighborhood size. Expressed in number of cells in a single direction. I.e. 3 refers to 2 cells at each side of the focal cell. Queen's case, 8 cells in total}
\item{keepdata}{Logical. If \code{TRUE}, NA will be removed for neighborhood computations. The result will only be NA if all cells are NA}
\item{overwrite}{Logical to indicate whether an existing output file should be overwritten}
- \item{asInt}{logical. If \code{TRUE}, output will be integer values}
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
+ \item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
Modified: pkg/raster/man/reclass.Rd
===================================================================
--- pkg/raster/man/reclass.Rd 2009-02-12 09:03:03 UTC (rev 280)
+++ pkg/raster/man/reclass.Rd 2009-02-12 15:11:46 UTC (rev 281)
@@ -7,7 +7,7 @@
Reclassify values of a RasterLayer
}
\usage{
-reclass(raster, rclmat, filename="", overwrite=FALSE, asInt = FALSE)
+reclass(raster, rclmat, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1)
}
\arguments{
@@ -15,7 +15,9 @@
\item{rclmat}{Matrix for reclassifcation. (see below)}
\item{filename}{Output filename for a new raster; if NA the result is not written to a file but returned with the RasterLayer object, in the data slot}
\item{overwrite}{Logical to indicate whether an existing output file should be overwritten}
- \item{asInt}{logical. If \code{TRUE}, output will be integer values}
+ \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
+ \item{datatype}{output data type; see \code{\link[raster]{setDatatype}}}
+ \item{track}{vector of row numbers for which the function will report that they have been processed}
}
\details{
More information about the Raster-commits
mailing list