[GRASS-SVN] r58074 - grass/trunk/raster/r.topmodel

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 20 05:32:28 PDT 2013


Author: hcho
Date: 2013-10-20 05:32:28 -0700 (Sun, 20 Oct 2013)
New Revision: 58074

Modified:
   grass/trunk/raster/r.topmodel/main.c
Log:
Preprocess only flag (-p) added

Modified: grass/trunk/raster/r.topmodel/main.c
===================================================================
--- grass/trunk/raster/r.topmodel/main.c	2013-10-20 12:19:10 UTC (rev 58073)
+++ grass/trunk/raster/r.topmodel/main.c	2013-10-20 12:32:28 UTC (rev 58074)
@@ -37,6 +37,10 @@
 	struct Option *ntopidxclasses;
 	struct Option *outtopidxstats;
     } params;
+    struct
+    {
+	struct Flag *preprocess;
+    } flags;
 
     /* Initialize GRASS and parse command line */
     G_gisinit(argv[0]);
@@ -89,7 +93,7 @@
     params.topidx->label =
 	_("Name of input topographic index ln(a/tanB) raster map");
     params.topidx->description =
-	    _("Must be clipped to the catchment boundary. Used for generating outtopidxstats.");
+	_("Must be clipped to the catchment boundary. Used for generating outtopidxstats.");
     params.topidx->required = NO;
     params.topidx->guisection = _("Preprocess");
 
@@ -97,7 +101,7 @@
     params.ntopidxclasses->key = "ntopidxclasses";
     params.ntopidxclasses->label = _("Number of topographic index classes");
     params.ntopidxclasses->description =
-	    _("Used for generating outtopidxstats.");
+	_("Used for generating outtopidxstats.");
     params.ntopidxclasses->type = TYPE_INTEGER;
     params.ntopidxclasses->required = NO;
     params.ntopidxclasses->answer = "30";
@@ -108,10 +112,16 @@
     params.outtopidxstats->label =
 	_("Name for output topographic index statistics file");
     params.outtopidxstats->description =
-	    _("Requires topidx and ntopidxclasses.");
+	_("Requires topidx and ntopidxclasses.");
     params.outtopidxstats->required = NO;
     params.outtopidxstats->guisection = _("Preprocess");
 
+    flags.preprocess = G_define_flag();
+    flags.preprocess->key = 'p';
+    flags.preprocess->description =
+	_("Preprocess only and stop after generating outtopidxstats");
+    flags.preprocess->suppress_required = YES;
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -149,6 +159,9 @@
 	G_warning(_("Ignoring outtopidxstats because topidx is not specified."));
     }
 
+    if (flags.preprocess->answer)
+        exit(EXIT_SUCCESS);
+
     /* Read required files */
     read_input();
 
@@ -158,5 +171,5 @@
     /* Write outputs */
     write_output();
 
-    exit(0);
+    exit(EXIT_SUCCESS);
 }



More information about the grass-commit mailing list