Skip to content

Commit

Permalink
r.accumulate: Wrap code; Add format figures (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
HuidaeCho committed May 13, 2020
1 parent 32a82a8 commit ff2b0f9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions grass7/raster/r.accumulate/r.accumulate.html
Expand Up @@ -22,17 +22,9 @@ <h3>Flow accumulation</h3>
be useful in this specific case.

<p>The module recognizes two different formats of the flow direction map:
<div class="code"><pre>
Direction encoding for neighbors of x

135 90 45 3 2 1
180 x 360 4 x 8
225 270 315 5 6 7

degrees 45 degrees
CCW from East CCW from East
(r.watershed drainage)
</pre></div>
<div align="center">
<img src="r_accumulate_formats.png" alt="degree">
</div>

<p>Since the module does not use elevation data (i.e., slope), flow
accumulation is calculated by single flow direction (SFD) routing and may not
Expand Down Expand Up @@ -129,14 +121,15 @@ <h3>Stream network delineation</h3>
r.watershed elevation=elevation accumulation=flow_accum drainage=drain_directions -s -a

# use r.accumulate to create flow_accum_new and streams_new at once
r.accumulate direction=drain_directions accumulation=flow_accum_new threshold=50000 stream=streams_new
r.accumulate direction=drain_directions accumulation=flow_accum_new threshold=50000 \
stream=streams_new

# or delineate stream networks only without creating an accumulation map
r.accumulate direction=drain_directions threshold=50000 stream=streams_new_only

# use r.stream.extract, elevation, and flow_accum_new to delineate stream networks
r.stream.extract elevation=elevation accumulation=flow_accum threshold=50000 stream_vector=streams_extract \
direction=drain_directions_extract
# use r.stream.extract, elevation, and flow_accum to delineate stream networks
r.stream.extract elevation=elevation accumulation=flow_accum threshold=50000 \
stream_vector=streams_extract direction=drain_directions_extract
</pre></div>

<img src="r_accumulate_nc_stream_example.png">
Expand Down Expand Up @@ -174,7 +167,9 @@ <h3>Longest flow path calculation</h3>

<img src="r_accumulate_nc_lfp_example_single.png">

<p>Note that there can be more than one longest flow path when multiple paths have the same flow length. In fact, the above example produces two lines with the same length.
<p>Note that there can be more than one longest flow path when multiple paths
have the same flow length. In fact, the above example produces two lines with
the same length.

<p><img src="r_accumulate_nc_lfp_example_single_warning.png">

Expand All @@ -196,12 +191,15 @@ <h3>Longest flow path calculation</h3>
# calculate longest flow paths at all points in the outlets map
r.accumulate direction=drain_directions lfp=lfp_at_outlets outlet=outlets

# calculate longest flow paths at all points in the outlets map and assign IDs using a column in this map
# calculate longest flow paths at all points in the outlets map and assign IDs using a column \
# in this map
r.accumulate direction=drain_directions lfp=lfp_at_outlets_w_id outlet=outlets \
id_column=lfp_id outlet_id_column=outlet_id

# calculate longest flow paths at given coordinates and all points in the outlets map and assign IDs
r.accumulate direction=drain_directions lfp=lfp_multi_w_id coordinates=642455,222614,642314,222734 \
# calculate longest flow paths at given coordinates and all points in the outlets map and \
# assign IDs
r.accumulate direction=drain_directions lfp=lfp_multi_w_id \
coordinates=642455,222614,642314,222734 \
outlet=outlets id=1,2 id_column=lfp_id outlet_id_column=outlet_id
</pre></div>

Expand Down Expand Up @@ -241,7 +239,8 @@ <h3>Longest flow path calculation</h3>

# delineate subwatersheds
i=1
for coor in `v.report -c map=stream_outlets layer=2 option=coor | awk -F'|' '{printf "%s,%s\n", $4, $5}'`; do
coors=`v.report -c map=stream_outlets layer=2 option=coor | awk -F'|' '{printf "%s,%s\n", $4, $5}'`
for coor in $coors; do
r.water.outlet --o input=drain_directions output=tmp coordinates=$coor
r.mapcalc expression="subwatershed_$i=if(isnull(tmp),0,1&lt;&lt;($i-1))"
i=`expr $i + 1`
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff2b0f9

Please sign in to comment.