[Raster-commits] r370 - in pkg/raster: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 19 02:13:48 CET 2009


Author: rhijmans
Date: 2009-03-19 02:13:48 +0100 (Thu, 19 Mar 2009)
New Revision: 370

Added:
   pkg/raster/R/projection.R
   pkg/raster/man/islatlon.Rd
   pkg/raster/man/projection.Rd
Removed:
   pkg/raster/man/setProjection.Rd
Modified:
   pkg/raster/R/Artith.R
   pkg/raster/R/Compare_Logical.R
   pkg/raster/R/Math.R
   pkg/raster/R/Merge.R
   pkg/raster/R/aaaClasses.R
   pkg/raster/R/aggregate.R
   pkg/raster/R/alignBbox.R
   pkg/raster/R/bboxUnion.R
   pkg/raster/R/calc.R
   pkg/raster/R/calcStack.R
   pkg/raster/R/cellsFromBbox.R
   pkg/raster/R/coercion.R
   pkg/raster/R/compare.R
   pkg/raster/R/copyRaster.R
   pkg/raster/R/cover.R
   pkg/raster/R/crop.R
   pkg/raster/R/disaggregate.R
   pkg/raster/R/distance.R
   pkg/raster/R/drawPoly.R
   pkg/raster/R/expand.R
   pkg/raster/R/getBbox.R
   pkg/raster/R/inifile.R
   pkg/raster/R/init.R
   pkg/raster/R/linesToRaster.R
   pkg/raster/R/map.R
   pkg/raster/R/neighborhood.R
   pkg/raster/R/overlayList.R
   pkg/raster/R/pointsToRaster.R
   pkg/raster/R/polygonToRaster.R
   pkg/raster/R/project.R
   pkg/raster/R/properties.R
   pkg/raster/R/raster.R
   pkg/raster/R/rasterFromFile.R
   pkg/raster/R/rasterFromFileGDAL.R
   pkg/raster/R/rasterToPoints.R
   pkg/raster/R/readRaster.R
   pkg/raster/R/readSkip.R
   pkg/raster/R/readSurfer.R
   pkg/raster/R/reclass.R
   pkg/raster/R/replaceProperties.R
   pkg/raster/R/replacement.R
   pkg/raster/R/replacement2.R
   pkg/raster/R/resample.R
   pkg/raster/R/set.R
   pkg/raster/R/setBbox.R
   pkg/raster/R/setFilename.R
   pkg/raster/R/setRowCol.R
   pkg/raster/R/stackAdd.R
   pkg/raster/R/stackFile.R
   pkg/raster/R/summary.R
   pkg/raster/R/writeGDAL.R
   pkg/raster/R/writeRaster.R
   pkg/raster/R/writeRasterRow.R
   pkg/raster/R/writeRasterSparse.R
   pkg/raster/R/xyCell.R
   pkg/raster/R/xyProperties.R
   pkg/raster/man/crop.Rd
   pkg/raster/man/expand.Rd
   pkg/raster/man/extent.Rd
   pkg/raster/man/filename.Rd
   pkg/raster/man/getBbox.Rd
   pkg/raster/man/pointsToRaster.Rd
   pkg/raster/man/polygonFromBbox.Rd
   pkg/raster/man/properties.Rd
   pkg/raster/man/raster.Rd
   pkg/raster/man/rasterFromFile.Rd
   pkg/raster/man/setNAvalue.Rd
   pkg/raster/man/shift.Rd
   pkg/raster/man/unionBbox.Rd
   pkg/raster/man/writeRaster.Rd
Log:


Modified: pkg/raster/R/Artith.R
===================================================================
--- pkg/raster/R/Artith.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/Artith.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -15,10 +15,10 @@
 				raster <- raster(e1, filename=tempfile())
 				for (r in 1:nrow(e1)) {
 					raster <- setValues(raster, callGeneric( as.numeric(.getRowValues(e1, r)), .getRowValues(e2, r) ), r)
-					raster <- writeRaster(raster)
+					writeRaster(raster)
 				}
 				if (options('verbose')[[1]]) {
-					cat('values were written to:', filename(raster))
+					cat('values were written to:', raster at file@name)
 				}
 			}	
 			return(raster)
