[GRASS-SVN] r72335 - grass-addons/grass7/raster/r.resamp.tps

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 9 06:20:22 PST 2018


Author: mmetz
Date: 2018-03-09 06:20:22 -0800 (Fri, 09 Mar 2018)
New Revision: 72335

Modified:
   grass-addons/grass7/raster/r.resamp.tps/main.c
   grass-addons/grass7/raster/r.resamp.tps/tps.c
Log:
r.resamp.tps: show percent for global interpolation, message cosmetics

Modified: grass-addons/grass7/raster/r.resamp.tps/main.c
===================================================================
--- grass-addons/grass7/raster/r.resamp.tps/main.c	2018-03-09 13:37:05 UTC (rev 72334)
+++ grass-addons/grass7/raster/r.resamp.tps/main.c	2018-03-09 14:20:22 UTC (rev 72335)
@@ -260,13 +260,13 @@
 
     segsize = segsize * 64. * 64. / (1024. * 1024.);
     nsegs = segs_mb / segsize;
-    nsegs_total = ((nrows + 63) / 64) + ((ncols + 63) / 64);
-    G_message(_("Number of segments total %d, in memory %d"), nsegs_total, nsegs);
-    /* nsegs_total = nsegs + 1; */
 
     /* load input raster and corresponding covariables */
     G_message(_("Loading input..."));
 
+    nsegs_total = ((nrows + 63) / 64) * ((ncols + 63) / 64);
+    G_message(_("Total number of input segments %d, in memory %d"), nsegs_total, nsegs);
+
     insize = (1 + n_vars) * sizeof(DCELL);
     if (cache_create(&in_seg, nrows, ncols, 64, 64, 
                      insize, nsegs) != 1) {
@@ -327,9 +327,12 @@
     nrows = dst.rows;
     ncols = dst.cols;
 
+    nsegs_total = ((nrows + 63) / 64) * ((ncols + 63) / 64);
+    G_message(_("Total number of output segments %d, in memory %d"), nsegs_total, nsegs);
+
     if (cache_create(&out_seg, nrows, ncols, 64, 64, 
                      sizeof(struct tps_out), nsegs) != 1) {
-	G_fatal_error("Unable to create input temporary files");
+	G_fatal_error("Unable to create output temporary files");
     }
 
     if (n_vars) {
@@ -336,6 +339,7 @@
 
 	/* intialize output raster and load corresponding covariables */
 	G_message(_("Loading covariables for output..."));
+
 	varsize = (n_vars) * sizeof(DCELL);
 	if (cache_create(&var_seg, nrows, ncols, 64, 64, 
 			 varsize, nsegs) != 1) {

Modified: grass-addons/grass7/raster/r.resamp.tps/tps.c
===================================================================
--- grass-addons/grass7/raster/r.resamp.tps/tps.c	2018-03-09 13:37:05 UTC (rev 72334)
+++ grass-addons/grass7/raster/r.resamp.tps/tps.c	2018-03-09 14:20:22 UTC (rev 72335)
@@ -1123,10 +1123,20 @@
 	    if (icol2 > ncols - 1)
 		icol2 = ncols - 1;
 
+	    if (pfound == n_points) {
+		/* one global equation, one interpolation window */
+		irow1 = 0;
+		irow2 = nrows - 1;
+		icol1 = 0;
+		icol2 = ncols - 1;
+	    }
+
 	    dxi = icol2 - icol1 + 1;
 	    dyi = irow2 - irow1 + 1;
 
 	    for (irow = irow1; irow <= irow2; irow++) {
+		if (pfound == n_points)
+		    G_percent(irow - irow1, irow2 - irow1, 1);
 
 		i_n = dst->north - (irow + 0.5) * dst->ns_res;
 



More information about the grass-commit mailing list