Browse Source

Merged changes from r.gdd into r.series.accumlate and t.rast.accumulate.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58713 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 11 years ago
parent
commit
49eb6530be

+ 66 - 66
raster/r.series.accumulate/main.c

@@ -27,6 +27,8 @@
 #define METHOD_GDD 1
 #define METHOD_GDD 1
 #define METHOD_MEAN 2
 #define METHOD_MEAN 2
 #define METHOD_WINKLER 3
 #define METHOD_WINKLER 3
+#define METHOD_BEDD 4
+#define METHOD_HUGLIN 5
 
 
 struct map_info
 struct map_info
 {
 {
@@ -53,7 +55,7 @@ int main(int argc, char *argv[])
     } parm;
     } parm;
     struct
     struct
     {
     {
-        struct Flag *nulls, *lazy, *float_output;
+        struct Flag *avg, *nulls, *lazy, *float_output;
     } flag;
     } flag;
     int i;
     int i;
     int num_inputs, max_inputs;
     int num_inputs, max_inputs;
@@ -70,6 +72,7 @@ int main(int argc, char *argv[])
     DCELL dcell_null;
     DCELL dcell_null;
     RASTER_MAP_TYPE out_type;
     RASTER_MAP_TYPE out_type;
     int out_size;
     int out_size;
+    char *desc = NULL;
     
     
     G_gisinit(argv[0]);
     G_gisinit(argv[0]);
     
     
@@ -77,16 +80,19 @@ int main(int argc, char *argv[])
     G_add_keyword(_("raster"));
     G_add_keyword(_("raster"));
     G_add_keyword(_("series"));
     G_add_keyword(_("series"));
     G_add_keyword(_("accumulation"));
     G_add_keyword(_("accumulation"));
-    module->description = _("Calculates (accumulated) raster value means, growing degree days (GDDs) or Winkler indices from several input maps.");
-    
+    module->description =
+    _("Makes each output cell value a accumulation"
+      "function of the values assigned to the corresponding cells "
+      "in the input raster map layers.");
+
     parm.basemap = G_define_standard_option(G_OPT_R_INPUT);
     parm.basemap = G_define_standard_option(G_OPT_R_INPUT);
     parm.basemap->key = "basemap";
     parm.basemap->key = "basemap";
     parm.basemap->description = _("Existing map to be added to output");
     parm.basemap->description = _("Existing map to be added to output");
     parm.basemap->required = NO;
     parm.basemap->required = NO;
-    
+
     parm.input = G_define_standard_option(G_OPT_R_INPUTS);
     parm.input = G_define_standard_option(G_OPT_R_INPUTS);
     parm.input->required = NO;
     parm.input->required = NO;
-    
+
     parm.file = G_define_standard_option(G_OPT_F_INPUT);
     parm.file = G_define_standard_option(G_OPT_F_INPUT);
     parm.file->key = "file";
     parm.file->key = "file";
     parm.file->description = _("Input file with raster map names, one per line");
     parm.file->description = _("Input file with raster map names, one per line");
@@ -112,12 +118,12 @@ int main(int argc, char *argv[])
     parm.lower = G_define_standard_option(G_OPT_R_INPUT);
     parm.lower = G_define_standard_option(G_OPT_R_INPUT);
     parm.lower->key = "lower";
     parm.lower->key = "lower";
     parm.lower->required = NO;
     parm.lower->required = NO;
-    parm.lower->description = _("The raster map specifying the lower accumulation limit");
+    parm.lower->description = _("The raster map specifying the lower accumulation limit, also called baseline");
     
     
     parm.upper = G_define_standard_option(G_OPT_R_INPUT);
     parm.upper = G_define_standard_option(G_OPT_R_INPUT);
     parm.upper->key = "upper";
     parm.upper->key = "upper";
     parm.upper->required = NO;
     parm.upper->required = NO;
-    parm.upper->description = _("The raster map specifying the upper accumulation limit");
+    parm.upper->description = _("The raster map specifying the upper accumulation limit, also called cutoff. Only applied to BEDD computation.");
     
     
     parm.range = G_define_option();
     parm.range = G_define_option();
     parm.range->key = "range";
     parm.range->key = "range";
