[GRASS-SVN] r43588 - grass/branches/releasebranch_6_4/raster/r.terraflow

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 21 09:30:19 EDT 2010


Author: neteler
Date: 2010-09-21 13:30:18 +0000 (Tue, 21 Sep 2010)
New Revision: 43588

Modified:
   grass/branches/releasebranch_6_4/raster/r.terraflow/grass2str.h
   grass/branches/releasebranch_6_4/raster/r.terraflow/main.cc
Log:
backport: i18N

Modified: grass/branches/releasebranch_6_4/raster/r.terraflow/grass2str.h
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.terraflow/grass2str.h	2010-09-21 13:27:50 UTC (rev 43587)
+++ grass/branches/releasebranch_6_4/raster/r.terraflow/grass2str.h	2010-09-21 13:30:18 UTC (rev 43588)
@@ -21,6 +21,7 @@
 #define _gras2str_H
 
 #include <grass/iostream/ami.h>
+#include <grass/glocale.h>
 #include "option.h"
 #include "types.h"
 #include "common.h"
@@ -48,21 +49,20 @@
   { 
     char * foo;
     str->name(&foo); 
-    *stats << "reading raster map " << cellname 
-		   << "to stream " << foo << endl;
-    if (opt->verbose) 
-      fprintf(stderr, "reading data from %s to stream %s: ", cellname, foo);
+    *stats << "Reading raster map <" << cellname 
+		   << "> to stream <" << foo << ">." << endl;
+    G_verbose_message(_("Reading data from <%s> to stream <%s>"), cellname, foo);
   }
-  
+
   char *mapset;
   mapset = G_find_cell (cellname, "");
   if (mapset == NULL)
-    G_fatal_error (_("Raster map <%s> not found"), cellname);
+    G_fatal_error(_("Raster map <%s> not found"), cellname);
   
   /* open map */
   int infd;
   if ( (infd = G_open_cell_old (cellname, mapset)) < 0)
-    G_fatal_error (_("Unable to open raster map <%s>"), cellname);
+    G_fatal_error(_("Unable to open raster map <%s>"), cellname);
   
   /* determine map type (CELL/FCELL/DCELL) */
   RASTER_MAP_TYPE data_type;
@@ -82,7 +82,7 @@
 	
 	/* read input map */
     if (G_get_raster_row (infd, inrast, i, data_type) < 0)
-      G_fatal_error (_("Unable to read raster map <%s>, row %d"),cellname, i);
+      G_fatal_error(_("Unable to read raster map <%s>, row %d"),cellname, i);
   
 	for (int j=0; j<ncols; j++) {
 
@@ -119,9 +119,9 @@
 	  } else {
 		/* check range */
 		if ((d > (DCELL)T_max_value) || (d < (DCELL)T_min_value)) {
-		  fprintf(stderr, "reading raster map %s at (i=%d,j=%d) value=%.1f\n",
-				  cellname, i, j, d);
-		  G_fatal_error("value out of range.");
+		  G_fatal_error("Value out of range, reading raster map <%s> "
+				"at (i=%d, j=%d) value=%.1f",
+				cellname, i, j, d);
 		}
 	  }  
 	  /* write x to stream */
@@ -140,7 +140,9 @@
   G_free(inrast);
   /* close map files */
   G_close_cell (infd);
-  
+
+  G_debug(3, "nrows=%d   ncols=%d    stream_len()=%d", nrows, ncols,
+		str->stream_len());  
   assert(nrows * ncols == str->stream_len());
   rt_stop(rt);
   stats->recordTime("reading raster map", rt);
@@ -168,15 +170,15 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << " to raster map  " << cellname << "\n";
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">.\n";
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
 
   /* open output raster map */
   int outfd;
-  if ( (outfd = G_open_raster_new (cellname, mtype)) < 0) {
+  if ( (outfd = G_open_raster_new (cellname, mtype)) < 0)
     G_fatal_error (_("Unable to create raster map <%s>"), cellname);
-  }
+
   
   /* Allocate output buffer */
   unsigned char *outrast;
