[GRASS-SVN] r44519 - grass/branches/releasebranch_6_4/vector/v.surf.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 2 08:05:53 EST 2010


Author: neteler
Date: 2010-12-02 05:05:53 -0800 (Thu, 02 Dec 2010)
New Revision: 44519

Modified:
   grass/branches/releasebranch_6_4/vector/v.surf.rst/description.html
   grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c
Log:
z-coordinate and zcol support backported

Modified: grass/branches/releasebranch_6_4/vector/v.surf.rst/description.html
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.surf.rst/description.html	2010-12-02 12:59:06 UTC (rev 44518)
+++ grass/branches/releasebranch_6_4/vector/v.surf.rst/description.html	2010-12-02 13:05:53 UTC (rev 44519)
@@ -1,9 +1,9 @@
 <h2>DESCRIPTION</h2>
 
 <em>v.surf.rst</em>
-<br>This program performs spatial approximation based on z-values (<em>layer=0</em>
-parameter) or attributes (<em>zcolumn</em> parameter) of point or isoline data 
-given in a vector map named <em>input</em> to grid cells in the output 
+<br>This program performs spatial approximation based on z-values (<em>-z</em> flag
+or <em>layer=0</em> parameter) or attributes (<em>zcolumn</em> parameter) 
+of point or isoline data given in a vector map named <em>input</em> to grid cells in the output 
 raster map <em>elev</em> representing a surface. As an option, simultaneously
 with approximation, topographic parameters slope, aspect, profile curvature
 (measured in the direction of the steepest slope), tangential curvature (measured
@@ -13,8 +13,9 @@
 outputs partial derivatives f<sub>x</sub>,f<sub>y</sub>,f<sub>xx</sub>,
 f<sub>yy</sub>,f<sub>xy</sub>
 instead of slope, aspect, profile, tangential and mean curvatures respectively.
+<!-- the feature below has been lost when switch was made from sites to vector points)
 If the input data have time stamp, the program creates time stamp for all
-output files.
+output files. -->
 
 <p>
 User can define a raster map named <em>maskmap</em>, which will be used

Modified: grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c	2010-12-02 12:59:06 UTC (rev 44518)
+++ grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c	2010-12-02 13:05:53 UTC (rev 44519)
@@ -24,7 +24,9 @@
  * modified by Mitasova in August 1995
  * modified by Mitasova in November 1999 (dmax, timestamp update)
  * dnorm independent tension - -t flag
- * cross-validation -v flag by Jaro Hofierka 2004
+ * cross-validation -v flag (changed to -c)  by Jaro Hofierka 2004
+ * use z-coordinates flag -z July 2009, Helena
+ * 
  */
 
 #include <stdio.h>
@@ -54,6 +56,7 @@
 double /* pargr */ ns_res, ew_res;
 double dmin, dmax, ertre;
 int KMAX2, KMIN, KMAX, totsegm, deriv, dtens, cv;
+int zcoord;
 struct Map_info Map;
 struct Map_info TreeMap, OverMap;
 struct Categories cats;
@@ -151,7 +154,7 @@
     } parm;
     struct
     {
-	struct Flag *deriv, *cprght, *cv;
+	struct Flag *deriv, *cprght, *cv, *zcoord;
     } flag;
 
 
@@ -183,6 +186,11 @@
     sprintf(dmaxchar, "%f", dmin * 5);
     sprintf(dminchar, "%f", dmin);
 
+    flag.zcoord = G_define_flag();
+    flag.zcoord->key = 'z';
+    flag.zcoord->description =
+        _("Use z-coordinates (3D vector only)");
+    flag.zcoord->guisection = _("Selection");
 
     flag.cv = G_define_flag();
     flag.cv->key = 'c';
@@ -374,11 +382,9 @@
     parm.scalex->description = _("Anisotropy scaling factor");
     parm.scalex->guisection = _("Parameters");
 
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
-
     per = 1;
     input = parm.input->answer;
     field = atoi(parm.field->answer);
@@ -429,15 +435,22 @@
 	&& (cvdev == NULL))
 	G_warning(_("You are not outputting any raster or vector maps"));
 
+    deriv = flag.deriv->answer;
+    dtens = flag.cprght->answer;
+    cv = flag.cv->answer;
+    zcoord = flag.zcoord->answer;
+
+    if (zcoord) {
+        field = 0;
+        G_message("Using z-coordinate for interpolation");
+    }
+
     if (parm.wheresql->answer != NULL) {
 	if (field < 1)
 	    G_fatal_error(_("'layer' must be > 0 for 'where'."));
     }
     cond2 = ((pcurv != NULL) || (tcurv != NULL) || (mcurv != NULL));
     cond1 = ((slope != NULL) || (aspect != NULL) || cond2);
-    deriv = flag.deriv->answer;
-    dtens = flag.cprght->answer;
-    cv = flag.cv->answer;
 
     if ((cv && cvdev == NULL) || (!(cv) && cvdev != NULL))
 	G_fatal_error(_("Both cross-validation options (-c flag and cvdev vector output) must be specified"));
@@ -445,6 +458,13 @@
     if ((elev != NULL || cond1 || cond2 || devi != NULL) && cv)
 	G_fatal_error(_("The cross-validation cannot be computed simultaneously with output raster or devi file"));
 
+    if (field == 0 && zcol)
+        G_fatal_error(_("Both z-coordinate and zcol attribute defined, only one is allowed"));
+    if (!zcoord && !zcol && scol)
+        G_fatal_error(_("Only smoothing column defined, zcol or -z flag is missing")); 
+    if (!zcol && !zcoord && field > 0)
+        G_fatal_error("Value to be interpolated needs to be defined by zcol or -z flag");
+
     ertre = 0.1;
     sscanf(parm.dmax->answer, "%lf", &dmax);
     sscanf(parm.dmin->answer, "%lf", &dmin);



More information about the grass-commit mailing list