[Raster-commits] r325 - in pkg/raster: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Mar 7 16:49:30 CET 2009
Author: rhijmans
Date: 2009-03-07 16:49:30 +0100 (Sat, 07 Mar 2009)
New Revision: 325
Added:
pkg/raster/man/xyValues.Rd
Removed:
pkg/raster/man/xyValues-methods.Rd
Modified:
pkg/raster/R/Merge.R
pkg/raster/man/cellValues.Rd
pkg/raster/man/draw.Rd
pkg/raster/man/init.Rd
pkg/raster/man/merge.Rd
pkg/raster/man/neighborhood.Rd
pkg/raster/man/utils.Rd
Log:
Modified: pkg/raster/R/Merge.R
===================================================================
--- pkg/raster/R/Merge.R 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/R/Merge.R 2009-03-07 15:49:30 UTC (rev 325)
@@ -47,6 +47,16 @@
}
v <- vector(length=0)
+
+ if (!.CanProcessInMemory(x, 2) && filename == '') {
+ filename <- tempfile()
+ outraster <- setFilename(outraster, filename )
+ if (options('verbose')[[1]]) { cat('writing raster to:', filename(raster)) }
+ }
+ starttime <- proc.time()
+
+
+
for (r in 1:nrow(outraster)) {
rd <- as.vector(matrix(NA, nrow=1, ncol=ncol(outraster)))
for (i in length(rasters):1) { #reverse order so that the first raster covers the second etc.
@@ -66,12 +76,21 @@
rd[d[,1]] <- d[,2]
}
}
+
if (filename(outraster) != '') {
outraster <- setValues(outraster, rd, r)
outraster <- writeRaster(outraster, overwrite=overwrite, filetype=filetype)
} else {
v <- c(v, rd)
}
+
+ 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/man/cellValues.Rd
===================================================================
--- pkg/raster/man/cellValues.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/cellValues.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -6,16 +6,21 @@
\alias{cellValues,RasterStack,vector-method}
\title{ values for cells }
+
\description{
- These methods return values of a RasterLayer or RasterStack for specified cells )
+These methods return values of a RasterLayer or RasterStack for specified cells )
}
+
+\usage{cellValues(x, cells)}
+
+\arguments{
+ \item{x}{RasterLayer or RasterStack object}
+ \item{cells}{vector of cell numbers, cell numbers should be between 1 and ncells(x)}
+}
+
\section{Methods}{
\describe{
-\code{cellValues(x, cells)}
-
-\item{code{x}}{RasterLayer or RasterStack object}
-\item{code{cells}}{vector of cell numbers, cell numbers should be between 1 and ncells(x)}
-
+ ---
}}
@@ -23,7 +28,7 @@
a vector of cell values for a RasterLayer or or a matrix of values for a RasterStack
}
-\seealso{ \code{\link[raster]{xyValues}}, \code{\link[raster]{readRow}}, \code{\link[raster]{readAll}} }
+\seealso{ \code{\link[raster]{xyValues}}, \code{\link[raster]{read}} }
\author{Robert J. Hijmans }
Modified: pkg/raster/man/draw.Rd
===================================================================
--- pkg/raster/man/draw.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/draw.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -1,11 +1,13 @@
\name{draw}
+
\alias{drawPoly}
\alias{drawLine}
\title{ Draw a line or polygon on a map }
\description{
- Draw a line or polygon on a map and save it for later use
+Draw a line or polygon on a map and save it for later use
}
+
\usage{
drawPoly(sp=TRUE, col='red')
drawLine(sp=TRUE, col='red')
@@ -14,7 +16,7 @@
\arguments{
\item{sp}{logical. If \code{TRUE}, the output will be a sp object (SpatialPolygons or SpatialLines). Otherwise a matrix of coordinates is returned}
\item{col}{the color of the lines to be drawn}
- }
+}
\value{
If \code{sp==TRUE} a sp object (SpatialPolygons or SpatialLines)
Modified: pkg/raster/man/init.Rd
===================================================================
--- pkg/raster/man/init.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/init.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -2,10 +2,12 @@
\alias{init}
-\title{Intitialize values of a RasterLayer}
+\title{Intitialize}
+
\description{
- Set values for a new raster (from scratch)
+Set values for a new raster (from scratch)
}
+
\usage{
init(raster, fun=runif, filename="", overwrite=FALSE, datatype='FLT4S', filetype='raster', track=-1)
}
@@ -28,8 +30,9 @@
}
\value{
-A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
+A new RasterLayer object, and, in some cases, the side effect of a new file on disk.
}
+
\author{Robert J. Hijmans}
\examples{
Modified: pkg/raster/man/merge.Rd
===================================================================
--- pkg/raster/man/merge.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/merge.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -1,38 +1,58 @@
\name{merge}
\docType{methods}
+
\alias{merge}
\alias{merge,RasterLayer,RasterLayer-method}
+
\title{
Merge RasterLayers
-
}
\description{
Merge RasterLayers to form a new RasterLayer with a larger spatial extent
+}
-This is a method for the generic function in Package `base'
+\usage{
+merge(x, y, ...)
+}
+\arguments{
+ \item{x}{A RasterLayer object}
+ \item{y}{A RasterLayer object}
+ \item{...}{Additional RasterLayers and other arguments. See below, under Methods}
}
+
\section{Methods}{
\describe{
-\code{merge(x, y, ..., tolerance=0.05, filename="", overwrite=FALSE) }
+A full call to the merge method is:
+\code{merge(x, y, ..., tolerance=0.05, filename="", overwrite=FALSE, filetype='raster', track=-1 ) }
+
\item{x,y}{"RasterLayer"}{
- \item{...}{additional RasterLayer objects}
- \item{tolerance}{difference permissable (relative to the cell resolution) for objects to be 'equal'. See ?all.equal}
- \item{filename}{output filename for a new raster}
- \item{overwrite}{if \code{TRUE}, the file will be overwritten if it exists}
-}} }
+ \item{\code{x}}{A RasterLayer object}
+ \item{\code{y}}{A RasterLayer object}
+ \item{\code{...}}{additional RasterLayer objects}
+ \item{\code{tolerance}}{difference permissable (relative to the cell resolution) for objects to be 'equal'. See ?all.equal}
+ \item{\code{filename}}{character. output filename}
+ \item{\code{overwrite}}{logical. If \code{TRUE}, "filename" will be overwritten if it exists}
+ \item{\code{filetype}}{character. output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{rasterFormats}}}
+ \item{\code{datatype}}{character. output data type; see \code{\link[raster]{setDatatype}}}
+ \item{\code{track}}{vector of row numbers for which the function will report that they have been processed}
+}
+
+}}
\details{
-The RasterLayer objects must have the same origin and resolution. In areas where the RasterLayers overlap, the values of the RasterLayer that is first in the sequence will be retained.
+The RasterLayer objects must have the same origin and resolution.
+In areas where the RasterLayers overlap, the values of the RasterLayer that is first in the sequence of arguments will be retained.
}
\value{
-A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
+A new RasterLayer object, and in some cases, the side effect of a new file on disk.
}
+
\author{Robert J. Hijmans}
\seealso{ \code{\link[raster]{crop}}, \code{\link[raster]{expand}}}
Modified: pkg/raster/man/neighborhood.Rd
===================================================================
--- pkg/raster/man/neighborhood.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/neighborhood.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -3,9 +3,11 @@
\alias{neighborhood}
\title{RasterLayer calculate}
+
\description{
Neighborhood calculations
}
+
\usage{
neighborhood(raster, fun=mean, filename="", ngb=3, keepdata=TRUE, overwrite=FALSE, filetype='raster', datatype='FLT4S', track=-1)
}
@@ -26,10 +28,12 @@
\code{neighborhood} computes a neighborhood value. I.e. a value computed with function 'fun', for all cells in the square neigborhood (of size ngb * ngb) around each cell
If the input RasterLayer object has all values in memory (e.g. after readAll(raster)), the function will also return the new values in memory. If a filename is provided, the values will also be saved to that file.
If the values are not in memory the new values will be written to file.
- }
+}
+
\value{
A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
}
+
\author{Robert J. Hijmans}
\examples{
@@ -40,3 +44,4 @@
}
\keyword{spatial}
+
Modified: pkg/raster/man/utils.Rd
===================================================================
--- pkg/raster/man/utils.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/utils.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -1,11 +1,11 @@
\name{utilities}
\alias{roundCoords}
\alias{newCRS}
+
+\title{helper functions }
-
-\title{ Utility functions }
\description{
- roundCoords rounds the coordinates to a number of digits specified.
+ roundCoords rounds the coordinates of the BoundingBox of a Raster* to a number of digits specified.
newCRS is a helper function to create a CRS map projection object.
}
Deleted: pkg/raster/man/xyValues-methods.Rd
===================================================================
--- pkg/raster/man/xyValues-methods.Rd 2009-03-07 15:19:36 UTC (rev 324)
+++ pkg/raster/man/xyValues-methods.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -1,54 +0,0 @@
-\name{xyValues}
-\docType{methods}
-
-\alias{xyValues}
-\alias{xyValues,RasterLayer,matrix-method}
-\alias{xyValues,RasterStack,matrix-method}
-\alias{xyValues,RasterLayer,SpatialPoints-method}
-\alias{xyValues,RasterStack,SpatialPoints-method}
-
-\alias{bilinearValue}
-\alias{bilinearValue,RasterLayer,matrix-method}
-
-
-\title{ values at xy coordinates }
-
-\description{
- These methods return values of a RasterLayer or RasterStack for the cells that correspond to the provided xy coordinates (n*2 matrix or SpatialPoints object)
-}
-
-\usage{xyValues(raster, xyCoords)}
-
-\arguments{
-\item{raster}{RasterLayer or RasterStack object}
-\item{xyCoords}{xy coordinates (see below, under Methods}
-}
-
-\section{Methods}{
-\describe{
-\code{xyCoords} can be a \code{n*2} matrix or dataframe with the first column having the x values, and the second column has the y values.
-It can also be a SpatialPoints* object.
-
-
-}
-}
-
-
-\value{
-a vector of cell values for a RasterLayer or or a matrix of values for a RasterStack
-}
-
-\seealso{ \code{\link[raster]{cellValues}}, \code{\link[raster]{readRow}}, \code{\link[raster]{readAll}}, \code{\link[sp]{SpatialPoints}} }
-
-\author{Robert J. Hijmans }
-
-\examples{
-#using a new default raster (1 degree global)
-r <- raster()
-r[] <- 1:ncell(r)
-xy <- cbind(0:36 * 10 - 180, 90)
-xyValues(r, xy)
-}
-
-\keyword{methods}
-\keyword{spatial}
Added: pkg/raster/man/xyValues.Rd
===================================================================
--- pkg/raster/man/xyValues.Rd (rev 0)
+++ pkg/raster/man/xyValues.Rd 2009-03-07 15:49:30 UTC (rev 325)
@@ -0,0 +1,57 @@
+\name{xyValues}
+\docType{methods}
+
+\alias{xyValues}
+\alias{xyValues,RasterLayer,matrix-method}
+\alias{xyValues,RasterStack,matrix-method}
+\alias{xyValues,RasterLayer,SpatialPoints-method}
+\alias{xyValues,RasterStack,SpatialPoints-method}
+
+\alias{bilinearValue}
+\alias{bilinearValue,RasterLayer,matrix-method}
+
+
+\title{ values at xy coordinates }
+
+\description{
+ These methods return values of a RasterLayer or RasterStack for the cells that correspond to the provided xy coordinates (n*2 matrix or SpatialPoints object)
+}
+
+\usage{
+xyValues(raster, xyCoords)
+bilinearValue(raster, xyCoords)
+}
+
+\arguments{
+\item{raster}{RasterLayer or RasterStack object}
+\item{xyCoords}{xy coordinates (see below, under Methods}
+}
+
+\section{Methods}{
+\describe{
+\code{xyCoords} can be a \code{n*2} matrix or dataframe with the first column having the x values, and the second column has the y values.
+It can also be a SpatialPoints* object.
+
+
+}
+}
+
+
+\value{
+a vector of cell values for a RasterLayer or or a matrix of values for a RasterStack
+}
+
+\seealso{ \code{\link[raster]{cellValues}}, \code{\link[raster]{readRow}}, \code{\link[raster]{readAll}}, \code{\link[sp]{SpatialPoints}} }
+
+\author{Robert J. Hijmans }
+
+\examples{
+#using a new default raster (1 degree global)
+r <- raster()
+r[] <- 1:ncell(r)
+xy <- cbind(0:36 * 10 - 180, 90)
+xyValues(r, xy)
+}
+
+\keyword{methods}
+\keyword{spatial}
More information about the Raster-commits
mailing list