[GRASS-SVN] r59740 - grass/branches/releasebranch_7_0/raster/r.resamp.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 15 05:34:47 PDT 2014


Author: mmetz
Date: 2014-04-15 05:34:47 -0700 (Tue, 15 Apr 2014)
New Revision: 59740

Modified:
   grass/branches/releasebranch_7_0/raster/r.resamp.rst/main.c
Log:
r.resamp.rst: fix #1718

Modified: grass/branches/releasebranch_7_0/raster/r.resamp.rst/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.resamp.rst/main.c	2014-04-15 12:34:38 UTC (rev 59739)
+++ grass/branches/releasebranch_7_0/raster/r.resamp.rst/main.c	2014-04-15 12:34:47 UTC (rev 59740)
@@ -367,8 +367,6 @@
 
     if (smooth != NULL) {
 
-	fdsmooth = Rast_open_old(smooth, "");
-
 	Rast_get_cellhd(smooth, "", &smhd);
 
 	if ((winhd.ew_res != smhd.ew_res) || (winhd.ns_res != smhd.ns_res))
@@ -388,8 +386,6 @@
     if ((winhd.ew_res != inphd.ew_res) || (winhd.ns_res != inphd.ns_res))
 	G_fatal_error(_("Input map resolution differs from current region resolution!"));
 
-    fdinp = Rast_open_old(input, "");
-
     sdisk = 0;
     if (elev != NULL)
 	sdisk += disk;
@@ -439,12 +435,16 @@
 	Rast_get_fp_range_min_max(&range, &cellmin, &cellmax);
     }
     else {
+	fdinp = Rast_open_old(input, "");
+
 	cellrow = Rast_allocate_f_buf();
 	for (m1 = 0; m1 < inp_rows; m1++) {
 	    Rast_get_f_row(fdinp, cellrow, m1);
 	    Rast_row_update_fp_range(cellrow, m1, &range, FCELL_TYPE);
 	}
 	Rast_get_fp_range_min_max(&range, &cellmin, &cellmax);
+
+	Rast_close(fdinp);
     }
 
     fcellmin = (float)cellmin;
@@ -485,6 +485,10 @@
     G_message(_("Changing back to the original region ..."));
     Rast_set_window(&winhd);
 
+    fdinp = Rast_open_old(input, "");
+    if (smooth != NULL)
+	fdsmooth = Rast_open_old(smooth, "");
+
     ertot = 0.;
     cursegm = 0;
     G_message(_("Percent complete: "));



More information about the grass-commit mailing list