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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 15 13:41:43 PST 2017


Author: mmetz
Date: 2017-01-15 13:41:43 -0800 (Sun, 15 Jan 2017)
New Revision: 70377

Modified:
   grass-addons/grass7/raster/r.resamp.tps/main.c
   grass-addons/grass7/raster/r.resamp.tps/tps.c
Log:
r.resamp.tps: fix option to avoid extrapolation when using covariables

Modified: grass-addons/grass7/raster/r.resamp.tps/main.c
===================================================================
--- grass-addons/grass7/raster/r.resamp.tps/main.c	2017-01-15 15:03:06 UTC (rev 70376)
+++ grass-addons/grass7/raster/r.resamp.tps/main.c	2017-01-15 21:41:43 UTC (rev 70377)
@@ -134,7 +134,7 @@
     lm_opt->label =
 	_("Threshold to avoid interpolation outliers when using covariables");
     lm_opt->description =
-	_("Disabled when set to zero, larger values will cause more outliers");
+	_("Disabled when set to zero, must be within [0, 1], larger values will cause more outliers");
     lm_opt->guisection = _("Settings");
 
     ep_opt = G_define_option();
@@ -145,7 +145,7 @@
     ep_opt->label =
 	_("Threshold to avoid extrapolation when using covariables");
     ep_opt->description =
-	_("Disabled when set to zero, smaller values will cause more outliers");
+	_("Disabled when set to zero, must be > 0, smaller values will cause more outliers");
     ep_opt->guisection = _("Settings");
 
     out_opt = G_define_standard_option(G_OPT_R_OUTPUT);
@@ -155,7 +155,7 @@
     mask_opt = G_define_standard_option(G_OPT_R_INPUT);
     mask_opt->key = "mask";
     mask_opt->label = _("Raster map to use for masking");
-    mask_opt->description = _("Only cells that are not NULL and not zero are interpolated");
+    mask_opt->description = _("Only cells where the mask map is not NULL and not zero are interpolated");
     mask_opt->required = NO;
 
     mem_opt = G_define_option();

Modified: grass-addons/grass7/raster/r.resamp.tps/tps.c
===================================================================
--- grass-addons/grass7/raster/r.resamp.tps/tps.c	2017-01-15 15:03:06 UTC (rev 70376)
+++ grass-addons/grass7/raster/r.resamp.tps/tps.c	2017-01-15 21:41:43 UTC (rev 70377)
@@ -1029,8 +1029,6 @@
 			    vmin[i] -= diff;
 			    vmax[i] += diff;
 			}
-
-			solved_tps = solvemat(mpnts, apnts, Bpnts, pfound + 1);
 		    }
 
 		    if (!solved_tps_lm) {
@@ -1038,8 +1036,8 @@
 			m = mpnts;
 			a = apnts;
 			B = Bpnts;
-			if (efac == 0)
-			    solved_tps = solvemat(m, a, B, pfound + 1);
+
+			solved_tps = solvemat(m, a, B, pfound + 1);
 		    }
 		}
 		else {
@@ -1180,12 +1178,16 @@
 			    continue;
 			}
 
-			if (efac && solved_tps) {
+			if (efac) {
 			    for (i = 0; i < n_vars_i; i++) {
 				if (varbuf[i] < vmin[i] || varbuf[i] > vmax[i]) {
-				    n_vars_ic = 0;
-				    cnt_efac++;
-				    Bc = Bpnts;
+				    if (!solved_tps)
+					solved_tps = solvemat(mpnts, apnts, Bpnts, pfound + 1);
+				    if (solved_tps) {
+					n_vars_ic = 0;
+					Bc = Bpnts;
+					cnt_efac++;
+				    }
 				    break;
 				}
 			    }
@@ -1211,7 +1213,7 @@
 			dist = 0;
 			if (dist2 > 0) {
 			    dist = dist2 * log(dist2) * 0.5;
-			    result += Bc[1 + n_vars_i + i] * dist;
+			    result += Bc[1 + n_vars_ic + i] * dist;
 			}
 		    }
 



More information about the grass-commit mailing list