[GRASS-user] convert starspan output to a table

maning sambale emmanuel.sambale at gmail.com
Fri Feb 9 10:46:15 EST 2007


Hi,

Using GRASS and starspan, a vector is used to count pixel classes of a
binary raster, I get the following data.  Now I want to make a table
showing pixel count for each cass (Class 0 & 1) of each FID into one
row.  Note that some FID do not contain two classes (see FID 7).  In
short I need to combine two rows if they have the same FID and leave
others when it only has 1 class.  I believe  awk and python can easily
do the job, but my awk skills is pretty much rudimentary.  Can anybody
help?

FID,class,count
0,0,5
1,0,17672
1,1,223
2,0,14709
2,1,282
3,0,63725
3,1,271
4,0,14707
4,1,5
5,0,34512
5,1,15
6,0,29651
7,0,33995
8,0,24
8,1,4
9,0,3179
9,1,17
10,0,2327
....
1571,0,3388
1572,0,7706
-- 

Cheers,

Maning
|---------|----------------------------------------------------------|
| __.-._  |"Ohhh. Great warrior. Wars not make one great." -Yoda     |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
|  /'.-c  |Linux registered user #402901, http://counter.li.org/     |
|  |  /T  |http://esambale.wikispaces.com|
| _)_/LI  |http://www.geocities.com/esambale/philbiodivmap/philbirds.html   |
|---------|----------------------------------------------------------|




More information about the grass-user mailing list