@@ -135,10 +141,23 @@ int main(int argc, char *argv[])
     parm.method = G_define_option();
     parm.method = G_define_option();
     parm.method->key = "method";
     parm.method->key = "method";
     parm.method->type = TYPE_STRING;
     parm.method->type = TYPE_STRING;
-    parm.method->options = "mean,gdd,winkler";
-    parm.method->answer = "mean";
-    parm.method->description = _("This method will be applied to compute the accumulative values from the input maps");
-    
+    parm.method->multiple = NO;
+    parm.method->required = NO;
+    parm.method->options = "gdd,bedd,huglin,mean";
+    parm.method->answer = "gdd";
+    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"),
+           _("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 = G_define_flag();
     flag.nulls->key = 'n';
     flag.nulls->key = 'n';
     flag.nulls->description = _("Propagate NULLs");
     flag.nulls->description = _("Propagate NULLs");
@@ -157,15 +176,16 @@ int main(int argc, char *argv[])
     lo = -1.0 / 0.0;    /* -inf */
     lo = -1.0 / 0.0;    /* -inf */
     hi =  1.0 / 0.0;    /* inf */
     hi =  1.0 / 0.0;    /* inf */
     
     
+    method = METHOD_GDD;
     if (G_strncasecmp(parm.method->answer, "gdd", 3) == 0)
     if (G_strncasecmp(parm.method->answer, "gdd", 3) == 0)
         method = METHOD_GDD;
         method = METHOD_GDD;
-    
-    if (G_strncasecmp(parm.method->answer, "mean", 4) == 0)
+    else if (G_strncasecmp(parm.method->answer, "mean", 4) == 0)
         method = METHOD_MEAN;
         method = METHOD_MEAN;
-    
-    if (G_strncasecmp(parm.method->answer, "winkler", 7) == 0)
-        method = METHOD_WINKLER;
-    
+    else if (G_strncasecmp(parm.method->answer, "bedd", 4) == 0)
+        method = METHOD_BEDD;
+    else if (G_strncasecmp(parm.method->answer, "huglin", 7) == 0)
+        method = METHOD_HUGLIN;
+
     if (parm.range->answer) {
     if (parm.range->answer) {
         lo = atof(parm.range->answers[0]);
         lo = atof(parm.range->answers[0]);
         hi = atof(parm.range->answers[1]);
         hi = atof(parm.range->answers[1]);
@@ -336,7 +356,7 @@ int main(int argc, char *argv[])
                 G_fatal_error(_("'%s'=%f must be > '%s'=%f"), parm.upper->key, upper,
                 G_fatal_error(_("'%s'=%f must be > '%s'=%f"), parm.upper->key, upper,
                               parm.lower->key, lower);
                               parm.lower->key, lower);
                 
                 
-                min = dcell_null;
+            min = dcell_null;
             max = dcell_null;
             max = dcell_null;
             avg = 0;
             avg = 0;
             
             
@@ -351,19 +371,16 @@ int main(int argc, char *argv[])
                         null = 1;
                         null = 1;
                     }
                     }
                     else  {
                     else  {
-                        if (method == METHOD_MEAN || method == METHOD_WINKLER)
-                            avg += v;
-                        else if (method == METHOD_GDD) {
-                            if (min > v || Rast_is_d_null_value(&min))
-                                min = v;
-                            if (max < v || Rast_is_d_null_value(&max))
-                                max = v;
-                        }
+                        avg += v;
+                        if (min > v || Rast_is_d_null_value(&min))
+                            min = v;
+                        if (max < v || Rast_is_d_null_value(&max))
+                            max = v;
                         non_null++;
                         non_null++;
                     }
                     }
                 }
                 }
             }
             }
