[GRASS-dev] [GRASS GIS] #518: negative flow accumulation with r.watershed SFD or MFD

#518: negative flow accumulation with r.watershed SFD or MFD
-------------------------+--------------------------------------------------
Reporter: dylan | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone:
Component: default | Version: svn-develbranch6
Keywords: r.watershed | Platform: Linux
      Cpu: x86-32 |
-------------------------+--------------------------------------------------
Hi,

I just noticed that there are negative flow accumulation numbers in the
output from the recently updated r.watershed. I am working with today's
SVN (develbranch_6). Here is an example from the spearfish dataset:

{{{
g.region rast=elevation.10m
r.watershed --o -f elevation=elevation.10m accumulation=acc
r.info acc

# SFD:
Range of data: min = -811721.000000 max = 735505.000000

# MFD:
Range of data: min = -641132.649622 max = 720490.193602
}}}

This looks like an overflow problem...but I cannot seem to find anything
obvious in the code.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/518&gt;
GRASS GIS <http://grass.osgeo.org>

#518: negative flow accumulation with r.watershed SFD or MFD
----------------------+-----------------------------------------------------
  Reporter: dylan | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone:
Component: default | Version: svn-develbranch6
Resolution: | Keywords: r.watershed
  Platform: Linux | Cpu: x86-32
----------------------+-----------------------------------------------------
Comment (by dylan):

Hmm.. It looks like this is not an overflow, rather some areas are
randomly getting their sign flipped. ABS(flow_acc) results in a map that
*looks* correct.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/518#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#518: negative flow accumulation with r.watershed SFD or MFD
--------------------------+-------------------------------------------------
  Reporter: dylan | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone:
Component: default | Version: svn-develbranch6
Resolution: | Keywords: r.watershed
  Platform: Linux | Cpu: x86-32
--------------------------+-------------------------------------------------
Changes (by dylan):

  * type: defect => enhancement

Comment:

Maybe I overlooked the documentation. This is a feature, perhaps a flag as
Michael suggests would be useful.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/518#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#518: negative flow accumulation with r.watershed SFD or MFD
--------------------------+-------------------------------------------------
  Reporter: dylan | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone:
Component: default | Version: svn-develbranch6
Resolution: | Keywords: r.watershed
  Platform: Linux | Cpu: x86-32
--------------------------+-------------------------------------------------
Comment (by mmetz):

IMHO, there is still some cleaning up to do for r.watershed. I left some
things in it for backwards compatibility. One such thing is the "visual"
output which I regard as obsolete because "accumulation" output now comes
with a (better I hope) colortable by default.
The "visual" output could be removed and another output option be added,
e.g. called "absacc" that gives absolute accumulation values. That would
however break backwards compatibility, a new flag would not.

There is a good reason *not* to add this option/flag, nicely illustrated
by Dylan creating this ticket. The purpose of negative accumulation values
is to make people wonder what on earth is going here, then figure out that
not the whole catchment area under study was included and expand the
computational region accordingly to get proper results: only positive
accumulation values for the catchment under study.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/518#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

On Fri, Mar 6, 2009 at 12:18 AM, GRASS GIS <trac@osgeo.org> wrote:

#518: negative flow accumulation with r.watershed SFD or MFD
--------------------------+-------------------------------------------------
Reporter: dylan | Owner: grass-dev@lists.osgeo.org
Type: enhancement | Status: new
Priority: major | Milestone:
Component: default | Version: svn-develbranch6
Resolution: | Keywords: r.watershed
Platform: Linux | Cpu: x86-32
--------------------------+-------------------------------------------------
Comment (by mmetz):

IMHO, there is still some cleaning up to do for r.watershed. I left some
things in it for backwards compatibility. One such thing is the "visual"
output which I regard as obsolete because "accumulation" output now comes
with a (better I hope) colortable by default.
The "visual" output could be removed and another output option be added,
e.g. called "absacc" that gives absolute accumulation values. That would
however break backwards compatibility, a new flag would not.

There is a good reason *not* to add this option/flag, nicely illustrated
by Dylan creating this ticket. The purpose of negative accumulation values
is to make people wonder what on earth is going here, then figure out that
not the whole catchment area under study was included and expand the
computational region accordingly to get proper results: only positive
accumulation values for the catchment under study.

I like your approach Markus, but I think that we should test this out
a bit more-- as I was seeing negative values in areas that honestly
should be part of the region in question. I will check on my data, and
post back with some examples. It could be that my elevation model has
some subtle problems.

I will address this in another ticket, but for the record I have seen
some odd contour-like artifacts in the flow accumulation raster-- but
only after resetting the color map using the '-a' flag to r.colors.

PS: the speed improvements in r.watershed are awsome. Thanks for all
the hard work!

Dylan

#518: negative flow accumulation with r.watershed SFD or MFD
--------------------------+-------------------------------------------------
  Reporter: dylan | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone:
Component: Raster | Version: svn-develbranch6
Resolution: | Keywords: r.watershed
  Platform: All | Cpu: x86-32
--------------------------+-------------------------------------------------
Changes (by mmetz):

  * platform: Linux => All
  * component: default => Raster

Comment:

added -a flag to make all flow accumulation values positive in trunk
r36273 and devbr6 r36274

What about the RUSLE factors? IMHO, they should be set to NULL when flow
accumulation could not be properly calculated (negative flow accumulation
values).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/518#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#518: negative flow accumulation with r.watershed SFD or MFD
--------------------------+-------------------------------------------------
  Reporter: dylan | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: closed
  Priority: major | Milestone:
Component: Raster | Version: svn-develbranch6
Resolution: fixed | Keywords: r.watershed
  Platform: All | Cpu: x86-32
--------------------------+-------------------------------------------------
Changes (by mmetz):

  * status: new => closed
  * resolution: => fixed

Comment:

The new -a flag should have fixed it, closing ticket.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/518#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>