Opened 13 years ago

Closed 13 years ago

#518 closed enhancement (fixed)

negative flow accumulation with r.watershed SFD or MFD

Reported by: dylan Owned by: grass-dev@…
Priority: major Milestone:
Component: Raster Version: svn-develbranch6
Keywords: r.watershed Cc:
CPU: x86-32 Platform: All



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 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.

Change History (5)

comment:1 Changed 13 years ago 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.

comment:2 Changed 13 years ago by dylan

Type: defectenhancement

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

comment:3 Changed 13 years ago 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.

comment:4 Changed 13 years ago by mmetz

Component: defaultRaster
Platform: LinuxAll

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).

comment:5 Changed 13 years ago by mmetz

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.