[GRASS-SVN] r63820 - in grass/branches/releasebranch_7_0: . raster/r.ros raster/r.spread

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 29 05:10:02 PST 2014


Author: wenzeslaus
Date: 2014-12-29 05:10:02 -0800 (Mon, 29 Dec 2014)
New Revision: 63820

Modified:
   grass/branches/releasebranch_7_0/
   grass/branches/releasebranch_7_0/raster/r.ros/main.c
   grass/branches/releasebranch_7_0/raster/r.spread/main.c
Log:
r.ros and r.spread: replace basenames by separate options (backport r63777)


Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
   - /grass/trunk:60817,61096,61141,61994,62105,62179-62180,62182,62190,62403,62422,62424,62437,62466,62469,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62566,62570,62573,62575,62585,62588,62597,62603,62606,62608-62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62654-62657,62666,62691,62705,62709,62723,62730,62739,62741,62743,62746,62750-62752,62757,62762,62785,62798,62800-62801,62803,62805,62812,62822,62824,62828,62831,62838,62845,62847,62850,62856,62879,62881,62886,62904,62907-62908,62910,62912,62914,62916,62918,62920,62925,62932-62933,62935,62940,62942,62944-62946,62949,62955-62956,62958,62960,62962,62964,62966-62968,62970,62973,62975,62977,62981,62983,62985,62987,62989,62991,62993,62995,62997,62999-63000,63003,63005,63007,63009,63011,63013,63015,63017,63020,63022,63024,63026,63028-63031,63033,63035,63037,63040,63043-63044,63047,63049,63051,63053,63055,63057,63060,63062-63064,63066,63068,63070-63071,63074,
 63076,63079,63081,63083,63085,63087,63089,63091,63093,63095,63098,63100,63102,63105,63107,63109,63111,63113-63114,63116,63119,63121,63123,63125,63130,63132-63133,63135,63137,63140,63143,63145,63147,63149,63151,63153-63154,63157,63160,63165,63170,63173,63175,63187,63192-63193,63196,63199-63200,63202,63209,63216,63220-63221,63224,63227,63240,63246,63250,63255,63259,63261,63275-63276,63279,63281,63283,63287,63290,63292,63297,63302,63304-63307,63315,63319,63327,63330,63332,63339,63342,63345,63361-63363,63367,63379,63389,63391,63393,63402,63408-63409,63416-63417,63425,63427,63429,63431,63433,63448,63451,63453,63457,63459,63464-63470,63473,63482,63497,63505,63508,63510,63515,63521-63524,63526,63536-63537,63551-63552,63554,63556,63558-63559,63562,63570,63576,63582,63589-63593,63602,63604,63608-63609,63616,63618,63624,63626,63628,63630,63634,63639,63642,63644,63650,63652,63656,63679,63685,63689,63691,63693,63695,63698,63700-63702,63704,63706-63707,63709,63711,63713,63715,63717-63718
 ,63721-63727,63731,63733,63740-63742,63744,63747-63749,63751-63752,63756,63758,63761,63767,63780,63783,63787,63793,63796-63798,63801,63803,63807-63808,63812,63814,63816
   + /grass/trunk:60817,61096,61141,61994,62105,62179-62180,62182,62190,62403,62422,62424,62437,62466,62469,62487,62491,62494,62501,62506,62508-62509,62515,62518-62519,62521,62526,62533,62539,62541,62555,62562,62566,62570,62573,62575,62585,62588,62597,62603,62606,62608-62609,62614,62618,62628,62632,62638,62642,62648-62649,62652,62654-62657,62666,62691,62705,62709,62723,62730,62739,62741,62743,62746,62750-62752,62757,62762,62785,62798,62800-62801,62803,62805,62812,62822,62824,62828,62831,62838,62845,62847,62850,62856,62879,62881,62886,62904,62907-62908,62910,62912,62914,62916,62918,62920,62925,62932-62933,62935,62940,62942,62944-62946,62949,62955-62956,62958,62960,62962,62964,62966-62968,62970,62973,62975,62977,62981,62983,62985,62987,62989,62991,62993,62995,62997,62999-63000,63003,63005,63007,63009,63011,63013,63015,63017,63020,63022,63024,63026,63028-63031,63033,63035,63037,63040,63043-63044,63047,63049,63051,63053,63055,63057,63060,63062-63064,63066,63068,63070-63071,63074,
 63076,63079,63081,63083,63085,63087,63089,63091,63093,63095,63098,63100,63102,63105,63107,63109,63111,63113-63114,63116,63119,63121,63123,63125,63130,63132-63133,63135,63137,63140,63143,63145,63147,63149,63151,63153-63154,63157,63160,63165,63170,63173,63175,63187,63192-63193,63196,63199-63200,63202,63209,63216,63220-63221,63224,63227,63240,63246,63250,63255,63259,63261,63275-63276,63279,63281,63283,63287,63290,63292,63297,63302,63304-63307,63315,63319,63327,63330,63332,63339,63342,63345,63361-63363,63367,63379,63389,63391,63393,63402,63408-63409,63416-63417,63425,63427,63429,63431,63433,63448,63451,63453,63457,63459,63464-63470,63473,63482,63497,63505,63508,63510,63515,63521-63524,63526,63536-63537,63551-63552,63554,63556,63558-63559,63562,63570,63576,63582,63589-63593,63602,63604,63608-63609,63616,63618,63624,63626,63628,63630,63634,63639,63642,63644,63650,63652,63656,63679,63685,63689,63691,63693,63695,63698,63700-63702,63704,63706-63707,63709,63711,63713,63715,63717-63718
 ,63721-63727,63731,63733,63740-63742,63744,63747-63749,63751-63752,63756,63758,63761,63767,63777,63780,63783,63787,63793,63796-63798,63801,63803,63807-63808,63812,63814,63816