-            
+
             if (!non_null || (null && flag.nulls->answer)) {
             if (!non_null || (null && flag.nulls->answer)) {
                 if (basemap)
                 if (basemap)
                     value = basemap->buf[col];
                     value = basemap->buf[col];
@@ -371,51 +388,34 @@ int main(int argc, char *argv[])
                     value = dcell_null;
                     value = dcell_null;
             }
             }
             else {
             else {
+                /* Compute mean or average */
+                if (flag.avg->answer) {
+                    avg /= non_null;
+                }
+                else {
+                    avg = (min + max) / 2.;
+                }
                 switch(method) {
                 switch(method) {
-                    case METHOD_WINKLER:
-                        
-                        avg /= non_null;
-                        
-                        if (avg < lower)
-                            avg = lower;
-                        else if (avg > upper)
+                    case METHOD_HUGLIN:
+                        avg = (avg + max) / 2;
+                        break;
+                    case METHOD_BEDD:
+                        if(avg > upper)
                             avg = upper;
                             avg = upper;
-                        
-                        value = avg - lower;
-                        
-                        if (value < 0.)
-                            value = 0.;
-                        
                         break;
                         break;
-                    case METHOD_GDD:
-                        
-                        if (min < lower)
-                            min = lower;
-                        else if (min > upper)
-                            min = upper;
-                        if (max < lower)
-                            max = lower;
-                        else if (max > upper)
-                            max = upper;
-                        
-                        value = (min + max) / 2. - lower;
-                        
-                        if (value < 0.)
-                            value = 0.;
-                        
+                    case METHOD_MEAN:
+                        value = avg;
                         break;
                         break;
                     default:
                     default:
-                        
-                        avg /= non_null;
-                        
-                        if (avg < lower)
-                            avg = 0.0;
-                        else if (avg > upper)
-                            avg = upper;
-                        
-                        value = avg;
+                        /* Winkler or GDD index computation is the default */
+                        break;
                 }
                 }
-                
+                if(method != METHOD_MEAN)
+                        value = avg - lower;
+
+                if (value < 0.)
+                    value = 0.;
+
                 if (basemap)
                 if (basemap)
                     value += basemap->buf[col];
                     value += basemap->buf[col];
             }
             }

+ 42 - 16
raster/r.series.accumulate/r.series.accumulate.html

@@ -1,21 +1,50 @@
 <h2>DESCRIPTION</h2>
 <h2>DESCRIPTION</h2>
 
 
-<em>r.series.accumulate</em> calculates (accumulated) raster value means, growing degree days (GDDs) or
-Winkler indices's from several input maps.
+<em>r.series.accumulate</em> calculates (accumulated) raster value using growing degree days (GDDs)/Winkler indices's,
+Biologically Effective Degree Days (BEDD), Huglin heliothermal indices or an average approach from several input maps.
 <p>
 <p>
-The formula for calculating the raster value means
+The flag <b>-a</b> determines the average computation of the input raster maps. 
+In case the flag is not set, the average calculation is:
 <div class="code"><pre>
 <div class="code"><pre>
-    value = average
+    average = (min + max) / 2
 </pre></div>
 </pre></div>
-The formula for calculating GDDs is
+In case the flag was set, the calculation changes to arithmetic mean
 <div class="code"><pre>
 <div class="code"><pre>
-    value = (max + min) / 2 - lower
+    average = sum(input maps) / (number of input maps)
 </pre></div>
 </pre></div>
-The formula for calculating the Winkler index is
+<p>
+<b>GDD</b> Growing Degree Days are calculated as
+<div class="code"><pre>
+    gdd = average - lower
+</pre></div>
+<p>
+In case the <b>-a</b> is set, the Winkler indices are calculated instead of GDD,
+usually accumulated for the period April 1<sup>st</sup> to October 
+31<sup>st</sup> (northern hemisphere) or the period October 
+1<sup>st</sup> to April 30<sup>th</sup> 
+(southern hemisphere).
+<p>
+<b>BEDDs</b> Biologically Effective Degree Days are calculated as
+<div class="code"><pre>
+    bedd = average - lower
+</pre></div>
+with an optional upper <em>cutoff</em> applied to the average instead of 
+the temperature values.
+<p>
+The <b>Huglin heliothermal index</b> is calculated as
 <div class="code"><pre>
 <div class="code"><pre>
