[GRASS-SVN] r68731 - grass-addons/grass7/raster/r.forestfrag
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 22 10:50:08 PDT 2016
Author: wenzeslaus
Date: 2016-06-22 10:50:08 -0700 (Wed, 22 Jun 2016)
New Revision: 68731
Added:
grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_11.png
grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_7.png
Modified:
grass-addons/grass7/raster/r.forestfrag/r.forestfrag.html
grass-addons/grass7/raster/r.forestfrag/r.forestfrag.py
Log:
r.forestfrag: add img and example to doc, improve user visible strings (wiki:MessageStandardization)
Modified: grass-addons/grass7/raster/r.forestfrag/r.forestfrag.html
===================================================================
--- grass-addons/grass7/raster/r.forestfrag/r.forestfrag.html 2016-06-22 17:09:53 UTC (rev 68730)
+++ grass-addons/grass7/raster/r.forestfrag/r.forestfrag.html 2016-06-22 17:50:08 UTC (rev 68731)
@@ -1,7 +1,7 @@
<h2>DESCRIPTION</h2>
<em>r.forestfrag</em> Computes the forest fragmentation following
-the methodology proposed by Riitters et. al (2000). See
+the methodology proposed by Riitters et al. (2000). See
<a href="http://www.consecol.org/vol4/iss2/art3/">this article</a> for a
detailed explanation.
@@ -18,7 +18,7 @@
type. If one wants to exclude the influence of a specific land cover
type, e.g., water bodies, it should be classified as no-data (NA) in
the input map. See e.g.,
-<a href="https://pvanb.wordpress.com/2016/03/25/update-of-r-forestfrag-addon/"> blog post</a>.
+<a href="https://pvanb.wordpress.com/2016/03/25/update-of-r-forestfrag-addon/">blog post</a>.
<p>Let <em>Pf</em> be the proportion of pixels in the window that
are forested. Define <em>Pff</em> (strictly) as the proportion of
@@ -30,10 +30,10 @@
<div class="code"><pre>
interior: Pf = 1.0
-patch: Pf < 0.4
-transitional: 0.4 ≤ Pf < 0.6
-edge: Pf ≥ 0.6 and Pf - Pff < 0
-perforated: Pf ≥ 0.6 and Pf - Pff > 0
+patch: Pf < 0.4
+transitional: 0.4 ≤ Pf < 0.6
+edge: Pf ≥ 0.6 and Pf - Pff < 0
+perforated: Pf ≥ 0.6 and Pf - Pff > 0
undetermined: Pf ≥ 0.6 and Pf = Pff
</pre></div>
@@ -52,24 +52,66 @@
to set the region to match the input layer.
</ul>
+
+<h2>EXAMPLE</h2>
+
+In the North Carolina sample Location, set the computational region
+to match the land classification raster map:
+
+<div class="code"><pre>
+g.region raster=landclass96
+</pre></div>
+
+Then mark all cells which are forest as 1 and everything else as zero:
+
+<div class="code"><pre>
+r.mapcalc "forest = if(landclass96 == 5, 1, 0)"
+</pre></div>
+
+Use the new forest presence raster map to compute the forest
+fragmentation index with window size 7:
+
+<div class="code"><pre>
+r.forestfrag input=forest output=fragmentation window=7
+</pre></div>
+
+<center>
+<img src="r_forestfrag_window_7.png" alt="r.forestfrag output with window size 7">
+<img src="r_forestfrag_window_11.png" alt="r.forestfrag output with window size 11">
+<p><em>
+Two forest fragmentation indices with window size 7 (left) and
+11 (right) show how increasing window size increases the amount of
+edges.
+</em></p>
+</center>
+
+
<h2>SEE ALSO</h2>
+
+<em>
+<a href="r.mapcalc.html">r.mapcalc</a>,
+<a href="r.li.html">r.li</a>
+</em>
+
+<p>
The addon is based on the
-<a href="http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.forestfrag>">
+<a href="https://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.forestfrag">
r.forestfrag.sh</a> script, with as extra options user-defined
moving window size, option to trim the region (by default it
respects the region) and a better handling of no-data cells.
+
<h2>AUTHORS</h2>
-<em>Paulo van Breugel<em>: Rewritten in Python, added option to set
-moving window size, and improved handling no-data cells
+<em>Paulo van Breugel</em>: Rewritten in Python, added option to set
+moving window size, and improved handling no-data cells<br>
<em>Stefan Sylla</em>: Revised / updated the r.forestfrag.sh for
GRASS GIS 6<br>
-<em>Emmanuel Sambale</em>: Author original shell script<br>
+<em>Emmanuel Sambale</em>: Author original shell script
<h2>REFERENCES</h2>
Riitters, K., J. Wickham, R. O'Neill, B. Jones,
and E. Smith. 2000. Global-scale patterns of forest fragmentation.
Conservation Ecology 4(2): 3. [online] URL:
-http://www.consecol.org/vol4/iss2/art3/
+<a href="http://www.consecol.org/vol4/iss2/art3/">http://www.consecol.org/vol4/iss2/art3/</a>
<p><i>Last changed: $Date$</i>
Modified: grass-addons/grass7/raster/r.forestfrag/r.forestfrag.py
===================================================================
--- grass-addons/grass7/raster/r.forestfrag/r.forestfrag.py 2016-06-22 17:09:53 UTC (rev 68730)
+++ grass-addons/grass7/raster/r.forestfrag/r.forestfrag.py 2016-06-22 17:50:08 UTC (rev 68731)
@@ -24,27 +24,20 @@
#############################################################################
#%Module
-#% description: Computes the forest fragmentation index (Riitters et. al 2000).
+#% description: Computes the forest fragmentation index (Riitters et al. 2000)
#% keyword: raster
#% keyword: forest
#% keyword: fragmentation index
+#% keyword: landscape structure analysis
#% keyword: Riitters
#%End
-#%Option
-#% key: input
-#% type: string
-#% gisprompt: old,cell,raster
+#%option G_OPT_R_INPUT
#% description: Name of forest raster map (where forest=1, non-forest=0)
#% required : yes
#%End
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: Name output layer
-#% key_desc: name
+#%option G_OPT_R_OUTPUT
#% required: yes
#%end
@@ -59,12 +52,12 @@
#%flag
#% key: r
-#% description: Set region to raster?
+#% description: Set computational region to input raster map
#%end
#%flag
#% key: t
-#% description: keep pf and pff maps
+#% description: Keep Pf and Pff maps
#%END
#%flag
@@ -74,7 +67,7 @@
#%flag
#% key: a
-#% description: trim the output map to avoid border effects?
+#% description: Trim the output map to avoid border effects
#%END
@@ -138,7 +131,7 @@
opl = options['output']
wz = int(options['window'])
if wz % 2 == 0:
- grass.fatal("Please provide an odd number for the moving window)")
+ grass.fatal("Please provide an odd number for the moving window")
flag_r = flags['r']
flag_t = flags['t']
flag_s = flags['s']
@@ -147,7 +140,7 @@
#set to current input map region (user option, default=current region)
if flag_r:
- grass.message("setting region to input map ...")
+ grass.message("Setting region to input map...")
grass.run_command('g.region', quiet=True, raster=ipl)
# Check if map values are limited to 1 and 0
@@ -163,7 +156,7 @@
#------------------------------------------------------------------------
# computing pf values
#------------------------------------------------------------------------
- grass.info("step 1: computing pf values ...\n")
+ grass.info("Step 1: Computing Pf values...")
# let forested pixels be x and number of all pixels in moving window
# be y, then pf=x/y"
@@ -190,7 +183,7 @@
## one forested pixel, and y of those pairs are forest-forest pairs, so pff equals
## y/x"
- grass.info("step 2: computing pff values ...\n")
+ grass.info("Step 2: Computing Pff values...")
# Create copy of forest map and convert NULL to 0 (if any)
tmpC4 = tmpname('tmpA04_')
@@ -269,7 +262,7 @@
# computing fragmentation index
#------------------------------------------------------------------------
- grass.info("step 3: computing fragmentation index ...\n")
+ grass.info("Step 3: Computing fragmentation index...")
pf2 = tmpname('tmpA08_')
grass.mapcalc("$pf2 = $pf - $pff", pf2=pf2, pf=pf, pff=pff, quiet=True)
f1 = tmpname('tmpA09_') # patch
Added: grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_11.png
===================================================================
(Binary files differ)
Property changes on: grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_11.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_7.png
===================================================================
(Binary files differ)
Property changes on: grass-addons/grass7/raster/r.forestfrag/r_forestfrag_window_7.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
More information about the grass-commit
mailing list