Modified: grass/branches/releasebranch_7_0/raster/r.ros/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.ros/main.c	2014-12-29 13:08:39 UTC (rev 63819)
+++ grass/branches/releasebranch_7_0/raster/r.ros/main.c	2014-12-29 13:10:02 UTC (rev 63820)
@@ -175,7 +175,7 @@
 	elev_fd = 0, slope_fd = 0, aspect_fd = 0,
 	base_fd = 0, max_fd = 0, maxdir_fd = 0, spotdist_fd = 0;
 
-    char name_base[60], name_max[60], name_maxdir[60], name_spotdist[60];
+    char *name_base, *name_max, *name_maxdir, *name_spotdist;
 
     CELL *fuel,			/*cell buffer for fuel model map layer */
      *mois_1h,			/*cell buffer for 1-hour fuel moisture map layer */
@@ -198,7 +198,7 @@
     {
 	struct Option *model,
 	    *mois_1h, *mois_10h, *mois_100h, *mois_live,
-	    *vel, *dir, *elev, *slope, *aspect, *output;
+            *vel, *dir, *elev, *slope, *aspect, *base, *max, *maxdir, *spotdist;
     } parm;
 
     /* please, remove before GRASS 7 released */
@@ -314,27 +314,55 @@
     parm.elev = G_define_standard_option(G_OPT_R_ELEV);
     parm.elev->required = NO;
     parm.elev->label =
-	_("Raster map containing elevation (m, required with -s)");
+	_("Raster map containing elevation (m, required for spotting)");
     parm.elev->description =
 	_("Name of an existing raster map "
 	  "layer in the user's current mapset search path containing elevation (meters). "
 	  "Option is required from spotting distance computation "
-	  "(when -s flag is enabled)");
+	  "(when spotting_distance option is provided)");
 
-    parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
-    parm.output->description =
-	_("Prefix for output raster maps (.base, .max, .maxdir, .spotdist)");
+    parm.base = G_define_standard_option(G_OPT_R_OUTPUT);
+    parm.base->key = "base_ros";
+    parm.base->required = YES;
+    parm.base->label =
+	_("Output raster map containing base ROS (cm/min)");
+    parm.base->description =
+	_("Base (perpendicular) rate of spread (ROS)");
 
-    flag_s = G_define_flag();
-    flag_s->key = 's';
-    flag_s->description = _("Also produce maximum spotting distance");
+    parm.max = G_define_standard_option(G_OPT_R_OUTPUT);
+    parm.max->key = "max_ros";
+    parm.max->required = YES;
+    parm.max->label =
+	_("Output raster map containing maximal ROS (cm/min)");
+    parm.max->description =
+	_("The maximum (forward) rate of spread (ROS)");
 
+    parm.maxdir = G_define_standard_option(G_OPT_R_OUTPUT);
+    parm.maxdir->key = "direction_ros";
+    parm.maxdir->required = YES;
+    parm.maxdir->label =
+	_("Output raster map containing directions of maximal ROS (degree)");
+    parm.maxdir->description =
+	_("The direction of the maximal (forward) rate of spread (ROS)");
+
+    parm.spotdist = G_define_standard_option(G_OPT_R_OUTPUT);
+    parm.spotdist->key = "spotting_distance";
+    parm.spotdist->required = NO;
+    parm.spotdist->label =
+	_("Output raster map containing maximal spotting distance (m)");
+    parm.spotdist->description =
+	_("The maximal potential spotting distance raster will be also generated"
+	  " (requires elevation raster map to be provided).");
+
     /*   Parse command line */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
-    
-    spotting = flag_s->answer;
 
+    if (parm.spotdist->answer)
+	spotting = 1;
+    else
+	spotting = 0;
+
     /*  Check if input layers exists in data base  */
     if (G_find_raster2(parm.model->answer, "") == NULL)
 	G_fatal_error(_("Raster map <%s> not found"), parm.model->answer);