-    value = average - lower
+    huglin = (average + max) / 2 - lower
 </pre></div>
 </pre></div>
-with <em>min</em> being the minimum value, <em>max</em>
+usually accumulated for the period April 1<sup>st</sup> to September 
+30<sup>th</sup> (northern hemisphere) or the period September 
+1<sup>st</sup> to April 30<sup>th</sup> (southern hemisphere).
+<p>
+<b>Mean</b> raster values are calculated as
+<div class="code"><pre>
+    mean = average
+</pre></div>
+<p>
+For all formulas is <em>min</em> the minimum value, <em>max</em>
 the maximum value and <em>average</em> the average value.
 the maximum value and <em>average</em> the average value.
 The <em>min</em>, <em>max</em> and <em>average</em> values
 The <em>min</em>, <em>max</em> and <em>average</em> values
 are automatically calculated from the input maps.
 are automatically calculated from the input maps.
@@ -25,14 +54,9 @@ input values. The <em>lower</em> and <em>upper</em> maps, as well as the <em>ran
 options are applied to constrain the accumulation. In case the <em>lower</em> and <em>upper</em>
 options are applied to constrain the accumulation. In case the <em>lower</em> and <em>upper</em>
 maps are not provided the <em>limits</em> option with default values will be applied.
 maps are not provided the <em>limits</em> option with default values will be applied.
 <p>
 <p>
-Any <em>min</em>, <em>max</em> and <em>average</em> values
-above the <em>upper</em> values are set to <em>upper</em>, and any
-<em>min</em>, <em>max</em> and <em>average</em> values below the 
-<em>lower</em> values are set to <em>lower</em>, or in case of <em>mean</em>
-computation to 0 (zero). Negative results are set to 0 (zero). 
-<p>
+
 If an existing map is provided with the <em>basemap</em> option, the
 If an existing map is provided with the <em>basemap</em> option, the
-values of this map are added to the output, thus accumulating means, GDDs or winkler indices's.
+values of this map are added to the output.
 
 
 <h2>NOTES</h2>
 <h2>NOTES</h2>
 
 
@@ -46,6 +70,8 @@ With the <em>-n</em> flag, any cell for which any of the
 corresponding input cells are NULL is automatically set to NULL 
 corresponding input cells are NULL is automatically set to NULL 
 (NULL propagation) and the accumulated value is not calculated.
 (NULL propagation) and the accumulated value is not calculated.
 <p>
 <p>
+Negative results are set to 0 (zero). 
+<p>
 Without the <em>-n</em> flag, all non-NULL cells are used for calculation.
 Without the <em>-n</em> flag, all non-NULL cells are used for calculation.
 <p>
 <p>
 If the <em>range=</em> option is given, any values which fall outside 
 If the <em>range=</em> option is given, any values which fall outside 

+ 29 - 13
raster/r.series.accumulate/test_suite/test.r.series.accumulate.sh

@@ -16,27 +16,43 @@ r.mapcalc expr="map_a = rand(0, 15)"
 r.mapcalc expr="map_b = rand(1, 14)"
 r.mapcalc expr="map_b = rand(1, 14)"
 r.mapcalc expr="map_c = rand(2, 13)"
 r.mapcalc expr="map_c = rand(2, 13)"
 
 
+# BEDD with lower limit map and upper limit value
+r.series.accumulate basemap=basemap input=map_a lower=lower limits=5,10 \
+                    output=test_accu_0 method=bedd -f --verbose 
+# GDD with lower limit map
 r.series.accumulate basemap=basemap input=map_a lower=lower \
 r.series.accumulate basemap=basemap input=map_a lower=lower \
-                    output=test_accu_1 upper=upper method=gdd -f --verbose 
-
-r.series.accumulate basemap=basemap input=map_a lower=lower \
-                    output=test_accu_2 upper=upper method=winkler -f --verbose 
-
+                    output=test_accu_1 method=gdd -f --verbose 
+# Winkler with lower limit map
 r.series.accumulate basemap=basemap input=map_a lower=lower \
 r.series.accumulate basemap=basemap input=map_a lower=lower \
