[GRASS-SVN] r62745 - grass/trunk/vector/v.neighbors

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 14 10:08:15 PST 2014


Author: neteler
Date: 2014-11-14 10:08:15 -0800 (Fri, 14 Nov 2014)
New Revision: 62745

Modified:
   grass/trunk/vector/v.neighbors/main.c
   grass/trunk/vector/v.neighbors/v.neighbors.html
Log:
v.neighbors: more reasonable warnings

Modified: grass/trunk/vector/v.neighbors/main.c
===================================================================
--- grass/trunk/vector/v.neighbors/main.c	2014-11-14 17:19:55 UTC (rev 62744)
+++ grass/trunk/vector/v.neighbors/main.c	2014-11-14 18:08:15 UTC (rev 62745)
@@ -8,7 +8,7 @@
  *               
  * PURPOSE:      Category manipulations
  *               
- * COPYRIGHT:    (C) 2001-2009 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2).  Read the file COPYING that
@@ -36,7 +36,7 @@
     struct Option *in_opt, *out_opt, *field_opt;
     struct Option *method_opt, *size_opt;
     struct Map_info In;
-    double radius, raster_res;
+    double radius, grid_res;
     struct boxlist *List;
     struct Cell_head region;
     struct bound_box box;
@@ -91,6 +91,10 @@
     G_get_set_window(&region);
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
+    grid_res = (region.ew_res + region.ns_res)/2.;
+    if ( atof(size_opt->answer) < grid_res)
+	G_warning(_("Neighborhood diameter smaller than cell resolution: %.1f < %.1f "),
+		  radius * 2., grid_res);
 
     result = Rast_allocate_buf(CELL_TYPE);
     Points = Vect_new_line_struct();
@@ -157,9 +161,8 @@
     Rast_close(out_fd);
 
     if (count_sum < 1) {
-	raster_res = (region.ew_res + region.ns_res)/2.;
-	G_warning(_("No points found (using raster resolution: %.1f, moving window size: %.1f)"),
-			raster_res, (box.E - box.W) * raster_res );
+	G_warning(_("No points found (using cell resolution: %.1f, neighborhood diameter: %.1f)"),
+			grid_res, radius * 2.);
 	G_message(_("You can calculate the distance statistics between the vector point using:\nv.univar -d %s"), in_opt->answer);
 	exit(EXIT_FAILURE);
     }

Modified: grass/trunk/vector/v.neighbors/v.neighbors.html
===================================================================
--- grass/trunk/vector/v.neighbors/v.neighbors.html	2014-11-14 17:19:55 UTC (rev 62744)
+++ grass/trunk/vector/v.neighbors/v.neighbors.html	2014-11-14 18:08:15 UTC (rev 62745)
@@ -10,7 +10,7 @@
 dataset):
 
 <div class="code"><pre>
-g.region vect=schools_wake res=10 -p
+g.region vect=schools_wake res=100 -p -a
 v.neighbors input=schools_wake output=schools_wake_3000m method=count size=3000
 
 d.mon wx0



More information about the grass-commit mailing list