[GRASS-SVN] r59170 - in grass/trunk/raster/r.li: r.li.dominance r.li.pielou r.li.renyi r.li.richness r.li.shannon r.li.simpson

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 2 14:35:35 PST 2014


Author: mmetz
Date: 2014-03-02 14:35:34 -0800 (Sun, 02 Mar 2014)
New Revision: 59170

Modified:
   grass/trunk/raster/r.li/r.li.dominance/dominance.c
   grass/trunk/raster/r.li/r.li.dominance/r.li.dominance.html
   grass/trunk/raster/r.li/r.li.pielou/pielou.c
   grass/trunk/raster/r.li/r.li.pielou/r.li.pielou.html
   grass/trunk/raster/r.li/r.li.renyi/r.li.renyi.html
   grass/trunk/raster/r.li/r.li.renyi/renyi.c
   grass/trunk/raster/r.li/r.li.richness/r.li.richness.html
   grass/trunk/raster/r.li/r.li.richness/richness.c
   grass/trunk/raster/r.li/r.li.shannon/r.li.shannon.html
   grass/trunk/raster/r.li/r.li.shannon/shannon.c
   grass/trunk/raster/r.li/r.li.simpson/r.li.simpson.html
   grass/trunk/raster/r.li/r.li.simpson/simpson.c
Log:
r.li: sync diversity indices

Modified: grass/trunk/raster/r.li/r.li.dominance/dominance.c
===================================================================
--- grass/trunk/raster/r.li/r.li.dominance/dominance.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.dominance/dominance.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -159,6 +159,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -345,6 +346,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -531,6 +533,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 

Modified: grass/trunk/raster/r.li/r.li.dominance/r.li.dominance.html
===================================================================
--- grass/trunk/raster/r.li/r.li.dominance/r.li.dominance.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.dominance/r.li.dominance.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -6,8 +6,8 @@
 <ul>
 <li><b>i</b>: patch type</li>
 <li><b>m</b>: number of different patch types</li>
-<li><b>p<small><small>i</small></small></b>: proportion of the landscape
-  occupied by patch type <i>i</i> </li>
+<li><b>p<small><small>i</small></small></b>: proportional abundance of 
+patch type <i>i</i> </li>
 </ul>
 
 <h2>NOTES</h2>
@@ -19,7 +19,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then 
-<em>r.li.dominance</em> returns NULL.<br>
+<em>r.li.dominance</em> returns NULL.
 
 <h2>EXAMPLES</h2>
 To calculate the dominance diversity index on map <em>my_map</em>, using

Modified: grass/trunk/raster/r.li/r.li.pielou/pielou.c
===================================================================
--- grass/trunk/raster/r.li/r.li.pielou/pielou.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.pielou/pielou.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -159,6 +159,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -345,6 +346,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -531,6 +533,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 

Modified: grass/trunk/raster/r.li/r.li.pielou/r.li.pielou.html
===================================================================
--- grass/trunk/raster/r.li/r.li.pielou/r.li.pielou.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.pielou/r.li.pielou.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -18,12 +18,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster contains NULL value cells, <em>r.li.pielou</em>
-returns -1 for these cells. <br>
-If you want to change these -1 values to NULL, run subsequently on the resulting map:
-<div class="code"><pre>
-r.null setnull=-1 input=my_map
-</pre></div>
-after index calculation.
+returns NULL for these cells.
 
 <h2>EXAMPLES</h2>
 To calculate Pielou's diversity index on map <em>my_map</em>, using

Modified: grass/trunk/raster/r.li/r.li.renyi/r.li.renyi.html
===================================================================
--- grass/trunk/raster/r.li/r.li.renyi/r.li.renyi.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.renyi/r.li.renyi.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -6,9 +6,10 @@
 <ul>
   <li><b>H</b>: Renyi entropy</li>
   <li><b>alpha</b>: order of the generalized entropy</li>
-  <li><b>i</b>: ith class</li>
-  <li><b>S</b>: number of classes</li>
-  <li><b>p<small>i</small></b>: proportion of the landscape occupied by class i</li>
+  <li><b>i</b>: patch type</li>
+  <li><b>S</b>: number of different patch types</li>
+  <li><b>p<small><small>i</small></small></b>: proportional abundance of 
+patch type <i>i</i> </li>
 </ul>
 
 <h2>NOTES</h2>
@@ -20,12 +21,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.renyi</em>
-returns -1.<br>
-If you want to change these -1 values to NULL, run subsequently on the resulting map:
-<div class="code"><pre>
-r.null setnull=-1 input=my_map
-</pre></div>
-after index calculation.
+returns NULL.
 
 <h2>EXAMPLES</h2>
 To calculate Renyi's diversity index on map <em>my_map</em>, using

Modified: grass/trunk/raster/r.li/r.li.renyi/renyi.c
===================================================================
--- grass/trunk/raster/r.li/r.li.renyi/renyi.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.renyi/renyi.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -183,6 +183,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -383,6 +384,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -583,6 +585,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 