@@ -417,9 +445,9 @@
     }
 
     /*assign names of the three output ROS layers */
-    sprintf(name_base, "%s.base", parm.output->answer);
-    sprintf(name_max, "%s.max", parm.output->answer);
-    sprintf(name_maxdir, "%s.maxdir", parm.output->answer);
+    name_base = parm.base->answer;
+    name_max = parm.max->answer;
+    name_maxdir = parm.maxdir->answer;
 
     /*check if the output layer names EXIST */
     if (G_check_overwrite(argc, argv) == 0) {
@@ -437,7 +465,7 @@
 	
 	/*assign a name to output SPOTTING distance layer */
 	if (spotting) {
-	    sprintf(name_spotdist, "%s.spotdist", parm.output->answer);
+	    name_spotdist = parm.spotdist->answer;
 	    if (G_find_raster2(name_spotdist, G_mapset()))
 		G_fatal_error(_("Raster map <%s> already exists in mapset <%s>"),
 			      name_spotdist, G_mapset());

Modified: grass/branches/releasebranch_7_0/raster/r.spread/main.c
===================================================================
--- grass/branches/releasebranch_7_0/raster/r.spread/main.c	2014-12-29 13:08:39 UTC (rev 63819)
+++ grass/branches/releasebranch_7_0/raster/r.spread/main.c	2014-12-29 13:10:02 UTC (rev 63820)
@@ -113,8 +113,22 @@
 	  "coordinates for tracing spread paths. "
 	  "Usable for fire spread simulations.");
 
+    parm.base = G_define_option();
+    parm.base->key = "base_ros";
+    parm.base->type = TYPE_STRING;
+    parm.base->required = YES;
+    parm.base->gisprompt = "old,cell,raster";
+    parm.base->guisection = _("Input");
+    parm.base->label =
+	_("Raster map containing base ROS (cm/min)");
+    parm.base->description =
+	_("Name of an existing raster map layer in the user's "
+	  "current mapset search path containing the ROS values in the directions "
+	  "perpendicular to maximum ROSes' (cm/minute). These ROSes are also the ones "
+	  "without the effect of directional factors.");
+    
     parm.max = G_define_option();
-    parm.max->key = "max";
+    parm.max->key = "max_ros";
     parm.max->type = TYPE_STRING;
     parm.max->required = YES;
     parm.max->gisprompt = "old,cell,raster";
@@ -126,7 +140,7 @@
 	  "mapset search path containing the maximum ROS values (cm/minute).");
 
     parm.dir = G_define_option();
-    parm.dir->key = "dir";
+    parm.dir->key = "direction_ros";
     parm.dir->type = TYPE_STRING;
     parm.dir->required = YES;
     parm.dir->gisprompt = "old,cell,raster";
@@ -138,20 +152,6 @@
 	  "current mapset search path containing directions of the maximum ROSes, "
 	  "clockwise from north (degree)."); /* TODO: clockwise from north? see r.ros */
 
-    parm.base = G_define_option();
-    parm.base->key = "base";
-    parm.base->type = TYPE_STRING;
-    parm.base->required = YES;
-    parm.base->gisprompt = "old,cell,raster";
-    parm.base->guisection = _("Input");
-    parm.base->label =
-	_("Raster map containing base ROS (cm/min)");
-    parm.base->description =
-	_("Name of an existing raster map layer in the user's "
-	  "current mapset search path containing the ROS values in the directions "
-	  "perpendicular to maximum ROSes' (cm/minute). These ROSes are also the ones "
-	  "without the effect of directional factors.");
-
     parm.start = G_define_option();
     parm.start->key = "start";
     parm.start->type = TYPE_STRING;
@@ -167,7 +167,7 @@
 	  "starting sources (seeds).");
 
     parm.spotdist = G_define_option();
-    parm.spotdist->key = "spot_dist";
+    parm.spotdist->key = "spotting_distance";
     parm.spotdist->type = TYPE_STRING;
     parm.spotdist->gisprompt = "old,cell,raster";
     parm.spotdist->guisection = _("Input");
@@ -179,7 +179,7 @@
 	  "spotting distances (meters).");
 
     parm.velocity = G_define_option();
-    parm.velocity->key = "w_speed";
+    parm.velocity->key = "wind_speed";
     parm.velocity->type = TYPE_STRING;
     parm.velocity->gisprompt = "old,cell,raster";
     parm.velocity->guisection = _("Input");
@@ -191,7 +191,7 @@
 	  "the average flame height (feet/minute).");
 
     parm.mois = G_define_option();
-    parm.mois->key = "f_mois";
+    parm.mois->key = "fuel_moisture";
     parm.mois->type = TYPE_STRING;
     parm.mois->gisprompt = "old,cell,raster";
     parm.mois->guisection = _("Input");



More information about the grass-commit mailing list