[GRASS-SVN] r71045 - grass-addons/grass7/raster/r.seasons

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 7 07:47:55 PDT 2017


Author: mmetz
Date: 2017-05-07 07:47:55 -0700 (Sun, 07 May 2017)
New Revision: 71045

Modified:
   grass-addons/grass7/raster/r.seasons/main.c
Log:
r.seasons: fix core length

Modified: grass-addons/grass7/raster/r.seasons/main.c
===================================================================
--- grass-addons/grass7/raster/r.seasons/main.c	2017-05-06 22:08:55 UTC (rev 71044)
+++ grass-addons/grass7/raster/r.seasons/main.c	2017-05-07 14:47:55 UTC (rev 71045)
@@ -79,13 +79,13 @@
 		blenin -= (ts[*start1 - 1] + ts[*start1]) / 2.0;
 	    else
 		blenin -= ts[*start1] - (ts[*start1 + 1] - ts[*start1]) / 2.0;
-	    
+	}
+	else {
 	    if (blenin >= minlen)
 		break;
+	    else
+		blenin = 0;
 	}
-	else {
-	    blenin = 0;
-	}
     }
     if (blenin < minlen)
 	return 0;
@@ -142,7 +142,7 @@
 		blenin -= ts[startin] - (ts[startin + 1] - ts[startin]) / 2.0;
 	    
 	    if (blenin >= minlen)
-		*end2 = i;
+		*end1 = i;
 	}
 	else {
 	    blenin = 0;
@@ -290,7 +290,6 @@
 	G_fatal_error(_("Minimum season length must be positive"));
     threshold = atof(parm.threshold->answer);
 
-
     if (flag.lo->answer)
 	cmp_dbl = cmp_dbl_lo;
     else
@@ -468,7 +467,6 @@
 		values[i] = v;
 	    }
 
-
 	    nfound = 0;
 	    i0 = 0;
 	    while (get_season(values, isnull, ts, i0, num_inputs,
@@ -518,13 +516,10 @@
 	G_important_message(_("The number of output seasons (%d) is smaller than the maximum number of detected seasons (%d)."),
 	                    ns, nsmax);
 
-    /* close input maps */
-    for (i = 0; i < num_inputs; i++) {
-	struct input *in = &inputs[i];
-
-	if (!flag.lazy->answer)
-	    Rast_close(in->fd);
-
+    if (!flag.lazy->answer) {
+	/* close input maps */
+	for (i = 0; i < num_inputs; i++)
+	    Rast_close(inputs[i].fd);
     }
 
     /* close output maps */



More information about the grass-commit mailing list