[GRASS-SVN] r70963 - grass-addons/grass7/raster/r.pi/r.pi.enn

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 26 23:50:00 PDT 2017


Author: mmetz
Date: 2017-04-26 23:50:00 -0700 (Wed, 26 Apr 2017)
New Revision: 70963

Modified:
   grass-addons/grass7/raster/r.pi/r.pi.enn/main.c
   grass-addons/grass7/raster/r.pi/r.pi.enn/r.pi.enn.html
Log:
r.pi.enn: do not silently overwrite

Modified: grass-addons/grass7/raster/r.pi/r.pi.enn/main.c
===================================================================
--- grass-addons/grass7/raster/r.pi/r.pi.enn/main.c	2017-04-27 02:18:39 UTC (rev 70962)
+++ grass-addons/grass7/raster/r.pi/r.pi.enn/main.c	2017-04-27 06:50:00 UTC (rev 70963)
@@ -193,7 +193,7 @@
 	_("Set for 8 cell-neighbors. 4 cell-neighbors are default");
 
     if (G_parser(argc, argv))
-	    exit(EXIT_FAILURE);
+	exit(EXIT_FAILURE);
 
     /* get names of input files */
     oldname = parm.input->answer;
@@ -290,6 +290,7 @@
 
 	G_percent(row, nrows, 2);
     }
+    G_percent(1, 1, 2);
     Rast_close(in_fd);
 
     /* find fragments */
@@ -327,6 +328,9 @@
 	    /* open the new cellfile */
 	    sprintf(fullname, "%s.NN%d.%s", newname, parseres[j],
 		    menu[methods[m]].name);
+	    if (module->overwrite == 0 && G_find_raster(fullname, G_mapset()) != NULL)
+		G_fatal_error(_("Output raster <%s> exists. To overwrite, use the --overwrite flag"),
+			      fullname);
 	    out_fd = Rast_open_new(fullname, DCELL_TYPE);
 	    if (out_fd < 0)
 	        G_fatal_error(_("Cannot create raster map <%s>"), fullname);

Modified: grass-addons/grass7/raster/r.pi/r.pi.enn/r.pi.enn.html
===================================================================
--- grass-addons/grass7/raster/r.pi/r.pi.enn/r.pi.enn.html	2017-04-27 02:18:39 UTC (rev 70962)
+++ grass-addons/grass7/raster/r.pi/r.pi.enn/r.pi.enn.html	2017-04-27 06:50:00 UTC (rev 70963)
@@ -104,7 +104,7 @@
 r.pi.enn input=landclass96 output=dist10.c5 keyval=5 method=distance number=10 statmethod=average 
 # -> gives a map of patches (all of category of 5) with the average distance to their first-10th NN
 
-r.pi.enn input=landclass96 output=dist1.5.10,c5 keyval=5 method=distance number=1,5,10 statmethod=average 
+r.pi.enn input=landclass96 output=dist1.5.10.c5 keyval=5 method=distance number=1,5,10 statmethod=average 
 # -> gives a map of patches (all of category of 5) with the average distance to their first, first-to-fifth and first-to-10th NN
 
 r.pi.enn input=landclass96 output=dist10b.c5 keyval=5 method=path_distance number=10 statmethod=average 



More information about the grass-commit mailing list