[GRASS-user] Is it possible to have two values for a raster. like say value1 , value2.

Pankaj Kr Sharma pkscwc at gmail.com
Tue Dec 13 00:48:07 EST 2011

Dear Grass users and developers,

The observation highlighted in blue reminded me to post this question on
the list.

*" Subject: Re: [GRASS-user] How to find the second largest value in a
series of   rasters.
Sylvain Maillard wrote:

The problem can be solved by running "r.series method=max_raster", **
then filtering each input map, setting a cell to null if the input
map has the largest value for that particular cell, then running
"r.series method=max" on the filtered maps.

But that's very inefficient compared to implementing a **
"second-largest" aggregate directly." *

This question is in my mind as I am trying to work on scale of sub-basin
(300 sq km) with a 90m SRTM DEM on a region having 42000*42000 rows by
The addon module r.stream.basins (using arrays) for GRASS7 is really a
master-stroke.It reports basin area for each individual category in one map.
But getting cumulative basin area on each point becomes so hardware
intensive and time intensive that it's beyond any practical use.
Please note that I have 2tb harddisk and 16gb ram with six processor.
Maximum that I could arrange.
For one tenth of the area mentioned above, computer ran for one week
uninterrupted to generate the raster.
 i. r.stream.basin for each point ,
ii.  then r.stat for area,
iii. then db.select for updating the database of vector (vector of basins
generated from r.to.vect type=area, then cleaning for zero area)
The vector table generated thus requires intervention and visual comparison

After that, approximately 90gb space was consumed. As a rough estimate,
whole exercise might have taken months and all my hard disk space.

If, we can add two values to a raster (value1, value2) ( individual basin
area, cumulative basin area), the work would have finished in twenty
minutes instead of one week.
(Note: This is my assumption only based on the performance of
r.stream.basins grass7 version for individual basin area.)

Really, the r.stream.basins (Grass 7 version) is amazing.

Meanwhile , I have assembled a way to find this area using vectors only.
Which is described below:
The basin area results obtained from r.stream.basins have to be converted
to vector.
Then, it should be cleaned to maintain conformity with the raster.
Then, using v.net.allpairs ( Its a really great module. Great piece of
work.Thanks to developers. Thanks to Dear Daniel Bundala) , individual area
lying above a point can be added and cumulative area can be uploaded to

It still takes time, but I can finish the work within given time and
available hardware.

By the way, I have troubles with v.label module. I want to show both the
individual basin area and cumulative basin area on the map.
But, it's not working. (No <> map error.)
Help please.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20111213/09a9af01/attachment-0001.html

More information about the grass-user mailing list