浏览代码

r.li: sync diversity indices

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59170 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 11 年之前
父节点
当前提交
0305670975

+ 3 - 0
raster/r.li/r.li.dominance/dominance.c

@@ -159,6 +159,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -345,6 +346,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -531,6 +533,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 

+ 3 - 3
raster/r.li/r.li.dominance/r.li.dominance.html

@@ -6,8 +6,8 @@ with:
 <ul>
 <ul>
 <li><b>i</b>: patch type</li>
 <li><b>i</b>: patch type</li>
 <li><b>m</b>: number of different patch types</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>
 </ul>
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
@@ -19,7 +19,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then 
 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>
 <h2>EXAMPLES</h2>
 To calculate the dominance diversity index on map <em>my_map</em>, using
 To calculate the dominance diversity index on map <em>my_map</em>, using

+ 3 - 0
raster/r.li/r.li.pielou/pielou.c

@@ -159,6 +159,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -345,6 +346,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -531,6 +533,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 

+ 1 - 6
raster/r.li/r.li.pielou/r.li.pielou.html

@@ -18,12 +18,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster contains NULL value cells, <em>r.li.pielou</em>
 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>
 <h2>EXAMPLES</h2>
 To calculate Pielou's diversity index on map <em>my_map</em>, using
 To calculate Pielou's diversity index on map <em>my_map</em>, using

+ 5 - 9
raster/r.li/r.li.renyi/r.li.renyi.html

@@ -6,9 +6,10 @@ with:
 <ul>
 <ul>
   <li><b>H</b>: Renyi entropy</li>
   <li><b>H</b>: Renyi entropy</li>
   <li><b>alpha</b>: order of the generalized 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>
 </ul>
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
@@ -20,12 +21,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.renyi</em>
 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>
 <h2>EXAMPLES</h2>
 To calculate Renyi's diversity index on map <em>my_map</em>, using
 To calculate Renyi's diversity index on map <em>my_map</em>, using

+ 3 - 0
raster/r.li/r.li.renyi/renyi.c

@@ -183,6 +183,7 @@ int calculate(int fd, struct area_entry *ad, char **par, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -383,6 +384,7 @@ int calculateD(int fd, struct area_entry *ad, char **par, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -583,6 +585,7 @@ int calculateF(int fd, struct area_entry *ad, char **par, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 

+ 1 - 1
raster/r.li/r.li.richness/r.li.richness.html

@@ -19,7 +19,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.richness</em>
 If the input raster map contains only NULL values then <em>r.li.richness</em>
-returns NULL.<br>
+returns 0.<br>
 
 
 
 
 <h2>EXAMPLES</h2>
 <h2>EXAMPLES</h2>

+ 18 - 3
raster/r.li/r.li.richness/richness.c

@@ -107,6 +107,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
     int ris = 0;
     int ris = 0;
     int masked = FALSE;
     int masked = FALSE;
     long m = 0;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     avl_tree albero = NULL;
     generic_cell uc;
     generic_cell uc;
 
 
@@ -141,6 +142,10 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	    if ((masked) && (mask_buf[i] == 0)) {
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_c_null_value(&corrCell, 1);
 		Rast_set_c_null_value(&corrCell, 1);
 	    }
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
 		 corrCell != precCell) {
@@ -222,7 +227,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	}
 	}
     }
     }
 
 
-    if (m)
+    if (area)
 	*result = m;
 	*result = m;
     else
     else
 	Rast_set_d_null_value(result, 1);
 	Rast_set_d_null_value(result, 1);
@@ -248,6 +253,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
     int ris = 0;
     int ris = 0;
     int masked = FALSE;
     int masked = FALSE;
     long m = 0;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     avl_tree albero = NULL;
     generic_cell uc;
     generic_cell uc;
 
 
@@ -282,6 +288,10 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	    if ((masked) && (mask_buf[i] == 0)) {
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_d_null_value(&corrCell, 1);
 		Rast_set_d_null_value(&corrCell, 1);
 	    }
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
 		 corrCell != precCell) {
@@ -363,7 +373,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	}
 	}
     }
     }
 
 
-    if (m)
+    if (area)
 	*result = m;
 	*result = m;
     else
     else
 	Rast_set_d_null_value(result, 1);
 	Rast_set_d_null_value(result, 1);
@@ -389,6 +399,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
     int ris = 0;
     int ris = 0;
     int masked = FALSE;
     int masked = FALSE;
     long m = 0;
     long m = 0;
+    long area = 0;
     avl_tree albero = NULL;
     avl_tree albero = NULL;
     generic_cell uc;
     generic_cell uc;
 
 
@@ -424,6 +435,10 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	    if ((masked) && (mask_buf[i] == 0)) {
 	    if ((masked) && (mask_buf[i] == 0)) {
 		Rast_set_f_null_value(&corrCell, 1);
 		Rast_set_f_null_value(&corrCell, 1);
 	    }
 	    }
+	    else {
+		/* total sample area */
+		area++;
+	    }
 
 
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 	    if (!(Rast_is_null_value(&precCell, uc.t)) &&
 		 corrCell != precCell) {
 		 corrCell != precCell) {
@@ -506,7 +521,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	}
 	}
     }
     }
 
 
-    if (m)
+    if (area)
 	*result = m;
 	*result = m;
     else
     else
 	Rast_set_d_null_value(result, 1);
 	Rast_set_d_null_value(result, 1);

+ 4 - 10
raster/r.li/r.li.shannon/r.li.shannon.html

@@ -5,9 +5,9 @@
 with:
 with:
 <ul>
 <ul>
 <li><b>i</b>: patch type</li>
 <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>
 </ul>
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
@@ -19,13 +19,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.shannon</em>
 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>
 <h2>EXAMPLES</h2>
 To calculate Shannon's diversity index on map <em>my_map</em>, using
 To calculate Shannon's diversity index on map <em>my_map</em>, using

+ 3 - 0
raster/r.li/r.li.shannon/shannon.c

@@ -159,6 +159,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -345,6 +346,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -531,6 +533,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 

+ 4 - 9
raster/r.li/r.li.simpson/r.li.simpson.html

@@ -5,9 +5,9 @@
 with:
 with:
 <ul>
 <ul>
 <li><b>i</b>: patch type</li>
 <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>
 </ul>
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
@@ -19,12 +19,7 @@ the <tt>$HOME/.grass7/r.li/output/</tt> folder.
 <p>
 <p>
 <!-- TODO: verify next: -->
 <!-- TODO: verify next: -->
 If the input raster map contains only NULL values then <em>r.li.simpson</em>
 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>
 <h2>EXAMPLES</h2>
 To calculate Simpson's diversity index on map <em>my_map</em>, using
 To calculate Simpson's diversity index on map <em>my_map</em>, using

+ 3 - 0
raster/r.li/r.li.simpson/simpson.c

@@ -159,6 +159,7 @@ int calculate(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -344,6 +345,7 @@ int calculateD(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }
 
 
@@ -529,6 +531,7 @@ int calculateF(int fd, struct area_entry *ad, double *result)
 	    }
 	    }
 
 
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
 	    if (!(Rast_is_null_value(&corrCell, uc.t))) {
+		/* total patch area */
 		area++;
 		area++;
 	    }
 	    }