[Raster-commits] r115 - in pkg/raster: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 11 16:33:21 CET 2009
Author: rhijmans
Date: 2009-01-11 16:33:21 +0100 (Sun, 11 Jan 2009)
New Revision: 115
Modified:
pkg/raster/R/conversion.R
pkg/raster/R/map.R
pkg/raster/R/properties.R
pkg/raster/R/set.R
pkg/raster/man/create.stack.Rd
pkg/raster/man/generic.read.Rd
pkg/raster/man/map.Rd
pkg/raster/man/properties.Rd
pkg/raster/man/set.Rd
Log:
Modified: pkg/raster/R/conversion.R
===================================================================
--- pkg/raster/R/conversion.R 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/R/conversion.R 2009-01-11 15:33:21 UTC (rev 115)
@@ -28,7 +28,7 @@
if (dataContent(object) == 'all') {
dindex <- max(1, min(nlayers(object), dataindex))
if (dindex != dataindex) { warning(paste("dataindex was changed to", dindex))}
- rs <- setValues(rs, values(object, format='matrix')[,dindex])
+ rs <- setValues(rs, as.matrix(values(object))[,dindex])
}
return(rs)
} else { # assuming an SP raster
Modified: pkg/raster/R/map.R
===================================================================
--- pkg/raster/R/map.R 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/R/map.R 2009-01-11 15:33:21 UTC (rev 115)
@@ -16,7 +16,7 @@
index <- round(index)
i <- min(max(1, index), nlayers(object))
if (i != index) { stop("index should be >= 1 and <=", nlayers(object), " =nlayers(stack)") }
- raster2 <- object at rasters[[i]]
+ raster2 <- asRasterLayer(object, i)
if (dataContent(object) == 'all') {
raster2 <- setValues(raster2, values(object)[i,])
}
Modified: pkg/raster/R/properties.R
===================================================================
--- pkg/raster/R/properties.R 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/R/properties.R 2009-01-11 15:33:21 UTC (rev 115)
@@ -67,7 +67,7 @@
} else if (class(object) == "RasterStack") {
l <- vector('character')
for (i in 1:nlayers(object)) {
- l <- c(l, filename(object at rasters[[i]]))
+ l <- c(l, filename(asRasterLayer(object, i)))
}
return(l)
}
Modified: pkg/raster/R/set.R
===================================================================
--- pkg/raster/R/set.R 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/R/set.R 2009-01-11 15:33:21 UTC (rev 115)
@@ -17,17 +17,17 @@
return(raster)
}
-setRaster <- function(raster, filename="", values=NA) {
- if (class(raster) == 'RasterStack') { raster <- raster at rasters[[1]] }
- if (class(raster) == 'RasterBrick') { raster <- raster }
- if (class(raster) != 'RasterLayer') { stop('the first argument should be a RasterLayer or a RasterStack object') }
+setRaster <- function(object, filename="", values=NA) {
+ if (class(object) == 'RasterStack') { object <- asRasterLayer(object, 1) }
+ if (class(object) == 'RasterBrick') { object <- asRasterLayer(object, 1) }
+ if (class(object) != 'RasterLayer') { stop('the first argument should be a RasterLayer or a RasterStack object') }
filename <- trim(filename)
- if (filename != "" & filename == filename(raster)) {
+ if (filename != "" & filename == filename(object)) {
stop("it is not allowed to set the filename of the output RasterLayer to that of the input RasterLayer")
}
- raster <- clearValues(raster)
+ raster <- clearValues(object)
raster at data@min <- NA
raster at data@max <- NA
Modified: pkg/raster/man/create.stack.Rd
===================================================================
--- pkg/raster/man/create.stack.Rd 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/man/create.stack.Rd 2009-01-11 15:33:21 UTC (rev 115)
@@ -29,7 +29,7 @@
\item{rasterfiles}{ Filename(s) of (a) raster dataset(s) }
\item{bands}{ A vector or list of bands of raster data files (default values = 1)}
\item{rasters}{ RasterLayer object(s) }
- \item{indices}{ the indices (in stack at rasters) of the raster(s) to remove from a stack }
+ \item{indices}{ the indices of the raster(s) to remove from a stack }
}
\details{
When a stack is saved to a file, only pointers (filenames) to raster datasets are saved, not the data. If the name or location of a raster file changes, the stack becomes invalid.
Modified: pkg/raster/man/generic.read.Rd
===================================================================
--- pkg/raster/man/generic.read.Rd 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/man/generic.read.Rd 2009-01-11 15:33:21 UTC (rev 115)
@@ -18,8 +18,8 @@
\alias{readRows,RasterLayer-method}
\title{Read values from disk }
-\description{ Read values from a raster type file associated with a RasterLayer, RasterStack or RasterBrick object into memory.
-You can either read all the data (memory permitting), or read data by row, part of row, block, by cellnumber, or for (x,y) coordinates. Data can be read from 'native raster' binary files, as well as for other formats that are supported by GDAL.
+\description{ Read values from a raster file associated with a RasterLayer, RasterStack or RasterBrick object into memory.
+You can either read all the data (memory permitting), or read data by row, part of row, block, by cellnumber, or for (x,y) coordinates. Data can be read from 'native raster' binary files, as well as for other formats that are supported by the rgdal package.
}
@@ -36,11 +36,11 @@
\arguments{
\item{object}{ a Raster* object }
\item{raster}{ a RasterLayer object }
- \item{rownr}{ the row number of the row to read (between 1 and raster at nrows) }
- \item{startrow}{ the frist row to read (>= 1 & <= raster at nrows) }
- \item{nrows}{ the number of the rows to read (>= 1 & <= raster at nrows) }
- \item{startcol}{ first column of the block ( (>= 1 & <= raster at ncols) }
- \item{ncolumns}{ number of columns to read on this each row ( (>= 1 & <= raster at ncols & > firstcol) }
+ \item{rownr}{ the row number of the row to read (between 1 and nrows(raster)) }
+ \item{startrow}{ the frist row to read (>= 1 & <= nrows(raster)) }
+ \item{nrows}{ the number of the rows to read (>= 1 & <= nrows(raster)) }
+ \item{startcol}{ first column of the block ( (>= 1 & <= nrows(raster)) }
+ \item{ncolumns}{ number of columns to read on this each row ( (>= 1 & <= ncols(raster) & > firstcol) }
\item{maxdim}{ sets the density for regular sampling }
\item{bndbox}{ sets a bouding box within the raster, for regular sampling within that box }
\item{asRaster}{ Logical. If \code{TRUE}, a rasterLayer is returned, rather then the sampled values}
Modified: pkg/raster/man/map.Rd
===================================================================
--- pkg/raster/man/map.Rd 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/man/map.Rd 2009-01-11 15:33:21 UTC (rev 115)
@@ -16,7 +16,7 @@
\arguments{
\item{object}{ RasterLayer object}
- \item{index}{ Ignored for RasterLayers. The index of a raster in a RasterStack 1 <= index <= rstack at nrasters }
+ \item{index}{ Ignored for RasterLayers. The index of a raster in a RasterStack 1 <= index <= nlayers(rstack) }
\item{col} {a color palette, i.e. a vector of n contiguous colors such as \code{rainbow}, \code{heat.colors}, and \code{topo.colors}, on one or your own making}
\item{subsample}{Logical. If \code{TRUE}, the image is resampled using maxdim}
\item{maxdim}{ maximum requsted number of pixels in the map display (either vertial or horizontal) }
Modified: pkg/raster/man/properties.Rd
===================================================================
--- pkg/raster/man/properties.Rd 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/man/properties.Rd 2009-01-11 15:33:21 UTC (rev 115)
@@ -49,8 +49,8 @@
\arguments{
\item{object}{ Raster* object }
\item{x}{ Raster* object }
- \item{asText} { logical. If \code{TRUE}, the projection is returned as text. Otherwise a CRS object is returned}
- }
+ \item{asText} {logical. If \code{TRUE}, the projection is returned as text. Otherwise a CRS object is returned }
+}
\note{
Modified: pkg/raster/man/set.Rd
===================================================================
--- pkg/raster/man/set.Rd 2009-01-11 14:26:44 UTC (rev 114)
+++ pkg/raster/man/set.Rd 2009-01-11 15:33:21 UTC (rev 115)
@@ -22,7 +22,7 @@
setProjection(object, projstring)
setFilename(object, filename)
clearValues(object)
-setRaster(raster, filename="", values=NA)
+setRaster(object, filename="", values=NA)
setDatatype(raster, datatype, datasize)
setRowCol(raster, nrows=nrow(raster), ncols=ncol(raster))
setMinmax(raster)
More information about the Raster-commits
mailing list