Explorar o código

r.uslek: trying to generate a working test case

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62849 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler %!s(int64=10) %!d(string=hai) anos
pai
achega
d8818436f7
Modificáronse 3 ficheiros con 26 adicións e 9 borrados
  1. 7 6
      raster/r.uslek/prct2tex.c
  2. 16 1
      raster/r.uslek/r.uslek.html
  3. 3 2
      raster/r.uslek/tex2usle_k.c

+ 7 - 6
raster/r.uslek/prct2tex.c

@@ -1,4 +1,5 @@
-#include<stdio.h>
+#include <stdio.h>
+#include <grass/gis.h>
 
 #define POLYGON_DIMENSION 20
 /* From FAOSOIL CD, after USDA 1951, p209 */
@@ -15,8 +16,8 @@ double point_in_triangle(double point_x, double point_y, double point_z,
 			 double t2_y, double t2_z, double t3_x, double t3_y,
 			 double t3_z)
 {
-    /*G_message("in function: sand=%5.3f clay=%5.3f silt=%5.3f",
-				point_x,point_y,point_z); */
+    G_debug(1, "in function: sand=%5.3f clay=%5.3f silt=%5.3f",
+				point_x,point_y,point_z);
     double answer;
     double answer1_x, answer1_y, answer1_z;
     double answer2_x, answer2_y, answer2_z;
@@ -100,7 +101,7 @@ double point_in_triangle(double point_x, double point_y, double point_z,
 
 int prct2tex(double sand_input, double clay_input, double silt_input)
 {
-    /*G_message("%5.3f||%5.3f||%5.3f",sand_input,clay_input,silt_input); */
+    G_debug(1, "%5.3f||%5.3f||%5.3f",sand_input,clay_input,silt_input);
     
     /* set up index for soil texture classes */
     int index = 20;
@@ -660,7 +661,7 @@ int prct2tex(double sand_input, double clay_input, double silt_input)
 	    /* G_message("Silt: index labelled as 11"); */
 	}
     }
-    /* if(index==0){
+    if(index==0){
        G_message("clay");
        } else if (index==1){
        G_message("sandy clay");
@@ -686,6 +687,6 @@ int prct2tex(double sand_input, double clay_input, double silt_input)
        G_message("silt");
        } else {
        G_message("Unable to allocate class");
-       } */
+       }
     return index;
 }

+ 16 - 1
raster/r.uslek/r.uslek.html

@@ -12,8 +12,23 @@ conversion table was applied for transforming soil classes into K factor.
 <h2>NOTES</h2>
 <em>r.watershed</em> provides for USLE L, S, LS factors.
 
-<h2>TODO</h2>
+<h2>EXAMPLE</h2>
 
+TBD.
+
+<!--
+# TODO: change to meaningful values
+
+# NC data
+g.region rural_1m -p
+r.mapcalc "sand = 0.30"
+r.mapcalc "clay = 0.15"
+r.mapcalc "silt = 0.52"
+r.mapcalc "organ = 0.03"
+
+r.uslek psand=sand pclay=clay psilt=silt pomat=organ output=usle_k
+r.univar usle_k
+-->
 
 <h2>SEE ALSO</h2>
 

+ 3 - 2
raster/r.uslek/tex2usle_k.c

@@ -1,4 +1,5 @@
-#include<stdio.h>
+#include <stdio.h>
+#include <grass/gis.h>
 
 /* From FAOSOIL CD, after USDA 1951, p209 */
 
@@ -6,7 +7,7 @@ double tex2usle_k(int texture, double om_in)
 {
     double usle_k = 200.0; /* Initial value */
 
-    /*G_message("texture=%i, om=%5.3f",texture, om_in); */
+    G_debug(1, "texture=%i, om=%5.3f",texture, om_in);
     if (om_in < 0.5) {
 	if (texture == 0) /* G_message("clay"); */
 	    usle_k = 0.29;	/*Took max value @0.2 */