[GRASS-SVN] r31231 - grass/branches/develbranch_6/raster/r.slope.aspect

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 3 07:04:06 EDT 2008


Author: martinl
Date: 2008-05-03 07:04:06 -0400 (Sat, 03 May 2008)
New Revision: 31231

Modified:
   grass/branches/develbranch_6/raster/r.slope.aspect/main.c
   grass/branches/develbranch_6/raster/r.slope.aspect/opennew.c
Log:
r.slope.aspect: message cleaning, i18n

Modified: grass/branches/develbranch_6/raster/r.slope.aspect/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.slope.aspect/main.c	2008-05-03 10:57:02 UTC (rev 31230)
+++ grass/branches/develbranch_6/raster/r.slope.aspect/main.c	2008-05-03 11:04:06 UTC (rev 31231)
@@ -149,18 +149,13 @@
     G_gisinit (argv[0]);
 
     module = G_define_module();
-    module->keywords = _("raster");
+    module->keywords = _("raster, terrain analysis");
     module->description =
 	_("Generates raster map layers of slope, aspect, curvatures and "
 	  "partial derivatives from a raster map layer of true elevation "
 	  "values. Aspect is calculated counterclockwise from east.");
 
-    parm.elevation = G_define_option() ;
-    parm.elevation->key        = "elevation" ;
-    parm.elevation->type       = TYPE_STRING ;
-    parm.elevation->required   = YES ;
-    parm.elevation->gisprompt  = "old,cell,raster" ;
-    parm.elevation->description= _("Raster elevation file name");
+    parm.elevation = G_define_standard_option(G_OPT_R_ELEV) ;
 
     parm.slope = G_define_option() ;
     parm.slope->key        = "slope" ;
@@ -168,7 +163,7 @@
     parm.slope->required   = NO ;
     parm.slope->answer     = NULL ;
     parm.slope->gisprompt  = "new,cell,raster" ;
-    parm.slope->description= _("Output slope filename") ;
+    parm.slope->description= _("Name for output slope raster map") ;
 
     parm.aspect = G_define_option() ;
     parm.aspect->key        = "aspect" ;
@@ -176,7 +171,7 @@
     parm.aspect->required   = NO ;
     parm.aspect->answer     = NULL ;
     parm.aspect->gisprompt  = "new,cell,raster" ;
-    parm.aspect->description= _("Output aspect filename") ;
+    parm.aspect->description= _("Name for output aspect raster map") ;
 
     parm.slope_fmt = G_define_option() ;
     parm.slope_fmt->key        = "format" ;
@@ -202,7 +197,7 @@
     parm.pcurv->required   = NO ;
     parm.pcurv->answer     = NULL ;
     parm.pcurv->gisprompt  = "new,cell,raster" ;
-    parm.pcurv->description= _("Output profile curvature filename" );
+    parm.pcurv->description= _("Name for output profile curvature raster map" );
     parm.pcurv->guisection = _("Advanced");
 
     parm.tcurv = G_define_option() ;
@@ -211,7 +206,7 @@
     parm.tcurv->required   = NO ;
     parm.tcurv->answer     = NULL ;
     parm.tcurv->gisprompt  = "new,cell,raster" ;
-    parm.tcurv->description= _("Output tangential curvature filename") ;
+    parm.tcurv->description= _("Name for output tangential curvature raster map") ;
     parm.tcurv->guisection = _("Advanced");
 
     parm.dx = G_define_option() ;
@@ -220,7 +215,7 @@
     parm.dx->required   = NO ;
     parm.dx->answer     = NULL ;
     parm.dx->gisprompt  = "new,cell,raster" ;
-    parm.dx->description= _("Output first order partial derivative dx (E-W slope) filename") ;
+    parm.dx->description= _("Name for output first order partial derivative dx (E-W slope) raster map") ;
     parm.dx->guisection = _("Advanced");
 
     parm.dy = G_define_option() ;
@@ -229,7 +224,7 @@
     parm.dy->required   = NO ;
     parm.dy->answer     = NULL ;
     parm.dy->gisprompt  = "new,cell,raster" ;
-    parm.dy->description= _("Output first order partial derivative dy (N-S slope) filename") ;
+    parm.dy->description= _("Name for output first order partial derivative dy (N-S slope) raster map") ;
     parm.dy->guisection = _("Advanced");
 
     parm.dxx = G_define_option() ;
@@ -238,7 +233,7 @@
     parm.dxx->required   = NO ;
     parm.dxx->answer     = NULL ;
     parm.dxx->gisprompt  = "new,cell,raster" ;
-    parm.dxx->description= _("Output second order partial derivative dxx filename") ;
+    parm.dxx->description= _("Name for output second order partial derivative dxx raster map") ;
     parm.dxx->guisection = _("Advanced");
 
     parm.dyy = G_define_option() ;
