[GRASS-stats] SpatialGridDataFrame simple selection problem
Chris Carleton
w_chris_carleton at hotmail.com
Thu Nov 11 11:57:28 EST 2010
Hi List,
I've imported a SpatialGridDataFrame (SGDF) from GRASS with spgrass, and now
I'm trying to select only those entries with a certain value in a column.
What is the appropriate syntax for selecting cells in a grid that have
particular values? Here's what I have:
----------
> summary(modelRast)
Object of class SpatialGridDataFrame
Coordinates:
min max
x 174812.5 382055.5
y 1798172.6 1942292.8
Is projected: TRUE
proj4string :
[+proj=utm +zone=16 +a=6378137 +rf=298.257223563 +no_defs
+towgs84=0.000,0.000,0.000 +to_meter=1.0]
Number of points: 2
Grid attributes:
cellcentre.offset cellsize cells.dim
x 174820 15.00021 13816
y 1798180 15.00002 9608
Data attributes:
Value 1 NA's
1534000 131210128
----------
So, the SGDF obviously 'knows' which cells are NA and which are 1, but how
do I select cells on the basis of a column value?
Also, is there a way to write values into a column in the SGDF without
having to create a new df object and then combine them? For example, how do
I:
---pseudo code---
for cell in sgdf {
thing = calculate_something(cell)
write2grid(cell, thing)
}
------------------------
I haven't been able to work this out on my own or find any examples of this
type of selection online (been searching a while... ) though I might be
looking in the wrong places. Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-stats/attachments/20101111/5cb3bb2b/attachment.html
More information about the grass-stats
mailing list