-                    output=test_accu_3 upper=upper method=mean --verbose 
-
+                    output=test_accu_2 method=gdd -a -f --verbose 
+# Mean
+r.series.accumulate basemap=basemap input=map_a \
+                    output=test_accu_3  method=mean --verbose 
+# Average
+r.series.accumulate basemap=basemap input=map_a \
+                    output=test_accu_3  method=mean -a --verbose 
+# GDD with lower limit value
 r.series.accumulate basemap=basemap input=map_a,map_b,map_c limits=5,10 \
 r.series.accumulate basemap=basemap input=map_a,map_b,map_c limits=5,10 \
                     output=test_accu_4 method=gdd -f --verbose 
                     output=test_accu_4 method=gdd -f --verbose 
-
-r.series.accumulate basemap=basemap input=map_a,map_b,map_c lower=lower limits=5,10 \
-                    output=test_accu_5 method=winkler -f --verbose 
-
+# Winkler with  multiple maps, lower limit value
+r.series.accumulate basemap=basemap input=map_a,map_b,map_c limits=5,10 \
+                    output=test_accu_5 method=bedd -a -f --verbose 
+# BEDD with  multiple maps, lower limit map and upper limit value
 r.series.accumulate basemap=basemap input=map_a,map_b,map_c lower=lower limits=5,10 \
 r.series.accumulate basemap=basemap input=map_a,map_b,map_c lower=lower limits=5,10 \
-                    output=test_accu_6 range=6,9 method=mean --verbose 
+                    output=test_accu_6 method=bedd -f --verbose 
+# BEDD with multiple maps, lower limit map and upper limit map
+r.series.accumulate basemap=basemap input=map_a,map_b,map_c lower=lower upper=upper \
+                    output=test_accu_7 method=bedd -f --verbose 
+# Mean with range multiple maps
+r.series.accumulate basemap=basemap input=map_a,map_b,map_c \
+                    output=test_accu_8 range=6,9 method=mean --verbose 
+# Mean with range
+r.series.accumulate basemap=basemap input=map_a, \
+                    output=test_accu_9 range=6,9 method=mean --verbose
 
 
 # Test for correct results
 # Test for correct results
 for map in `g.mlist type=rast pattern=test_accu_*` ; do
 for map in `g.mlist type=rast pattern=test_accu_*` ; do
-    r.out.ascii input=${map} output=${map}.txt dp=2
+    r.out.ascii input=${map} output=${map}.ref dp=2
 done
 done
 
 
 for i in `ls test_accu_*.txt` ; do
 for i in `ls test_accu_*.txt` ; do

+ 14 - 0
raster/r.series.accumulate/test_suite/test_accu_0.ref

@@ -0,0 +1,14 @@
+north: 80
+south: 0
+east: 120
+west: 0
+rows: 8
+cols: 12
+10 10 15 12 10 12 15 12 15 10 15 10 
+13 15 11 14 10 12 14 12 15 15 14 15 
+* * * * * * * * * * * * 
+15 12 15 15 10 13 15 14 13 10 15 13 
+14 15 11 13 15 10 15 10 10 15 11 15 
+15 15 10 15 13 13 14 10 10 10 10 10 
+14 14 10 10 15 10 10 11 10 10 12 14 
+11 10 13 10 15 11 15 15 14 15 11 10 

+ 7 - 7
raster/r.series.accumulate/test_suite/test_accu_1.ref

@@ -4,11 +4,11 @@ east: 120
 west: 0
 west: 0
 rows: 8
 rows: 8
 cols: 12
 cols: 12
-10 10 15 12 10 12 15 12 15 10 15 10 
-13 15 11 14 10 12 14 12 15 15 14 15 
+10 10 15 12 10 12 18 12 19 10 16 10 
+13 19 11 14 10 12 14 12 16 19 14 18 
 * * * * * * * * * * * * 
 * * * * * * * * * * * * 