@@ -247,7 +242,7 @@
     parm.dyy->required   = NO ;
     parm.dyy->answer     = NULL ;
     parm.dyy->gisprompt  = "new,cell,raster" ;
-    parm.dyy->description= _("Output second order partial derivative dyy filename") ;
+    parm.dyy->description= _("Name for output second order partial derivative dyy raster map") ;
     parm.dyy->guisection = _("Advanced");
 
     parm.dxy = G_define_option() ;
@@ -256,7 +251,7 @@
     parm.dxy->required   = NO ;
     parm.dxy->answer     = NULL ;
     parm.dxy->gisprompt  = "new,cell,raster" ;
-    parm.dxy->description= _("Output second order partial derivative dxy filename") ;
+    parm.dxy->description= _("Name for output second order partial derivative dxy raster map") ;
     parm.dxy->guisection = _("Advanced");
 
     parm.zfactor = G_define_option();
@@ -345,18 +340,14 @@
 
     if (sscanf (parm.zfactor->answer, "%lf", &zfactor) != 1 || zfactor <= 0.0)
     {
-        G_warning("%s=%s - must be a postive number", parm.zfactor->key,
-                       parm.zfactor->answer);
-        G_usage();
-        exit(EXIT_FAILURE);
+	G_fatal_error(_("%s=%s - must be a positive number"), parm.zfactor->key,
+		      parm.zfactor->answer);
     }
 
     if (sscanf (parm.min_slp_allowed->answer, "%lf", &min_slp_allowed) != 1 || min_slp_allowed < 0.0)
     {
-        G_warning("%s=%s - must be a non-negative number", parm.min_slp_allowed->key,
-                       parm.min_slp_allowed->answer);
-        G_usage();
-        exit(EXIT_FAILURE);
+        G_fatal_error(_("%s=%s - must be a non-negative number"), parm.min_slp_allowed->key,
+		      parm.min_slp_allowed->answer);
     }
 
     slope_fmt = parm.slope_fmt->answer;
@@ -368,13 +359,11 @@
 	&& dx_name == NULL && dy_name == NULL 
 	&& dxx_name == NULL && dyy_name == NULL && dxy_name == NULL)
     {
-	G_warning("You must specify at least one of the parameters:"
-		"\n<%s>, <%s>, <%s>, <%s>, <%s>, <%s>, <%s>, <%s> or <%s>.\n", 
-		parm.slope->key, parm.aspect->key, parm.pcurv->key, 
-		parm.tcurv->key, parm.dx->key, parm.dy->key, 
-		parm.dxx->key, parm.dyy->key, parm.dxy->key);
-	G_usage();
-	exit(EXIT_FAILURE);
+	G_fatal_error(_("You must specify at least one of the parameters: "
+			"<%s>, <%s>, <%s>, <%s>, <%s>, <%s>, <%s>, <%s> or <%s>"), 
+		      parm.slope->key, parm.aspect->key, parm.pcurv->key, 
+		      parm.tcurv->key, parm.dx->key, parm.dy->key, 
+		      parm.dxx->key, parm.dyy->key, parm.dxy->key);
     }
 
     /* check elevation file existence */
@@ -402,7 +391,7 @@
    else if(strcmp(parm.out_precision->answer, "default") == 0)
        out_type = -1;
    else
-        G_fatal_error(_("wrong type: %s"), parm.out_precision->answer);
+        G_fatal_error(_("Wrong raster type: %s"), parm.out_precision->answer);
 
    data_type = out_type;
    if(data_type < 0) data_type = DCELL_TYPE;
@@ -431,7 +420,7 @@
    /* give warning if location units are different from meters and zfactor=1*/
     factor = G_database_units_to_meters_factor();
     if (factor != 1.0)
-        G_warning("Converting units to meters, factor=%.6f", factor);
+        G_warning(_("Converting units to meters, factor=%.6f"), factor);
 
     G_begin_distance_calculations();
     north = G_row_to_northing(0.5, &window);
@@ -606,7 +595,8 @@
     }
     else G_get_d_raster_row_nomask (elevation_fd, elev_cell[2],1);
 
