[GRASS-SVN] r61250 - grass/trunk/raster/r.series.accumulate

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 14 01:24:25 PDT 2014


Author: mmetz
Date: 2014-07-14 01:24:24 -0700 (Mon, 14 Jul 2014)
New Revision: 61250

Modified:
   grass/trunk/raster/r.series.accumulate/main.c
Log:
r.series.accumulate: fix gdd and related

Modified: grass/trunk/raster/r.series.accumulate/main.c
===================================================================
--- grass/trunk/raster/r.series.accumulate/main.c	2014-07-14 01:27:09 UTC (rev 61249)
+++ grass/trunk/raster/r.series.accumulate/main.c	2014-07-14 08:24:24 UTC (rev 61250)
@@ -55,7 +55,7 @@
     } parm;
     struct
     {
-        struct Flag *avg, *nulls, *lazy, *float_output;
+        struct Flag *nulls, *lazy, *float_output;
     } flag;
     int i;
     int num_inputs, max_inputs;
@@ -148,15 +148,11 @@
     parm.method->label = "This method will be applied to compute the accumulative values from the input maps";
     G_asprintf(&desc,
            "gdd;%s;mean;%s;bedd;%s;huglin;%s",
-           _("Growing Degree Days or Winkler indices: depending on the chosen average computation set with -a flag"),
-           _("Mean: either (min + max) / 2 or sum(input maps)/(number of input maps) set with -a flag"),
+           _("Growing Degree Days or Winkler indices"),
+           _("Mean: sum(input maps)/(number of input maps)"),
            _("Biologically Effective Degree Days"),
            _("Huglin Heliothermal index"));
     parm.method->descriptions = desc;
-    
-    flag.avg = G_define_flag();
-    flag.avg->key = 'a';
-    flag.avg->description = _("Use arithmetical mean instead of (min + max ) / 2");
 
     flag.nulls = G_define_flag();
     flag.nulls->key = 'n';
@@ -383,20 +379,15 @@
                 }
             }
 
+	    value = dcell_null;
             if (!non_null || (null && flag.nulls->answer)) {
                 if (basemap)
                     value = basemap->buf[col];
-                else
-                    value = dcell_null;
             }
             else {
-                /* Compute mean or average */
-                if (flag.avg->answer) {
-                    avg /= non_null;
-                }
-                else {
-                    avg = (min + max) / 2.;
-                }
+                /* Compute mean or index */
+		avg /= non_null;
+
                 switch(method) {
                     case METHOD_HUGLIN:
                         avg = (avg + max) / 2;
@@ -412,11 +403,12 @@
                         /* Winkler or GDD index computation is the default */
                         break;
                 }
-                if(method != METHOD_MEAN)
-                        value = avg - lower;
+                if (method != METHOD_MEAN) {
+		    value = avg - lower;
 
-                if (value < 0.)
-                    value = 0.;
+		    if (value < 0.)
+			value = 0.;
+		}
 
                 if (basemap)
                     value += basemap->buf[col];



More information about the grass-commit mailing list