[GRASS-SVN] r62889 - grass/trunk/raster/r.uslek

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 24 09:03:29 PST 2014


Author: neteler
Date: 2014-11-24 09:03:29 -0800 (Mon, 24 Nov 2014)
New Revision: 62889

Modified:
   grass/trunk/raster/r.uslek/prct2tex.c
   grass/trunk/raster/r.uslek/r.uslek.html
   grass/trunk/raster/r.uslek/tex2usle_k.c
Log:
r.uslek manual: example added with randomized values; use G_verbose_message()

Modified: grass/trunk/raster/r.uslek/prct2tex.c
===================================================================
--- grass/trunk/raster/r.uslek/prct2tex.c	2014-11-24 17:00:06 UTC (rev 62888)
+++ grass/trunk/raster/r.uslek/prct2tex.c	2014-11-24 17:03:29 UTC (rev 62889)
@@ -16,7 +16,7 @@
 			 double t2_y, double t2_z, double t3_x, double t3_y,
 			 double t3_z)
 {
-    G_debug(1, "in function: sand=%5.3f clay=%5.3f silt=%5.3f",
+    G_debug(1,"point_in_triangle: sand=%5.3f clay=%5.3f silt=%5.3f",
 				point_x,point_y,point_z);
     double answer;
     double answer1_x, answer1_y, answer1_z;
@@ -101,7 +101,7 @@
 
 int prct2tex(double sand_input, double clay_input, double silt_input)
 {
-    G_debug(1, "%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;
@@ -662,31 +662,31 @@
 	}
     }
     if(index==0){
-       G_message("clay");
+       G_debug(1,"clay");
        } else if (index==1){
-       G_message("sandy clay");
+       G_debug(1,"sandy clay");
        } else if (index==2){
-       G_message("silty clay");
+       G_debug(1,"silty clay");
        } else if (index==3){
-       G_message("sandy clay loam");
+       G_debug(1,"sandy clay loam");
        } else if (index==4){
-       G_message("clay loam");
+       G_debug(1,"clay loam");
        } else if (index==5){
-       G_message("silty clay loam");
+       G_debug(1,"silty clay loam");
        } else if (index==6){
-       G_message("sand");
+       G_debug(1,"sand");
        } else if (index==7){
-       G_message("loamy sand");
+       G_debug(1,"loamy sand");
        } else if (index==8){
-       G_message("sandy loam");
+       G_debug(1,"sandy loam");
        } else if (index==9){
-       G_message("loam");
+       G_debug(1,"loam");
        } else if (index==10){
        G_message("silt loam");
        } else if (index==11){
-       G_message("silt");
+       G_debug(1,"silt");
        } else {
-       G_message("Unable to allocate class");
+       G_debug(1,"Unable to allocate class");
        }
     return index;
 }

Modified: grass/trunk/raster/r.uslek/r.uslek.html
===================================================================
--- grass/trunk/raster/r.uslek/r.uslek.html	2014-11-24 17:00:06 UTC (rev 62888)
+++ grass/trunk/raster/r.uslek/r.uslek.html	2014-11-24 17:03:29 UTC (rev 62889)
@@ -17,19 +17,38 @@
 TBD.
 
 <!--
-# TODO: change to meaningful values
+# NC data: simulation
+g.region rural_1m -p
 
-# NC data
-g.region rural_1m -p
-r.mapcalc "sand = 0.11"
-r.mapcalc "clay = 0.47"
-r.mapcalc "silt = 0.42"
+r.mapcalc "sand  = 0.11"
+r.mapcalc "clay  = 0.47"
+r.mapcalc "silt  = 0.42"
 r.mapcalc "organ = 0.0136"
 
 r.uslek psand=sand pclay=clay psilt=silt pomat=organ output=usle_k
 r.univar usle_k
 
 uslek = 0.25
+
+########
+# next example with small variations (condition: d_sand + d_clay + d_silt => 1.0)
+r.mapcalc -s "sand_r = rand(0.09,0.13)"
+r.mapcalc -s "clay_r = rand(0.45,0.49)"
+r.mapcalc -s "silt_r = rand(0.40,0.44)"
+r.mapcalc -s "organ  = rand(0.01,0.70)"
+
+r.mapcalc "temp_sum = sand_r + clay_r + silt_r"
+r.mapcalc "sand  = sand_r/temp_sum"
+r.mapcalc "clay  = clay_r/temp_sum"
+r.mapcalc "silt  = silt_r/temp_sum"
+r.mapcalc "test = sand + clay + silt"
+r.info -r test
+g.remove -f rast name=sand_r,clay_r,silt_r,temp_sum,test
+
+r.uslek psand=sand pclay=clay psilt=silt pomat=organ output=usle_k
+r.univar usle_k
+
+uslek =  variable
 -->
 
 <h2>SEE ALSO</h2>

Modified: grass/trunk/raster/r.uslek/tex2usle_k.c
===================================================================
--- grass/trunk/raster/r.uslek/tex2usle_k.c	2014-11-24 17:00:06 UTC (rev 62888)
+++ grass/trunk/raster/r.uslek/tex2usle_k.c	2014-11-24 17:03:29 UTC (rev 62889)
@@ -7,7 +7,7 @@
 {
     double usle_k = 200.0; /* Initial value */
 
-    G_verbose_message("tex2usle_k: texture=%i, om=%5.3f", texture, om_in);
+    G_debug(1,"tex2usle_k: texture=%i, om=%5.3f", texture, om_in);
     if (om_in < 0.05) {
 	if (texture == 0) /* G_message("clay"); */
 	    usle_k = 0.29;	/*Took max value @0.2 */



More information about the grass-commit mailing list