[GRASS-dev] [GRASS GIS] #3756: r.watershed: flow accumulation wrong with edge contamination

GRASS GIS trac at osgeo.org
Wed Feb 20 14:13:24 PST 2019


#3756: r.watershed: flow accumulation wrong with edge contamination
-------------------------+-------------------------------------------------
  Reporter:  itati01     |      Owner:  grass-dev@…
      Type:  defect      |     Status:  new
  Priority:  normal      |  Milestone:
 Component:  Raster      |    Version:  svn-releasebranch76
Resolution:              |   Keywords:  r.watershed, flow accumulation,
       CPU:              |  edge contamination
  Unspecified            |   Platform:  Unspecified
-------------------------+-------------------------------------------------

Comment (by mmetz):

 Replying to [comment:2 itati01]:
 > Dear Markus,
 >
 > Thank you for your comment.
 >
 > I understand the problem with nodata cells in flow accumulation and
 would normally drop edge-contaminated cells. However, this is an
 exceptional use case, with nodata cells within the catchment.

 The same rule applies here too: any cell bordering a nodata cell does not
 distribute flow because it can not be determined where flow should be
 distributed to.

 > So, I used the flag -a hoping to obtain the number of upslope cells.

 The -a flag simply converts negative flow accumulation (receiving an
 unknown amount of flow) to positive flow accumulation.

 > I would like to ignore the nodata cells, and can actually do so because
 they form a channel (which I burned into the DEM to avoid artifical inflow
 from outside the watershed). So, there should really be no flow out of
 these nodata cells.

 This is correct, there will be no flow out of nodata cells. But there is
 an unknown amount of flow from nodata cells.

 > According to your explanation, my flow accumulation of -/+1 for cells 2
 and 6 within the rectangle in Figure 2 must be wrong. Cell 6, i.e. the 3rd
 cell in the 2nd row, only receives input from the 2 cells in row 3 which
 were correctly - as neighbors of nodata cells - set to -1. So, the weight
 of cell 6 should also be -1 (only flow from cells with nodata as neighbor)
 and the flow accumulation should be -/+3 - what I hoped to obtain.

 The other cells that might contribute to cell 6 are cells 8 and 9, both
 are edge-contaminated, thus cells 8 and 9 can not distribute flow, and
 thus flow accumulation of cell 6 is -1.

 > However, even with "regular" inflow, it would be nice to have an option
 to ignore edge contamination (feature request?).

 This would cause flow accumulation to follow edge-contaminated cells which
 is wrong. This could be easily demonstrated be setting the current region
 to a small subregion, calculate flow accumulation, then enlarge the
 region, calculate flow accumulation again, and compare the two results for
 flow accumulation. The result for the subregion would be obviously wrong.

 > Just assume, we have 4 upslope cells, of which 2 are edge contaminated.
 So, currently, we would get a flow accumulation of 1, not 5?

 No, if the other 2 upslope cells are not edge-contaminated, we would get a
 flow accumulation of 3 because the not edge-contaminated cells are allowed
 to distribute flow, also towards edge-contaminated cells.

 Regarding edge-contaminated cells, flow accumulation and flow direction
 are treated differently. Edge-contaminated cells can not distribute flow
 because this can cause flow to incorrectly follow edge-contaminated cells.
 Flow direction for edge-contaminated cells is set to another not-nodata
 cell if possible: the other cell is downstream, i.e. has a lower elevation
 value. The reason is that edge-contaminated cells most likely belong to
 the same catchment like a neighboring lower lying cell. Otherwise all
 edge-contaminated cells that do not receive flow accumulation from not
 edge-contaminated cells would form isolated single-cell catchments.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3756#comment:3>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list