@@ -35,7 +35,7 @@
 			raster <- raster(e1, filename=tempfile())
 			for (r in 1:nrow(e1)) {
 				raster <- setValues(raster, callGeneric( as.numeric(.getRowValues(e1, r)), e2) , r) 
-				raster <- writeRaster(raster)
+				writeRaster(raster)
 			}
 			if (options('verbose')[[1]]) {
 				cat('values were written to:', filename(raster))
@@ -53,7 +53,7 @@
 			raster <- raster(e2, filename=tempfile())
 			for (r in 1:nrow(e2)) {
 				raster <- setValues(raster, callGeneric(as.numeric(e1), .getRowValues(e2, r)) , r)
-				raster <- writeRaster(raster)
+				writeRaster(raster)
 			}
 			if (options('verbose')[[1]]) {
 				cat('values were written to:', filename(raster))

Modified: pkg/raster/R/Compare_Logical.R
===================================================================
--- pkg/raster/R/Compare_Logical.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/Compare_Logical.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -49,7 +49,7 @@
 			dataType(rst) <- 'LOG1S'
 			for (r in 1:nrow(x)) {
 				rst <- setValues(rst, !.getRowValues(x, r), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 			return(rst)		
 		}
@@ -68,11 +68,11 @@
 		if (canProcessInMemory(e1, 3)) {
 			rst <- setValues(rst, values=callGeneric(.getRasterValues(e1), rep(e2, ncell(e1)) ) )			
 		} else {
-			rst <- setFilename(rst, value=tempfile())
+			filename(rst) <- tempfile()
 			rowrep <- rep(e2, ncol(e1))
 			for (r in 1:nrow(e1)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(e1, r), rowrep ), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 		}
 		return(rst)
@@ -96,7 +96,7 @@
 			rowrep <- rep(e1, ncol(e2))
 			for (r in 1:nrow(e2)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(e2, r), rowrep ), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 		}
 		return(rst)
@@ -114,10 +114,10 @@
 		if (canProcessInMemory(e1, 3)) {
 			rst <- setValues(rst, callGeneric(.getRasterValues(e1), .getRasterValues(e2) ) ) 
 		} else {
-			rst <- setFilename(rst, value=tempfile())
+			filename(rst) <- tempfile()
 			for (r in 1:nrow(e1)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(e1, r), .getRowValues(e2, r) ), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 		}
 		return(rst)
@@ -136,10 +136,10 @@
 			if (canProcessInMemory(e1, 3)) {
 				rst <- setValues(rst, callGeneric(.getLogicalValues(e1), .getLogicalValues(e2)))
 			} else {
-				rst <- setFilename(rst, value=tempfile())
+				filename(rst) <- tempfile()
 				for (r in 1:nrow(e1)) {
 					rst <- setValues(rst, callGeneric( .getLogicalRowValues(e1, r), .getLogicalRowValues(e2, r) ), r)
-					rst <- writeRaster(rst)
+					writeRaster(rst)
 				}
 			}	
 			return(rst)

Modified: pkg/raster/R/Math.R
===================================================================
--- pkg/raster/R/Math.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/Math.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -22,7 +22,7 @@
 			}
 			for (r in 1:nrow(x)) {
 				rst <- setValues(rst, callGeneric( .getRowValues(x, r) ), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 			if (options('verbose')[[1]]) {
 				cat('values were written to:', filename(raster))
@@ -49,7 +49,7 @@
 			}
 			for (r in 1:nrow(x)) {
 				rst <- setValues(rst, callGeneric(.getRowValues(x, r), digits), r)
-				rst <- writeRaster(rst)
+				writeRaster(rst)
 			}
 			return(rst)
 		}

Modified: pkg/raster/R/Merge.R
===================================================================
--- pkg/raster/R/Merge.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/Merge.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -50,7 +50,7 @@
 	
 	if (!canProcessInMemory(x, 2) && filename == '') {
 		filename <- tempfile()
-		outraster <- setFilename(outraster, filename )
+		filename(outraster) <- filename
 		if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 	}
 
@@ -76,9 +76,9 @@
 			}		
 		}
 		
-		if (filename(outraster) != '') {
+		if (outraster at file@name != '') {
 			outraster <- setValues(outraster, rd, r)
-			outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+			writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 		} else {
 			v <- c(v, rd)
 		}
@@ -86,7 +86,7 @@
 		if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 		
 	}