@@ -191,8 +193,8 @@
 	  ae = str->read_item(&elt);
 	  if (ae != AMI_ERROR_NO_ERROR) {
 		str->sprint();
-		fprintf(stderr, "reading stream failed at (%d,%d)\n", i,j);
-		G_fatal_error("stream2cell failed");
+		G_fatal_error(_("stream2cell: Reading stream failed at (%d,%d)"),
+				i, j);
 	  }
 
 	  /* WRITE VALUE */
@@ -212,7 +214,7 @@
 
   } /* for j*/
   if (G_put_raster_row (outfd, outrast, mtype) < 0)
-    G_fatal_error ("Cannot write to <%s>",cellname);
+    G_fatal_error(_("Cannot write to <%s>"), cellname);
 
   G_percent(i, nrows, 2);
   }/* for i */
@@ -253,14 +255,14 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "cellfile  " << cellname << endl;
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
   
   /* open output raster map */
   int outfd;
   if ( (outfd = G_open_raster_new (cellname, CELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname);
+    G_fatal_error(_("Could not open <%s>"), cellname);
   }
   
   /* Allocate output buffer */
@@ -291,7 +293,7 @@
       
     } /* for j*/
     if (G_put_raster_row (outfd, outrast, CELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>",cellname);
+      G_fatal_error(_("Cannot write to <%s>"), cellname);
 
     G_percent(i, nrows, 2);
   }/* for i */
@@ -327,14 +329,14 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "cellfile  " << cellname << endl;
-    fprintf(stderr, "writing stream %s to raster map %s: ", foo, cellname);
+    *stats << "Writing stream <" << foo << "> to raster map <" << cellname << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster map <%s>"), foo, cellname);
   }
   
   /* open output raster map */
   int outfd;
   if ( (outfd = G_open_raster_new (cellname, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname);
+    G_fatal_error(_("Could not open <%s>"), cellname);
   }
   
   /* Allocate output buffer */
@@ -365,7 +367,7 @@
       
     } /* for j*/
     if (G_put_raster_row (outfd, outrast, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>",cellname);
+      G_fatal_error(_("Cannot write to <%s>"), cellname);
 
     G_percent(i, nrows, 2);
   }/* for i */
@@ -408,7 +410,7 @@
   assert(str);
 #ifndef   OUTPUT_TCI 
   /* this function should be used only if tci is wanted as output */
-  fprintf(stderr, "use this function only if tci is wanted as output\n");
+  G_warning("Use this function only if tci is wanted as output");
   exit(1);
 #else 
   rt_start(rt); 
@@ -417,20 +419,20 @@
   {
     char * foo;
     str->name(&foo); 
-    *stats << "writing stream " << foo << "to raster maps  "
-	   << cellname1 << ", " << cellname2 << endl;
-    fprintf(stderr, "writing stream %s to raster maps %s, %s: ", 
-	    foo, cellname1, cellname2);
+    *stats << "Writing stream <" << foo << "> to raster maps <"
+	   << cellname1 << "> and <" << cellname2 << ">." << endl;
+    G_verbose_message(_("Writing stream <%s> to raster maps <%s> and <%s>"), 
+		foo, cellname1, cellname2);
   }
 
   /* open  raster maps */
   int fd1;
   if ( (fd1 = G_open_raster_new (cellname1, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname1);
+    G_fatal_error (_("Could not open <%s>"), cellname1);
   }
   int fd2;
   if ( (fd2 = G_open_raster_new (cellname2, FCELL_TYPE)) < 0) {
-    G_fatal_error ("Could not open <%s>", cellname2);
+    G_fatal_error (_("Could not open <%s>"), cellname2);
   }
   
 
@@ -474,9 +476,9 @@
     } /* for j*/
 
     if (G_put_raster_row (fd1, rast1, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>", cellname1);
+      G_fatal_error(_("Cannot write to <%s>"), cellname1);
     if (G_put_raster_row (fd2, rast2, FCELL_TYPE) < 0)
-      G_fatal_error ("Cannot write to <%s>", cellname2);
+      G_fatal_error(_("Cannot write to <%s>"), cellname2);
     
     G_percent(i, nrows, 2);
 

Modified: grass/branches/releasebranch_6_4/raster/r.terraflow/main.cc
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.terraflow/main.cc	2010-09-21 13:27:50 UTC (rev 43587)
+++ grass/branches/releasebranch_6_4/raster/r.terraflow/main.cc	2010-09-21 13:30:18 UTC (rev 43588)
@@ -2,7 +2,7 @@
  * 
  *  MODULE:	r.terraflow
  *
- *  COPYRIGHT (C) 2007 Laura Toma
+ *  COPYRIGHT (C) 2007, 2010 Laura Toma
  *   
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -70,32 +70,32 @@
   struct Option *output_elev;
   output_elev = G_define_standard_option(G_OPT_R_OUTPUT);
   output_elev->key        = "filled";
-  output_elev->description= _("Output filled (flooded) elevation raster map");
+  output_elev->description= _("Name for output filled (flooded) elevation raster map");
   
  /* output direction  grid */
   struct Option *output_dir;
   output_dir = G_define_standard_option(G_OPT_R_OUTPUT);
   output_dir->key        = "direction";
-  output_dir->description= _("Output flow direction raster map");
+  output_dir->description= _("Name for output flow direction raster map");
 
   /* output sinkwatershed  grid */
   struct Option *output_watershed;
   output_watershed = G_define_standard_option(G_OPT_R_OUTPUT);
   output_watershed->key        = "swatershed";
-  output_watershed->description= _("Output sink-watershed raster map");
+  output_watershed->description= _("Name for output sink-watershed raster map");
 
   /* output flow accumulation grid */
   struct Option *output_accu;
   output_accu = G_define_standard_option(G_OPT_R_OUTPUT);
   output_accu->key        = "accumulation";
-  output_accu->description= _("Output flow accumulation raster map");
+  output_accu->description= _("Name for output flow accumulation raster map");
 
 #ifdef OUTPUT_TCI
   struct Option *output_tci;
   output_tci = G_define_standard_option(G_OPT_R_OUTPUT);
   output_tci->key        = "tci";
   output_tci->description=
-    _("Output topographic convergence index (tci) raster map");
+    _("Name for output topographic convergence index (tci) raster map");
 #endif
 
   /* MFD/SFD flag */
@@ -103,7 +103,6 @@
   sfd_flag = G_define_flag() ;
   sfd_flag->key        = 's';
   sfd_flag->description= _("SFD (D8) flow (default is MFD)");
-  /* sfd_flag->answer     = 'n'; */
 
   /* D8CUT value*/
   struct Option *d8cut;
@@ -112,9 +111,10 @@
   d8cut->type = TYPE_DOUBLE;
   d8cut->required = NO;
   d8cut->answer = G_store("infinity"); /* default value */
-  d8cut->description =
+  d8cut->label = _("Routing using SFD (D8) direction");
+  d8cut->description = 
     _("If flow accumulation is larger than this value it is routed using "
-      "SFD (D8) direction \n \t\t (meaningfull only  for MFD flow)");
+      "SFD (D8) direction (meaningfull only  for MFD flow)");
   
   /* main memory */
   struct Option *mem;
@@ -469,12 +469,12 @@
  
   module = G_define_module();
 #ifdef ELEV_SHORT
-  module->description = _("Flow computation for massive grids (Integer version).");
+  module->description = _("Flow computation for massive grids (integer version).");
 #endif
 #ifdef ELEV_FLOAT
-  module->description = _("Flow computation for massive grids (Float version).");
+  module->description = _("Flow computation for massive grids (float version).");
 #endif
-  module->keywords = _("raster");
+  module->keywords = _("raster, hydrology");
 
   /* read user options; fill in global <opt> */
   opt = (userOptions*)malloc(sizeof(userOptions));



More information about the grass-commit mailing list