-15 12 15 15 10 13 15 14 13 10 15 13 
-14 15 11 13 15 10 15 10 10 15 11 15 
-15 15 10 15 13 13 14 10 10 10 10 10 
-14 14 10 10 15 10 10 11 10 10 12 14 
-11 10 13 10 15 11 15 15 14 15 11 10 
+19 12 16 15 10 13 15 14 13 10 18 13 
+14 19 11 13 18 10 18 10 10 17 11 16 
+16 16 10 17 13 13 14 10 10 10 10 10 
+14 14 10 10 18 10 10 11 10 10 12 14 
+11 10 13 10 18 11 18 18 14 17 11 10 

+ 7 - 7
raster/r.series.accumulate/test_suite/test_accu_2.ref

@@ -4,11 +4,11 @@ east: 120
 west: 0
 west: 0
 rows: 8
 rows: 8
 cols: 12
 cols: 12
-10 10 15 12 10 12 15 12 15 10 15 10 
-13 15 11 14 10 12 14 12 15 15 14 15 
+10 10 15 12 10 12 18 12 19 10 16 10 
+13 19 11 14 10 12 14 12 16 19 14 18 
 * * * * * * * * * * * * 
 * * * * * * * * * * * * 
-15 12 15 15 10 13 15 14 13 10 15 13 
-14 15 11 13 15 10 15 10 10 15 11 15 
-15 15 10 15 13 13 14 10 10 10 10 10 
-14 14 10 10 15 10 10 11 10 10 12 14 
-11 10 13 10 15 11 15 15 14 15 11 10 
+19 12 16 15 10 13 15 14 13 10 18 13 
+14 19 11 13 18 10 18 10 10 17 11 16 
+16 16 10 17 13 13 14 10 10 10 10 10 
+14 14 10 10 18 10 10 11 10 10 12 14 
+11 10 13 10 18 11 18 18 14 17 11 10 

+ 7 - 7
raster/r.series.accumulate/test_suite/test_accu_3.ref

@@ -4,11 +4,11 @@ east: 120
 west: 0
 west: 0
 rows: 8
 rows: 8
 cols: 12
 cols: 12
-10 10 20 17 10 17 20 17 20 10 20 10 
-18 20 16 19 10 17 19 17 20 20 19 20 
+10 12 20 17 12 17 23 17 24 13 21 12 
+18 24 16 19 10 17 19 17 21 24 19 23 
 * * * * * * * * * * * * 
 * * * * * * * * * * * * 
-20 17 20 20 10 18 20 19 18 10 20 18 
-19 20 16 18 20 10 20 15 10 20 16 20 
-20 20 10 20 18 18 19 10 15 10 15 10 
-19 19 10 10 20 10 10 16 10 15 17 19 
-16 10 18 15 20 16 20 20 19 20 16 10 
+24 17 21 20 13 18 20 19 18 14 23 18 
+19 24 16 18 23 12 23 15 11 22 16 21 
+21 21 14 22 18 18 19 11 15 10 15 11 
+19 19 11 14 23 14 13 16 14 15 17 19 
+16 10 18 15 23 16 23 23 19 22 16 13 

+ 7 - 7
raster/r.series.accumulate/test_suite/test_accu_4.ref

@@ -4,11 +4,11 @@ east: 120
 west: 0
 west: 0
 rows: 8
 rows: 8
 cols: 12
 cols: 12
-10 12.5 12.5 11 10 11 14.5 11 12.5 12.5 12.5 12.5 
-12.5 12.5 13 14 11 13.5 12.5 11 12.5 14 14.5 14 
+10 11.5 11 10 10 10 16 10 13 12 11.5 12 
+13 13.5 13 14.5 10 13.5 11 10.5 11.5 16 15 15.5 
 * * * * * * * * * * * * 
 * * * * * * * * * * * * 