-	if (filename(outraster) == '') { 
+	if (outraster at file@name == "") { 
 		outraster <- setValues(outraster, v) 
 	}
 	return(outraster)

Modified: pkg/raster/R/aaaClasses.R
===================================================================
--- pkg/raster/R/aaaClasses.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/aaaClasses.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -46,7 +46,7 @@
 		crs = CRS(as.character(NA))
 	),
 	validity = function(object) {
-		validObject(getBbox(object))
+		validObject(extent(object))
 		c1 <- (object at ncols > 0)
 		if (!c1) { stop('ncols < 1') }
 		c2 <- (object at nrows > 0)

Modified: pkg/raster/R/aggregate.R
===================================================================
--- pkg/raster/R/aggregate.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/aggregate.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -41,7 +41,7 @@
 	outRaster <- raster(x, filename)
 	outRaster <- setDatatype(outRaster, datatype)
 	bndbox <- newBbox(xmin(x), xmx, ymn, ymax(x))
-	outRaster <- setExtent(outRaster, bndbox, keepres=F)
+	outRaster <- setExtent(outRaster, bndbox, keepres=FALSE)
 	outRaster <- setRowCol(outRaster, nrows=rsteps, ncols=csteps) 
 	
 	if (dataContent(x) == 'all') {	
@@ -54,14 +54,14 @@
 		} else {
 			outRaster <- setValues(outRaster, as.vector(tapply(values(x), cells, fun))) 
 		}
-		if (filename(outRaster) != "") {
-			outRaster <- writeRaster(outRaster, overwrite=overwrite, filetype=filetype)
+		if (outRaster at file@name != "") {
+			writeRaster(outRaster, overwrite=overwrite, filetype=filetype)
 		}
 
 	} else if ( dataSource(x) == 'disk') { 
 		if (!canProcessInMemory(x, 3) && filename == '') {
 			filename <- tempfile()
-			outraster <- setFilename(outraster, filename )
+			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}
 		starttime <- proc.time()
@@ -90,17 +90,17 @@
 			}
 			vals <- as.vector(vals)
 
-			if (filename(outRaster) == "") {
+			if (outRaster at file@name == "") {
 				v <- c(v, vals)
 			} else {
 				outRaster <- setValues(outRaster, vals, r)
-				outRaster <- writeRaster(outRaster, overwrite=overwrite, filetype=filetype)
+				writeRaster(outRaster, overwrite=overwrite, filetype=filetype)
 			}
 			
 			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 			
 		} 
-		if (filename(outRaster) == "") { 
+		if (outRaster at file@name == "") { 
 			outRaster <- setValues(outRaster, v) 
 		}
 	}

Modified: pkg/raster/R/alignBbox.R
===================================================================
--- pkg/raster/R/alignBbox.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/alignBbox.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -8,7 +8,7 @@
 
 
 alignBbox <- function(bndbox, object) {
-	oldbb <- getBbox(object)
+	oldbb <- extent(object)
 	bndbox at xmin <- max(bndbox at xmin, oldbb at xmin)
 	bndbox at xmax <- min(bndbox at xmax, oldbb at xmax)
 	bndbox at ymin <- max(bndbox at ymin, oldbb at ymin)

Modified: pkg/raster/R/bboxUnion.R
===================================================================
--- pkg/raster/R/bboxUnion.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/bboxUnion.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -8,11 +8,11 @@
 unionBbox <- function(x, ...) {
 	objects <- c(x, list(...))
 	if (length(objects) == 1) {
-		return(getBbox(x))
+		return(extent(x))
 	}
-	bb <- getBbox(objects[[1]])
+	bb <- extent(objects[[1]])
 	for (i in 2:length(objects)) {
-		bb2 <- getBbox(objects[[i]])
+		bb2 <- extent(objects[[i]])
 		bb at xmin <- min(xmin(bb), xmin(bb2))
 		bb at xmax <- max(xmax(bb), xmax(bb2))
 		bb at ymin <- min(ymin(bb), ymin(bb2))
@@ -24,11 +24,11 @@
 intersectBbox <- function(x, ...) {
 	objects <- c(x, list(...))
 	if (length(objects) == 1) {
-		return(getBbox(x))
+		return(extent(x))
 	}
-	bb <- getBbox(objects[[1]])
+	bb <- extent(objects[[1]])
 	for (i in 2:length(objects)) {
-		bb2 <- getBbox(objects[[i]])
+		bb2 <- extent(objects[[i]])
 		bb at xmin <- max(xmin(bb), xmin(bb2))
 		bb at xmax <- min(xmax(bb), xmax(bb2))
 		bb at ymin <- max(ymin(bb), ymin(bb2))

Modified: pkg/raster/R/calc.R
===================================================================
--- pkg/raster/R/calc.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/calc.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -26,35 +26,35 @@
 	
 	if ( dataContent(x) == 'all') {
 		outraster <- setValues(outraster, fun(values(x))) 
-		if (filename(outraster)!="") { 
-			outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+		if (outraster at file@name != "") {
+			writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 		}
 	} else if ( dataContent(x) == 'sparse') {
 		outraster <- setValuesSparse(outraster, fun(values(x)),  dataIndices(x)) 
-		if (filename(outraster) != "") { 
-			outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+		if (outraster at file@name != "") { 
+			writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 		}
 	} else if (dataSource(x) == 'disk') {
 		if (!canProcessInMemory(x, 3) & filename == '') {
 			filename <- tempfile()
-			outraster <- setFilename(outraster, filename )
+			filename(outraster) <- filename
 		}
 		v <- vector(length=0)
 		starttime <- proc.time()
 
 		for (r in 1:nrow(x)) {
 			x <- readRow(x, r)
-			if (filename(outraster)=="") {
+			if (outraster at file@name == "") {
 				v <- c(v, fun(values(x)))
 			} else {
 				outraster <- setValues(outraster, fun(values(x)), r)
-				outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+				writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 			}
 			
 		if (r %in% track) { .showTrack(r, raster at nrows, track, starttime) }
 			
 		}
-		if (filename(outraster) == "") { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 	}

Modified: pkg/raster/R/calcStack.R
===================================================================
--- pkg/raster/R/calcStack.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/calcStack.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -21,28 +21,28 @@
 	if (dataContent(x) == "all") {
 		outraster <- setValues(outraster, apply(values(x), 1, fun)) 
 		if (filename != "") {
-			outRaster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+			writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 		}
 	} else {
 		starttime <- proc.time()
 		if (!canProcessInMemory(x, 4) & filename == '') {
 			filename=tempfile()
-			outraster <- setFilename(outraster, filename )
+			filename(outraster) <- filename
 		}
 		v <- vector(length=0)
 		for (r in 1:nrow(x)) {
 			x <- readRow(x, r)
-			if (filename(outraster)=="") {
+			if (outraster at file@name == "") {
 				v <- c(v, apply(values(x), 1, fun))
 			} else {
 				outraster <- setValues(outraster, apply(values(x), 1, fun), r) 
-				outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+				writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 			}
 	
 			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 		
 		}
-		if (filename(outraster) == "") { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 	}		

Modified: pkg/raster/R/cellsFromBbox.R
===================================================================
--- pkg/raster/R/cellsFromBbox.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/cellsFromBbox.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -9,11 +9,11 @@
 
 
 cellsFromBbox <- function(object, bndbox, expand=FALSE) {
-	bndbox <- getBbox(bndbox)
+	bndbox <- extent(bndbox)
 #	bndbox at xmax - 0.01 * xres(object)
 #	bndbox at ymin - 0.01 * yres(object)
 	
-	innerBox <- intersectBbox(getBbox(object), bndbox)
+	innerBox <- intersectBbox(extent(object), bndbox)
 
 	srow <- rowFromY(object, innerBox at ymax)
 	

Modified: pkg/raster/R/coercion.R
===================================================================
--- pkg/raster/R/coercion.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/coercion.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -119,7 +119,7 @@
 			}
 		} else {
 			rs <- new("RasterLayer")
-			rs <- setExtent(rs, getBbox(x))
+			rs <- setExtent(rs, extent(x))
 			rs <- setRowCol(rs, nrow(x), ncol(x))
 		}
 		return(rs)
@@ -131,8 +131,8 @@
 setMethod('asRasterLayer', signature(x='SpatialPixelsDataFrame'), 
 	function(x, index){
 		r <- raster()
-		r <- setExtent(r, getBbox(x))
-		r <- setProjection(r, x at proj4string)
+		r <- setExtent(r, extent(x))
+		projection(r) <- x at proj4string
 		r <- setRowCol(r, x at grid@cells.dim[2], x at grid@cells.dim[1])
 		dindex <- max(1, min(dim(x at data)[2], index))
 		if (dindex != index) { warning(paste("index was changed to", dindex))}
@@ -157,8 +157,8 @@
 setMethod('asRasterLayer', signature(x='SpatialGridDataFrame'), 
 	function(x, index){
 		r <- raster()
-		r <- setExtent(r, getBbox(x))
-		r <- setProjection(r, x at proj4string)
+		r <- setExtent(r, extent(x))
+		projection(r) <- x at proj4string
 		r <- setRowCol(r, x at grid@cells.dim[2], x at grid@cells.dim[1])
 		dindex <- max(1, min(dim(x at data)[2], index))
 		if (dindex != index) { warning(paste("index was changed to", dindex))}
@@ -172,8 +172,8 @@
 
 .asRasterStack <- function(spgrid) {
 	stk <- new("RasterStack")
-	stk <- setExtent(stk, getBbox(spgrid))
-	stk <- setProjection(stk, spgrid at proj4string)
+	stk <- setExtent(stk, extent(spgrid))
+	projection(stk) <- spgrid at proj4string
 	stk <- setRowCol(stk, spgrid at grid@cells.dim[2], spgrid at grid@cells.dim[1])
 	
 	if (class(spgrid)=='SpatialPixelsDataFrame') {
@@ -192,7 +192,7 @@
 
 
 .toSpBbox <- function(object) {
-	b <- getBbox(object)
+	b <- extent(object)
 	bb <- matrix(NA, 2, 2)
 	bb[1,1] <- b at xmin
 	bb[1,2] <- b at xmax

Modified: pkg/raster/R/compare.R
===================================================================
--- pkg/raster/R/compare.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/compare.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -17,7 +17,7 @@
 	minres <- min(resolution(objects[[1]]))
 	for (i in 2:length(objects)) { 
 		if (bb) {
-			if (!(isTRUE(all.equal(getBbox(objects[[1]]), getBbox(objects[[i]]), tolerance=tolerance, scale=minres )))) {
+			if (!(isTRUE(all.equal(extent(objects[[1]]), extent(objects[[i]]), tolerance=tolerance, scale=minres )))) {
 				result <- F
 				if (stopiffalse) { stop('Different bounding box') }
 				if (showwarning) { warning('Different bounding box') }

Modified: pkg/raster/R/copyRaster.R
===================================================================
--- pkg/raster/R/copyRaster.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/copyRaster.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -10,7 +10,7 @@
 	if (dataContent(raster) == 'all') {
 		raster <- setDatatype(raster, datatype)
 		filename(raster) <- filename
-		raster <- writeRaster(raster, filetype=filetype, overwrite=overwrite)
+		writeRaster(raster, filetype=filetype, overwrite=overwrite)
 		return(raster)
 	} 
 	
@@ -25,7 +25,7 @@
 	for (r in 1:nrow(newr)) {
 		raster <- readRow(raster, r)
 		newr <- setValues(newr, values(raster), r)
-		newr <- writeRaster(newr, filetype=filetype, overwrite=overwrite)
+		writeRaster(newr, filetype=filetype, overwrite=overwrite)
 	}
 	return(newr)
 }

Modified: pkg/raster/R/cover.R
===================================================================
--- pkg/raster/R/cover.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/cover.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -24,8 +24,8 @@
 		x at data@values[is.na(x at data@values)] <- values(y)[is.na(x at data@values)]
 		rm(y)
 		outRaster <- setValues(outRaster, values(x))
-		if (filename(outRaster) != "") { 
-			outraster <- writeRaster(outRaster, filetype=filetype, overwrite=overwrite) 
+		if (outRaster at file@name != "") { 
+			writeRaster(outRaster, filetype=filetype, overwrite=overwrite) 
 		}
 	} else {
 		if (dataContent(x) == 'nodata'  &  dataSource(x) == 'ram' ) {
@@ -37,7 +37,7 @@
 		
 		if (!canProcessInMemory(x, 4) && filename == '') {
 			filename <- tempfile()
-			outraster <- setFilename(outraster, filename )
+			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}
 		starttime <- proc.time()
@@ -52,13 +52,13 @@
 				v <- c(v, vals)
 			} else {
 				outRaster <- setValues(outRaster, vals, r)
-				outRaster <- writeRaster(outRaster, filetype=filetype, overwrite=overwrite)
+				writeRaster(outRaster, filetype=filetype, overwrite=overwrite)
 			}
 			
 			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 			
 		}
-		if (filename(outRaster) == "") {
+		if (outRaster at file@name == "") {
 			outRaster <- setValues(outRaster, v)
 		}
 	}

Modified: pkg/raster/R/crop.R
===================================================================
--- pkg/raster/R/crop.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/crop.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -13,7 +13,7 @@
 	bb <- intersectBbox(raster, bndbox)
 	bb <- alignBbox(bb, raster)
 	outraster <- raster(raster, filename)
-	outraster <- setExtent(outraster, bb, keepres=T)
+	outraster <- setExtent(outraster, bb, keepres=TRUE)
 	
 	if (dataContent(raster) == 'all')  {
 		first_start_cell <- cellFromXY(raster, c(xmin(outraster) + 0.5 * xres(raster), ymax(outraster) - 0.5 * yres(raster) ))	
@@ -23,8 +23,8 @@
 		selected_cells <- as.vector(mapply(seq, start_cells, end_cells))
 		outraster <- setValues(outraster, values(raster)[selected_cells])
 		outraster <- setMinMax(outraster)
-		if (filename(outraster) != "" ) { 
-			outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+		if (outraster at file@name != "") { 
+			writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 		}
 
 	} else if ( dataSource(raster) == 'disk') { 
@@ -37,17 +37,17 @@
 		v <- vector(length=0)
 		for (r in first_row:last_row) {
 			raster <- readPartOfRow( raster, r, first_col, ncol(outraster) )
-			if (filename(outraster) == '') {
+			if (outraster at file@name == "") {
 				v <- c(v, values(raster))
 			} else {
 				outraster <- setValues(outraster, values(raster), rownr)
-				outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+				writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 			}	
 			rownr <- rownr + 1
 
-			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
+			if (r %in% track) { .showTrack(rownr, outraster at nrows, track, starttime) }
 		} 
-		if (filename(outraster) == '') { 
+		if (outraster at file@name == '') { 
 			outraster <- setValues(outraster, v) 
 		}
 	}

Modified: pkg/raster/R/disaggregate.R
===================================================================
--- pkg/raster/R/disaggregate.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/disaggregate.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -30,8 +30,8 @@
 		rows <- rep(1:nrow(raster), each=ncol(raster)*xfact*yfact)
 		cells <- cellFromRowCol(raster, rows, cols)
 		outraster <- setValues(outraster, values(raster)[cells])
-		if (filename(outraster) != "") {
-			outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+		if (outraster at file@name != "") {
+			writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 		}
 		
 	} else if ( dataSource(raster) == 'disk') { 
@@ -43,15 +43,15 @@
 			raster <- readRow(raster, r)
 			for (i in 1:yfact) {
 			
-				if (filename(outraster) == '') {
+				if (outraster at file@name == "") {
 					v <- c(v, values(raster)[cols])
 				} else {
 					outraster <- setValues(outraster, values(raster)[cols], (r-1) * xfact + i)
-					outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
+					writeRaster(outraster, overwrite=overwrite, filetype=filetype)
 				}	
 			}	
 		}
-		if (filename(outraster) == '') { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 

Modified: pkg/raster/R/distance.R
===================================================================
--- pkg/raster/R/distance.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/distance.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -63,7 +63,7 @@
 				outRowValues <- rep(Inf,times=ncols)
 				outRowValues[is.na(rowValues)] <- 0
 				outRaster <- setValues(outRaster, outRowValues, r)
-				outRaster <- writeRaster(outRaster, overwrite=TRUE)				
+				writeRaster(outRaster, overwrite=TRUE)				
 			}
 			if(isLatLon(object)){
 				remainingCells <- TRUE
@@ -86,8 +86,10 @@
 						rowWindow[index] 
 						# startRow is undefined
 						# outRaster <- setValues(outRaster, rowValues, startRow)
-						outRaster <- writeRaster(outRaster, overwrite=TRUE)
-						if(r>1){rowWindow <- rowWindow[-1:ncols]}
+						writeRaster(outRaster, overwrite=TRUE)
+						if(r > 1){
+							rowWindow <- rowWindow[-1:ncols]
+						}
 					}
 				}
 			}
@@ -115,8 +117,10 @@
 						rowWindow[index] 
 						# startRow is undefined
 						#outRaster <- setValues(outRaster, rowValues, startRow)
-						outRaster <- writeRaster(outRaster, overwrite=TRUE)
-						if(r>1){rowWindow <- rowWindow[-1:ncols]}
+						writeRaster(outRaster, overwrite=TRUE)
+						if(r > 1){
+							rowWindow <- rowWindow[-1:ncols]
+						}
 					}
 				}
 			}

Modified: pkg/raster/R/drawPoly.R
===================================================================
--- pkg/raster/R/drawPoly.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/drawPoly.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -33,7 +33,7 @@
 
 
 polygonFromBbox <- function(bndbox, sp=TRUE) {
-	bb <- getBbox(bndbox)
+	bb <- extent(bndbox)
 	p <- rbind(c(bb at xmin, bb at ymin), c(bb at xmin, bb at ymax), c(bb at xmax, bb at ymax), c(bb at xmax, bb at ymin), c(bb at xmin, bb at ymin) )
 	if (sp) {
 		return( SpatialPolygons(list(Polygons(list(Polygon(p)), 1))) )

Modified: pkg/raster/R/expand.R
===================================================================
--- pkg/raster/R/expand.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/expand.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -10,7 +10,7 @@
 expand <- function(raster, bndbox, filename=NULL, filetype='raster', overwrite=FALSE, track=-1)  {
 	if (is.null(filename)) { filename <- "" }
 	
-	bndbox <- getBbox(bndbox)
+	bndbox <- extent(bndbox)
 	res <- resolution(raster)
 # snap points to pixel boundaries
 	xmn <- round(xmin(bndbox) / res[1]) * res[1]
@@ -26,7 +26,7 @@
 	
 	outraster <- raster(raster, filename)
 	bndbox <- newBbox(xmn, xmx, ymn, ymx)
-	outraster <- setExtent(outraster, bndbox, keepres=T)
+	outraster <- setExtent(outraster, bndbox, keepres=TRUE)
 
 	startrow <- rowFromY(outraster, ymax(raster))
 	startcol <- colFromX(outraster, xmin(raster))
@@ -40,13 +40,15 @@
 			startcell <- (r + startrow -2) * ncol(outraster) + startcol
 			d[startcell:(startcell+ncol(raster)-1)] <- vals
 			outraster <- setValues(outraster, d)
-			if (filename(outraster) != "") {writeRaster(outraster, filetype=filetype, overwrite=overwrite)}
+			if (outraster at file@name != "") {
+				writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+			}
 		}
 
 	} else if ( dataSource(raster) == 'disk' ) { 
 		if (!canProcessInMemory(outraster, 4) && filename == '') {
 			filename <- tempfile()
-			outraster <- setFilename(outraster, filename )
+			filename(outraster) <- filename
 			if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster))	}						
 		}
 		starttime <- proc.time()
@@ -61,7 +63,7 @@
 			startcell <- (r + startrow -2) * ncol(outraster) + startcol
 			d[startcell:(startcell+ncol(raster)-1)] <- vals
 
-			if (filename(outraster) != '') {
+			if (outraster at file@name != '') {
 				outraster <- setValues(outraster, d, r)
 				outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 			} else {
@@ -71,7 +73,7 @@
 			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 
 		}
-		if (filename(outraster) == '') { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 	} 

Modified: pkg/raster/R/getBbox.R
===================================================================
--- pkg/raster/R/getBbox.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/getBbox.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -23,20 +23,20 @@
 
 
 
-if (!isGeneric("getBbox")) {
-	setGeneric("getBbox", function(x)
-		standardGeneric("getBbox"))
+if (!isGeneric("extent")) {
+	setGeneric("extent", function(x)
+		standardGeneric("extent"))
 }	
 
-setMethod('getBbox', signature(x='BoundingBox'), 
+setMethod('extent', signature(x='BoundingBox'), 
 	function(x){ return(x) }
 )
 
-setMethod('getBbox', signature(x='BasicRaster'), 
+setMethod('extent', signature(x='BasicRaster'), 
 	function(x){ return(x at bbox) }
 )
 
-setMethod('getBbox', signature(x='Spatial'), 
+setMethod('extent', signature(x='Spatial'), 
 	function(x){ 
 		bndbox <- bbox(x)
 		bb <- new('BoundingBox')
@@ -48,7 +48,7 @@
 	}
 )
 
-setMethod('getBbox', signature(x='matrix'), 
+setMethod('extent', signature(x='matrix'), 
 	function(x){ 
 		if (min(dim(x)) < 2) {
 			stop('matrix should have dimensions of at least 2 by 2') }		
@@ -61,7 +61,7 @@
 	}
 )
 	
-setMethod('getBbox', signature(x='vector'), 
+setMethod('extent', signature(x='vector'), 
 	function(x){ 
 		if (length(x) < 4) {
 			stop('vector supplied is too short')

Modified: pkg/raster/R/inifile.R
===================================================================
--- pkg/raster/R/inifile.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/inifile.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -30,10 +30,10 @@
 
 	ini <- lapply(Lines, strsplitcomment) 
 	
-	Lines <- matrix(unlist(ini), ncol=2, byrow=T)[,1]
+	Lines <- matrix(unlist(ini), ncol=2, byrow=TRUE)[,1]
 	ini <- lapply(Lines, strSplitOnFirstToken) 
 	
- 	ini <- matrix(unlist(ini), ncol=2, byrow=T)
+ 	ini <- matrix(unlist(ini), ncol=2, byrow=TRUE)
 	ini <- subset(ini, ini[,1] != "")
 
 	sections <- c(which(is.na(ini[,2])), length(ini[,2]))

Modified: pkg/raster/R/init.R
===================================================================
--- pkg/raster/R/init.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/init.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -13,8 +13,8 @@
 	if ( dataContent(raster) == 'all' | dataSource(raster) == 'ram' ) {
 		n <- ncell(raster)
 		outraster <- setValues(outraster, fun(n)) 
-		if (filename(outraster) != "") {	
-			outraster <- writeRaster(outraster, overwrite=overwrite) 
+		if (outraster at file@name != "") {	
+			writeRaster(outraster, overwrite=overwrite) 
 		}
 		
 	} else if (dataSource(raster) == 'disk') {
@@ -24,17 +24,17 @@
 		v <- vector(length=0)
 
 		for (r in 1:nrow(raster)) {
-			if (filename(outraster) == "") {
+			if (outraster at file@name == "") {
 				v <- c(v, fun(n))
 			} else {			
 				outraster <- setValues(outraster, fun(n), r) 
-				outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+				writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 			}	
 			
 			if (r %in% track) { .showTrack(r, outraster at nrows, track, starttime) }
 			
 		}
-		if (filename(outraster) == "") { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 	} 

Modified: pkg/raster/R/linesToRaster.R
===================================================================
--- pkg/raster/R/linesToRaster.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/linesToRaster.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -195,7 +195,7 @@
 			v <- c(v, rv)
 		} else {
 			raster <- setValues(raster, values=rv, rownr=r)
-			raster <- writeRaster(raster, filetype=filetype)
+			writeRaster(raster, filetype=filetype)
 		}
 		
 		if (r %in% track) { .showTrack(r, raster at nrows, track, starttime) }

Modified: pkg/raster/R/map.R
===================================================================
--- pkg/raster/R/map.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/map.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -42,7 +42,7 @@
 			xmx <- xmax(object) - (ncol(object) - cols[length(cols)]) * xres(object)
 			ymn <- ymin(object) + (nrow(object) - rows[length(rows)]) * yres(object)
 			bndbox <- changeExtent(object, xmx=xmx, ymn=ymn)
-			object <- setExtent(sampraster, bndbox, keepres=F)
+			object <- setExtent(sampraster, bndbox, keepres=FALSE)
  		} else { 
 			m <- values(object, format='matrix')
 			subsample=FALSE

Modified: pkg/raster/R/neighborhood.R
===================================================================
--- pkg/raster/R/neighborhood.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/neighborhood.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -70,7 +70,7 @@
 			ngbvals <- .calc.ngb(ngbdata, ngb, fun, keepdata)
 			if (filename != "") {
 				ngbgrid <- setValues(ngbgrid, ngbvals, rr)
-				ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
+				writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
 			} else {
 				v <- c(v, ngbvals)
 			}
@@ -87,7 +87,7 @@
 		ngbvals <- .calc.ngb(ngbdata, ngb, fun, keepdata)
 		if (filename != "") {
 			ngbgrid <- setValues(ngbgrid, ngbvals, rr)
-			ngbgrid <- writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
+			writeRaster(ngbgrid, overwrite=overwrite, filetype=filetype)
 		} else {
 			v <- c(v, ngbvals)
 		}

Modified: pkg/raster/R/overlayList.R
===================================================================
--- pkg/raster/R/overlayList.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/overlayList.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -29,15 +29,15 @@
 		vals <- do.call(fun, vallist)
 		
 		outraster <- setValues(outraster, vals)
-		if (filename(outraster) != "") { 
-			outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype) 
+		if (outraster at file@name != "") { 
+			writeRaster(outraster, overwrite=overwrite, filetype=filetype) 
 		}
 		
 	} else {
-		if (filename(outraster) == "") {
+		if (outraster at file@name == "") {
 			if (!canProcessInMemory(outraster, 4)) {
 				filename <- tempfile()
-				outraster <- setFilename(outraster, filename )
+				filename(outraster) <- filename
 			} else {
 				v  <- vector(length=ncell(outraster))
 				startcells <- cellFromCol(outraster, 1)
@@ -61,18 +61,18 @@
 			}
 			vals <- do.call(fun, vallist)
 			
-			if (filename(outraster) == "") {
+			if (outraster at file@name == "") {
 #				v <- c(v, vals)
 				v[startcells[r]:endcells[r]] <- vals
 			} else {
 				outraster <- setValues(outraster, vals, r)
-				outraster <- writeRaster(outraster, filetype=filetype, overwrite=overwrite)
+				writeRaster(outraster, filetype=filetype, overwrite=overwrite)
 			}	
 			
 			if (r %in% track) { .showTrack(r, raster at nrows, track, starttime) }
 			
 		}
-		if (filename(outraster) == "") { 
+		if (outraster at file@name == "") { 
 			outraster <- setValues(outraster, v) 
 		}
 	} 

Modified: pkg/raster/R/pointsToRaster.R
===================================================================
--- pkg/raster/R/pointsToRaster.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/pointsToRaster.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -8,12 +8,7 @@
 pointsToRaster <- function(raster, xy, values=rep(1, length(xy[,1])), fun=length, background=NA, filename="", overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1) {
 # make this an argument ?  so that you can use e.g.  background=0 
 	
-	if (class(xy) != 'matrix') {
-		stop('xy must be a matrix')
-	}
-	if (length(values) != length(xy[,1])) {
-		stop('values must be a vector of length=length(xy[,1])')
-	}
+	xy <- .pointsToMatrix(xy)
 	
 	rs <- raster(raster, filename)
 	rs <- setDatatype(rs, datatype)
@@ -43,7 +38,7 @@
 		}
 		if (filename != "") {
 			rs <- setValues(rs, d, r)
-			rs <- writeRaster(rs, overwrite=overwrite, filetype=filetype) 
+			writeRaster(rs, overwrite=overwrite, filetype=filetype) 
 		} else {
 			v <- c(v, d)
 		}

Modified: pkg/raster/R/polygonToRaster.R
===================================================================
--- pkg/raster/R/polygonToRaster.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/polygonToRaster.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -205,7 +205,7 @@
 			v <- c(v, rv)
 		} else {
 			raster <- setValues(raster, values=rv, rownr=r)
-			raster <- writeRaster(raster, overwrite=overwrite, filetype=filetype)
+			writeRaster(raster, overwrite=overwrite, filetype=filetype)
 		}
 		
 		if (r %in% track) { .showTrack(r, raster at nrows, track, starttime) }
@@ -269,7 +269,7 @@
 			v <- c(v, vals)
 		} else {
 			raster <- setValues(raster, vals, r)
-			raster <- writeRaster(raster, overwrite=overwrite)
+			writeRaster(raster, overwrite=overwrite)
 		}
 	}
 	if (filename == "") {

Modified: pkg/raster/R/project.R
===================================================================
--- pkg/raster/R/project.R	2009-03-18 09:01:35 UTC (rev 369)
+++ pkg/raster/R/project.R	2009-03-19 01:13:48 UTC (rev 370)
@@ -8,7 +8,7 @@
 
 
 projectBbox <- function(object, projs) {
-	b <- getBbox(object)
+	b <- extent(object)
 	projs <- projection(projs)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/raster -r 370


More information about the Raster-commits mailing list