Modified: grass/trunk/raster/r.li/r.li.richness/r.li.richness.html
===================================================================
--- grass/trunk/raster/r.li/r.li.richness/r.li.richness.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.richness/r.li.richness.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -19,7 +19,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.richness</em>
-returns NULL.<br>
+returns 0.<br>
 
 
 <h2>EXAMPLES</h2>

Modified: grass/trunk/raster/r.li/r.li.richness/richness.c
===================================================================
--- grass/trunk/raster/r.li/r.li.richness/richness.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.richness/richness.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -107,6 +107,7 @@
     int ris = 0;
     int masked = FALSE;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     generic_cell uc;
 
@@ -141,6 +142,10 @@
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_c_null_value(&corrCell, 1);
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
@@ -222,7 +227,7 @@
 	}
     }
 
-    if (m)
+    if (area)
 	*result = m;
     else
 	Rast_set_d_null_value(result, 1);
@@ -248,6 +253,7 @@
     int ris = 0;
     int masked = FALSE;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     generic_cell uc;
 
@@ -282,6 +288,10 @@
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_d_null_value(&corrCell, 1);
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
@@ -363,7 +373,7 @@
 	}
     }
 
-    if (m)
+    if (area)
 	*result = m;
     else
 	Rast_set_d_null_value(result, 1);
@@ -389,6 +399,7 @@
     int ris = 0;
     int masked = FALSE;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     generic_cell uc;
 
@@ -424,6 +435,10 @@
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_f_null_value(&corrCell, 1);
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
@@ -506,7 +521,7 @@
 	}
     }
 
-    if (m)
+    if (area)
 	*result = m;
     else
 	Rast_set_d_null_value(result, 1);

Modified: grass/trunk/raster/r.li/r.li.shannon/r.li.shannon.html
===================================================================
--- grass/trunk/raster/r.li/r.li.shannon/r.li.shannon.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.shannon/r.li.shannon.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -5,9 +5,9 @@
 with:
 <ul>
 <li><b>i</b>: patch type</li>
-<li><b>m</b>: number of patch types</li>
-<li><b>p<small><small>i</small></small></b>: proportion of the landscape
-  occupied by patch type <i>i</i> </li>
+<li><b>m</b>: number of different patch types</li>
+<li><b>p<small><small>i</small></small></b>: proportional abundance of 
+patch type <i>i</i> </li>
 </ul>
 
 <h2>NOTES</h2>
@@ -19,13 +19,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.shannon</em>
-returns -1.<br>
-<!-- does that mean the program exit code or raster values?? -->
-If you want to change these -1 values to NULL, run subsequently on the resulting map:
-<div class="code"><pre>
-r.null setnull=-1 input=my_map
-</pre></div>
-after index calculation.
+returns NULL.
 
 <h2>EXAMPLES</h2>
 To calculate Shannon's diversity index on map <em>my_map</em>, using

Modified: grass/trunk/raster/r.li/r.li.shannon/shannon.c
===================================================================
--- grass/trunk/raster/r.li/r.li.shannon/shannon.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.shannon/shannon.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -159,6 +159,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -345,6 +346,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -531,6 +533,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 

Modified: grass/trunk/raster/r.li/r.li.simpson/r.li.simpson.html
===================================================================
--- grass/trunk/raster/r.li/r.li.simpson/r.li.simpson.html	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.simpson/r.li.simpson.html	2014-03-02 22:35:34 UTC (rev 59170)
@@ -5,9 +5,9 @@
 with:
 <ul>
 <li><b>i</b>: patch type</li>
-<li><b>m</b>: number of patch types</li>
-<li><b>p<small><small>i</small></small></b>: proportion of the landscape
-  occupied by patch type <i>i</i> </li>
+<li><b>m</b>: number of different patch types</li>
+<li><b>p<small><small>i</small></small></b>: proportional abundance of 
+patch type <i>i</i> </li>
 </ul>
 
 <h2>NOTES</h2>
@@ -19,12 +19,7 @@
 <p>
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.simpson</em>
-returns -1.<br>
-If you want to change these -1 values to NULL, run subsequently on the resulting map:
-<div class="code"><pre>
-r.null setnull=-1 input=my_map
-</pre></div>
-after index calculation.
+returns NULL.
 
 <h2>EXAMPLES</h2>
 To calculate Simpson's diversity index on map <em>my_map</em>, using

Modified: grass/trunk/raster/r.li/r.li.simpson/simpson.c
===================================================================
--- grass/trunk/raster/r.li/r.li.simpson/simpson.c	2014-03-02 22:34:11 UTC (rev 59169)
+++ grass/trunk/raster/r.li/r.li.simpson/simpson.c	2014-03-02 22:35:34 UTC (rev 59170)
@@ -159,6 +159,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -344,6 +345,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 
@@ -529,6 +531,7 @@
 	    }
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 	    }
 



More information about the grass-commit mailing list