-12.5 13 13.5 12.5 12.5 14 12.5 12 13 11.5 13 11.5 
-12.5 12.5 10.5 12.5 14.5 10 15 12.5 11 14 11 14.5 
-12.5 13 12 12.5 13 14 12.5 12.5 12.5 12 11.5 12.5 
-12 12.5 12.5 10 14 10 11 10.5 12.5 12.5 12.5 12 
-12.5 12 11.5 12.5 12.5 12.5 12.5 13 12.5 12.5 13 10.5 
+13.5 13 14.5 11 11.5 15 11 12 13.5 11 14.5 10 
+11.5 13 10 13 16 10 17 13.5 10 15 10 15 
+11 13.5 11.5 12.5 13.5 14.5 13.5 11 13.5 10 11.5 11 
+10.5 12.5 11.5 10 15.5 10 10 10.5 12.5 13.5 12 11.5 
+12.5 10 10 14 13.5 12.5 12 14.5 12 12.5 13.5 10 

+ 7 - 7
raster/r.series.accumulate/test_suite/test_accu_6.ref

@@ -4,11 +4,11 @@ east: 120
 west: 0
 west: 0
 rows: 8
 rows: 8
 cols: 12
 cols: 12
-10 10 10 17 10 16.5 19 16.5 10 10 17 10 
-18 10 17 18.5 17 17 19 17 10 18.5 19 18 
+10 11.5 11 10 10 10 15 10 13 12 11.5 12 
+13 13.5 13 14.5 10 13.5 11 10.5 11.5 15 15 15 
 * * * * * * * * * * * * 
 * * * * * * * * * * * * 
-10 16.5 17 19 17 18 10 18.5 17 18 16 18 
-19 16 16 18 19 10 10 19 16.5 18 16.5 19 
-16 17.5 19 17 17 18 19 10 16 19 17.5 10 
-19 17.33 18 10 18 10 17 16 10 10 17 19 
-18 19 18 16 16 17.67 10 16.5 19 17 16.5 16 
+13.5 13 14.5 11 11.5 15 11 12 13.5 11 14.5 10 
+11.5 13 10 13 15 10 15 13.5 10 15 10 15 
+11 13.5 11.5 12.5 13.5 14.5 13.5 11 13.5 10 11.5 11 
+10.5 12.5 11.5 10 15 10 10 10.5 12.5 13.5 12 11.5 
+12.5 10 10 14 13.5 12.5 12 14.5 12 12.5 13.5 10 

+ 14 - 0
raster/r.series.accumulate/test_suite/test_accu_7.ref

@@ -0,0 +1,14 @@
+north: 80
+south: 0
+east: 120
+west: 0
+rows: 8
+cols: 12
+10 11.5 11 10 10 10 15 10 13 12 11.5 12 
+13 13.5 13 14.5 10 13.5 11 10.5 11.5 15 15 15 
+* * * * * * * * * * * * 
+13.5 13 14.5 11 11.5 15 11 12 13.5 11 14.5 10 
+11.5 13 10 13 15 10 15 13.5 10 15 10 15 
+11 13.5 11.5 12.5 13.5 14.5 13.5 11 13.5 10 11.5 11 
+10.5 12.5 11.5 10 15 10 10 10.5 12.5 13.5 12 11.5 
+12.5 10 10 14 13.5 12.5 12 14.5 12 12.5 13.5 10 

+ 14 - 0
raster/r.series.accumulate/test_suite/test_accu_8.ref

@@ -0,0 +1,14 @@
+north: 80
+south: 0
+east: 120
+west: 0
+rows: 8
+cols: 12
+10 10 10 17 10 16.5 19 16.5 10 10 17 10 
+18 10 17 18.5 17 17 19 17 10 18.5 19 18 
+* * * * * * * * * * * * 
+10 16.5 17 19 17 18 10 18.5 17 18 16 18 
+19 16 16 18 19 10 10 19 16.5 18 16.5 19 
+16 17.5 19 17 17 18 19 10 16 19 17.5 10 
+19 17.5 18 10 18 10 17 16 10 10 17 19 
+17.5 19 18 16 16 17.5 10 16.5 19 17 16.5 16 

+ 14 - 0
raster/r.series.accumulate/test_suite/test_accu_9.ref

