[Raster-commits] r349 - in pkg/raster: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Mar 13 10:06:46 CET 2009
Author: rhijmans
Date: 2009-03-13 10:06:46 +0100 (Fri, 13 Mar 2009)
New Revision: 349
Modified:
pkg/raster/R/stackRead.R
pkg/raster/R/xyValues.R
pkg/raster/man/plot-methods.Rd
Log:
Modified: pkg/raster/R/stackRead.R
===================================================================
--- pkg/raster/R/stackRead.R 2009-03-13 07:26:43 UTC (rev 348)
+++ pkg/raster/R/stackRead.R 2009-03-13 09:06:46 UTC (rev 349)
@@ -28,30 +28,7 @@
-.stackReadXY <- function(object, xyCoords, method='simple') {
- if (method == 'bilinear') {
- for (i in seq(nlayers(object))) {
- v <- .bilinearValue(object, xyCoords)
- if (i == 1) {
- result <- v
- } else {
- result <- cbind(result, v)
- }
- }
- if (!(is.null(dim(result)))) {
- colnames(result) <- object at data@colnames
- }
- return(result)
-
- } else {
- cells <- cellFromXY(object, xyCoords)
- return(.stackReadCells(object, cells))
- }
-
-}
-
-
.stackReadCells <- function(object, cells) {
for (i in seq(nlayers(object))) {
v <- .rasterReadCells(object at layers[[i]], cells)
@@ -68,3 +45,4 @@
return(result)
}
+
Modified: pkg/raster/R/xyValues.R
===================================================================
--- pkg/raster/R/xyValues.R 2009-03-13 07:26:43 UTC (rev 348)
+++ pkg/raster/R/xyValues.R 2009-03-13 09:06:46 UTC (rev 349)
@@ -31,7 +31,26 @@
if (dim(xyCoords)[2] != 2) {
stop('xyCoords has wrong dimensions; there should be 2 columns only' )
}
- return(.stackReadXT(object, cells, method))
+
+
+ if (method == 'bilinear') {
+ for (i in seq(nlayers(object))) {
+ v <- .bilinearValue(object, xyCoords)
+ if (i == 1) {
+ result <- v
+ } else {
+ result <- cbind(result, v)
+ }
+ }
+ if (!(is.null(dim(result)))) {
+ colnames(result) <- object at data@colnames
+ }
+ return(result)
+
+ } else {
+ cells <- cellFromXY(object, xyCoords)
+ return(.stackReadCells(object, cells))
+ }
}
)
Modified: pkg/raster/man/plot-methods.Rd
===================================================================
--- pkg/raster/man/plot-methods.Rd 2009-03-13 07:26:43 UTC (rev 348)
+++ pkg/raster/man/plot-methods.Rd 2009-03-13 09:06:46 UTC (rev 349)
@@ -10,6 +10,7 @@
\alias{plot,Raster,numeric-method}
\alias{plot,RasterLayer,RasterLayer-method}
\alias{hist,Raster-method}
+\alias{hist,RasterStack-method}
\title{Methods for Function plot in Package `raster'}
More information about the Raster-commits
mailing list