浏览代码

r.buffer/r.grow.distance: be more verbose

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41861 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年之前
父节点
当前提交
e03cd91546
共有 2 个文件被更改,包括 12 次插入7 次删除
  1. 7 4
      raster/r.grow.distance/main.c
  2. 5 3
      scripts/r.buffer/r.buffer.py

+ 7 - 4
raster/r.grow.distance/main.c

@@ -1,7 +1,7 @@
 
 /****************************************************************************
  *
- * MODULE:       r.grow2
+ * MODULE:       r.grow.distance
  *
  * AUTHOR(S):    Marjorie Larson - CERL
  *               Glynn Clements
@@ -9,7 +9,7 @@
  * PURPOSE:      Generates a raster map layer with contiguous areas 
  *               grown by one cell.
  *
- * COPYRIGHT:    (C) 2006 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2006, 2010 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -147,8 +147,9 @@ int main(int argc, char **argv)
 
     module = G_define_module();
     G_add_keyword(_("raster"));
+    G_add_keyword(_("distance"));
     module->description =
-	_("Generates a raster map layer of distance to features in input layer.");
+	_("Generates a raster map of distance to features in input raster map.");
 
     opt.in = G_define_standard_option(G_OPT_R_INPUT);
 
@@ -203,7 +204,7 @@ int main(int argc, char **argv)
 	G_begin_geodesic_distance(a, e2);
     }
     else
-	G_fatal_error(_("Unknown metric: [%s]."), opt.met->answer);
+	G_fatal_error(_("Unknown metric: '%s'"), opt.met->answer);
 
     if (flag.m->answer)
 	scale = G_database_units_to_meters_factor();
@@ -246,6 +247,7 @@ int main(int argc, char **argv)
     Rast_set_c_null_value(old_x_row, ncols);
     Rast_set_c_null_value(old_y_row, ncols);
 
+    G_message(_("Reading raster map <%s>..."), opt.in->answer);
     for (row = 0; row < nrows; row++) {
 	int irow = nrows - 1 - row;
 
@@ -293,6 +295,7 @@ int main(int argc, char **argv)
     Rast_set_c_null_value(old_x_row, ncols);
     Rast_set_c_null_value(old_y_row, ncols);
 
+    G_message(_("Writing output raster maps..."), opt.in->answer);
     for (row = 0; row < nrows; row++) {
 	int irow = nrows - 1 - row;
 	off_t offset =

+ 5 - 3
scripts/r.buffer/r.buffer.py

@@ -6,7 +6,7 @@
 # AUTHOR(S):	Glynn Clements
 # PURPOSE:	Replacement for r.buffer using r.grow.distance
 #
-# COPYRIGHT:	(C) 2008 by Glynn Clements
+# COPYRIGHT:	(C) 2008, 2010 by Glynn Clements
 #
 #		This program is free software under the GNU General Public
 #		License (>=v2). Read the file COPYING that comes with GRASS
@@ -15,7 +15,7 @@
 #############################################################################
 
 #%Module
-#% description: Creates a raster map layer showing buffer zones surrounding cells that contain non-NULL category values.
+#% description: Creates a raster map showing buffer zones surrounding cells that contain non-NULL category values.
 #% keywords: raster
 #% keywords: buffer
 #%End
@@ -115,6 +115,7 @@ def main():
     else:
 	exp = "$temp_src = if(isnull($input),null(),1)"
 
+    grass.message(_("Extracting buffers (1/2)..."))
     grass.mapcalc(exp, temp_src = temp_src, input = input)
 
     exp = "$output = if(!isnull($input),$input,%s)"
@@ -122,6 +123,7 @@ def main():
 	exp %= "if($dist <= %f,%d,%%s)" % (dist2,n + 2)
     exp %= "null()"
 
+    grass.message(_("Extracting buffers (2/2)..."))
     grass.mapcalc(exp, output = output, input = temp_src, dist = temp_dist)
 
     p = grass.feed_command('r.category', map = output, rules = '-')
@@ -137,7 +139,7 @@ def main():
 
     # write cmd history:
     grass.raster_history(output)
-
+    
 if __name__ == "__main__":
     options, flags = grass.parser()
     atexit.register(cleanup)