@@ -0,0 +1,14 @@
+north: 80
+south: 0
+east: 120
+west: 0
+rows: 8
+cols: 12
+10 10 10 17 10 17 10 17 10 10 10 10 
+18 10 16 19 10 17 19 17 10 10 19 10 
+* * * * * * * * * * * * 
+10 17 10 10 10 18 10 19 18 10 10 18 
+19 10 16 18 10 10 10 10 10 10 16 10 
+10 10 10 10 18 18 19 10 10 10 10 10 
+19 19 10 10 10 10 10 16 10 10 17 19 
+16 10 18 10 10 16 10 10 19 10 16 10 

+ 5 - 2
temporal/t.rast.accumulate/t.rast.accumulate.html

@@ -25,6 +25,8 @@ then maps that temporally overlap the actual granules, until
 maps are detected that have a temporal contain relation. 
 maps are detected that have a temporal contain relation. 
 If no maps are found or lower/upper STRDS are not defined, then the <b>limits</b> option is used, eg. <b>limits=10,30</b>.
 If no maps are found or lower/upper STRDS are not defined, then the <b>limits</b> option is used, eg. <b>limits=10,30</b>.
 <p>
 <p>
+The <b>upper</b> <b>limit</b> is only used in the Biologically Effective Degree Days calculation.
+<p>
 The options <b>shift</b>, <b>scale</b> and <b>method</b> are passed to 
 The options <b>shift</b>, <b>scale</b> and <b>method</b> are passed to 
 <a href="r.series.accumulate.html">r.series.accumulate</a>. 
 <a href="r.series.accumulate.html">r.series.accumulate</a>. 
 Please refer to the manual page of <a href="r.series.accumulate.html">r.series.accumulate</a>
 Please refer to the manual page of <a href="r.series.accumulate.html">r.series.accumulate</a>
@@ -71,13 +73,14 @@ g.region -p zoom=`t.rast.list input=temperature_mean_1990_2000_daily_celsius col
 #
 #
 # available here: http://extension.unh.edu/agric/gddays/docs/growch.pdf
 # available here: http://extension.unh.edu/agric/gddays/docs/growch.pdf
 
 
-# Now we compute the GDD from 1990 - 2000 for each year (12 month cycle) with
+# Now we compute the Biologically Effective Degree Days 
+# from 1990 - 2000 for each year (12 month cycle) with
 # a granularity of one day. Base temperature is 10°C, upper limit is 30°C.
 # a granularity of one day. Base temperature is 10°C, upper limit is 30°C.
 # Hence the accumulation starts at 10°C and does not accumulate values above 30°C. 
 # Hence the accumulation starts at 10°C and does not accumulate values above 30°C. 
 t.rast.accumulate input="temperature_mean_1990_2000_daily_celsius" \
 t.rast.accumulate input="temperature_mean_1990_2000_daily_celsius" \
       output="temperature_mean_1990_2000_daily_celsius_accumulated_10_30" \
       output="temperature_mean_1990_2000_daily_celsius_accumulated_10_30" \
       limits="10,30" start="1990-01-01" stop="2000-01-01" cycle="12 months" \
       limits="10,30" start="1990-01-01" stop="2000-01-01" cycle="12 months" \
-      base="temp_acc_daily_10_30" method="gdd"
+      base="temp_acc_daily_10_30" method="bedd"
 
 
 #############################################################################
 #############################################################################
 #### ACCUMULATION PATTERN DETECTION #########################################
 #### ACCUMULATION PATTERN DETECTION #########################################

+ 1 - 1
temporal/t.rast.accumulate/t.rast.accumulate.py

@@ -112,7 +112,7 @@
 #% key: method
 #% key: method
 #% type: string
 #% type: string
 #% description: This method will be applied to compute the accumulative values from the input maps
 #% description: This method will be applied to compute the accumulative values from the input maps
-#% options: mean,gdd,winkler
+#% options: mean,gdd,bedd,huglin
 #% answer: mean
 #% answer: mean
 #% required: no
 #% required: no
 #% multiple: no
 #% multiple: no