[GRASS-dev] Re: [GRASS-SVN] r41653 - grass/trunk/raster/r.drain

Markus Metz markus.metz.giswork at googlemail.com
Sat May 22 04:28:26 EDT 2010


Markus Neteler wrote:
> Hi,
>
> is below a backport candidate?

AFAICT, this applies only to devbr and trunk, and it's in there already.

I do not understand the change in main.c because ...
>
>> Modified: grass/trunk/raster/r.drain/main.c
>> ===================================================================
>> --- grass/trunk/raster/r.drain/main.c   2010-04-01 21:28:05 UTC (rev 41652)
>> +++ grass/trunk/raster/r.drain/main.c   2010-04-01 22:14:53 UTC (rev 41653)
>> @@ -642,7 +642,7 @@
>>      * read next. This is repeated via a while loop until a null direction is found.
>>      */
>>
>> -    int neighbour, next_row, next_col, go = 1;
>> +    int neighbour, row, col, next_row, next_col, go = 1;

the two new variables row, col are not used, see compiler warning.
A NULL value test is missing, direction can be NULL when coming from
r.cost/r.walk.

I would suggest to update r.drain for trunk:

- replace sites API with vector API

- use r.watershed-like A* Search to determine drainage directions if
no direction map is given: no need to remove one cell pits, drainage
path does not end in large pit but continues until true outlet is
reached. See NOTES:
"It currently finds pits in the data, rather than the lowest point in
the entire input map. The r.fill.dir, r.terraflow, and r.basins.fill
modules can be used to fill in subbasins prior to processing with
r.drain."
Applies only to elevation as input, not cost surface + direction map as input

- use segment library, is faster than the current custom method of
storing input maps in temp files (would reduce file IO by factor 4000+
for cost + direction input).

my 2c,

Markus M


>>     DCELL direction;
>>     DCELL *dir_buf;
>>
>>
>> Modified: grass/trunk/raster/r.drain/r.drain.html
>> ===================================================================
>> --- grass/trunk/raster/r.drain/r.drain.html     2010-04-01 21:28:05 UTC (rev 41652)
>> +++ grass/trunk/raster/r.drain/r.drain.html     2010-04-01 22:14:53 UTC (rev 41653)
>> @@ -162,8 +162,8 @@
>>  according to one of the <b>-can</b> flags.
>>  <div class="code"><pre>
>>  The directions are recorded as GRASS standard directions:
>> -       112.5 90  67.5         i.e. a cell with the value 135
>> -157.5  135   0   45   22.5    means the cell <b>before</b> it is
>> +       112.5     67.5         i.e. a cell with the value 135
>> +157.5  135   90  45   22.5    means the cell <b>before</b> it is
>>        180   x   0            to the south-east.
>>  202.5  225  270  315  337.5
>>        247.5     292.5
>>
>> _______________________________________________
>> grass-commit mailing list
>> grass-commit at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-commit
>>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>


More information about the grass-dev mailing list