-    G_message (_("Percent complete: "));
+    G_verbose_message (_("Percent complete..."));
+
     for (row = 2; row < nrows; row++)
     {
         /*  if projection is Lat/Lon, recalculate  V and H   */
@@ -1032,10 +1022,10 @@
     G_percent (row, nrows, 2);
 
     G_close_cell (elevation_fd);
-    G_message(_("Creating support files..."));
+    G_debug(1, "Creating support files...");
 
-    G_message(_("Elevation products for mapset [%s] in [%s]"),
-        G_mapset(), G_location());
+    G_verbose_message(_("Elevation products for mapset <%s> in <%s>"),
+		       G_mapset(), G_location());
 
     if (aspect_fd >= 0)
     {
@@ -1052,7 +1042,7 @@
         G_read_raster_cats (aspect_name, G_mapset(), &cats);
         G_set_raster_cats_title ("Aspect counterclockwise in degrees from east", &cats);
 
-	G_message(_("Min computed aspect %.4f, max computed aspect %.4f"), min_asp, max_asp);
+	G_verbose_message(_("Min computed aspect %.4f, max computed aspect %.4f"), min_asp, max_asp);
 	/* the categries quant intervals are 1.0 long, plus
 	   we are using reverse order so that the label looked up
 	   for i-.5 is not the one defined for i-.5, i+.5 interval, but
@@ -1105,7 +1095,7 @@
         hist.edlinecnt = 3;
         G_write_history (aspect_name, &hist);
 
-        G_message(_("ASPECT [%s] COMPLETE"), aspect_name);
+        G_message(_("Aspect raster map <%s> complete"), aspect_name);
     }
 
     if (slope_fd >= 0)
@@ -1145,7 +1135,7 @@
         if(deg) G_set_raster_cats_title ("slope in degrees", &cats);
         else if(perc) G_set_raster_cats_title ("percent slope", &cats);
 
-	G_message(_("Min computed slope %.4f, max computed slope %.4f"), min_slp, max_slp);
+	G_verbose_message(_("Min computed slope %.4f, max computed slope %.4f"), min_slp, max_slp);
 	/* the categries quant intervals are 1.0 long, plus
 	   we are using reverse order so that the label looked up
 	   for i-.5 is not the one defined for i-.5, i+.5 interval, but
@@ -1195,7 +1185,7 @@
         hist.edlinecnt = 3;
         G_write_history (slope_name, &hist);
 
-        G_message(_("SLOPE [%s] COMPLETE"), slope_name);
+        G_message(_("Slope raster map <%s> complete"), slope_name);
     }
 
     /* colortable for curvatures */
@@ -1264,7 +1254,7 @@
         hist.edlinecnt = 3;
         G_write_history (pcurv_name, &hist);
 
-        G_message(_("PROFILE CURVE [%s] COMPLETE"), pcurv_name);
+        G_message(_("Profile curve raster map <%s> complete"), pcurv_name);
     }
 
     if (tcurv_fd >= 0)
@@ -1291,7 +1281,7 @@
         hist.edlinecnt = 3;
         G_write_history (tcurv_name, &hist);
 
-        G_message(_("TANGENTIAL CURVE [%s] COMPLETE"), tcurv_name);
+        G_message(_("Tangential curve raster map <%s> complete"), tcurv_name);
     }   
 
     if (dx_fd >= 0)
@@ -1316,7 +1306,7 @@
         hist.edlinecnt = 3;
         G_write_history (dx_name, &hist);
 
-        G_message(_("E-W SLOPE [%s] COMPLETE"), dx_name);
+        G_message(_("E-W slope raster map <%s> complete"), dx_name);
     }   
 
     if (dy_fd >= 0)
@@ -1341,7 +1331,7 @@
         hist.edlinecnt = 3;
         G_write_history (dy_name, &hist);
 
-        G_message(_("N-S SLOPE [%s] COMPLETE"), dy_name);
+        G_message(_("N-S slope raster map <%s> complete"), dy_name);
     }   
 
     if (dxx_fd >= 0)
@@ -1366,7 +1356,7 @@
         hist.edlinecnt = 3;
         G_write_history (dxx_name, &hist);
 
-        G_message(_("DXX [%s] COMPLETE"), dxx_name);
+        G_message(_("Dxx raster map <%s> complete"), dxx_name);
     }   
 
     if (dyy_fd >= 0)
@@ -1391,7 +1381,7 @@
         hist.edlinecnt = 3;
         G_write_history (dyy_name, &hist);
 
-        G_message(_("DYY [%s] COMPLETE"), dyy_name);
+        G_message(_("Dyy raster map <%s> complete"), dyy_name);
     }   
 
     if (dxy_fd >= 0)
@@ -1416,7 +1406,7 @@
         hist.edlinecnt = 3;
         G_write_history (dxy_name, &hist);
 
-        G_message(_("DXY [%s] COMPLETE"), dxy_name);
+        G_message(_("Dxy raster map <%s> complete"), dxy_name);
     }   
 
     exit(EXIT_SUCCESS);

Modified: grass/branches/develbranch_6/raster/r.slope.aspect/opennew.c
===================================================================
--- grass/branches/develbranch_6/raster/r.slope.aspect/opennew.c	2008-05-03 10:57:02 UTC (rev 31230)
+++ grass/branches/develbranch_6/raster/r.slope.aspect/opennew.c	2008-05-03 11:04:06 UTC (rev 31231)
@@ -16,7 +16,7 @@
        fd = G_open_raster_new (name, wr_type);
 
     if (fd < 0)
-	G_fatal_error (_("Failed in attempt to open %s"), name);
+	G_fatal_error (_("Unable to create raster map <%s>"), name);
 
     return fd;
 }



More information about the grass-commit mailing list