[GRASS-SVN] r58065 - grass/trunk/raster/r.topidx

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 19 17:52:00 PDT 2013


Author: hcho
Date: 2013-10-19 17:52:00 -0700 (Sat, 19 Oct 2013)
New Revision: 58065

Modified:
   grass/trunk/raster/r.topidx/file_io.c
   grass/trunk/raster/r.topidx/global.h
   grass/trunk/raster/r.topidx/main.c
   grass/trunk/raster/r.topidx/topidx.c
Log:
parameter descriptions updated; routine names changed

Modified: grass/trunk/raster/r.topidx/file_io.c
===================================================================
--- grass/trunk/raster/r.topidx/file_io.c	2013-10-20 00:46:47 UTC (rev 58064)
+++ grass/trunk/raster/r.topidx/file_io.c	2013-10-20 00:52:00 UTC (rev 58065)
@@ -4,7 +4,7 @@
 #include <grass/glocale.h>
 #include "global.h"
 
-void getcells(void)
+void read_cells(void)
 {
     int fd, i, j;
     RASTER_MAP_TYPE data_type;
@@ -13,10 +13,10 @@
     struct Cell_head inhead;
     char buf_wrns[32], buf_wrew[32], buf_mrns[32], buf_mrew[32];
 
-    fd = Rast_open_old(iname, "");
+    fd = Rast_open_old(input, "");
 
     data_type = Rast_get_map_type(fd);
-    Rast_get_cellhd(iname, "", &inhead);
+    Rast_get_cellhd(input, "", &inhead);
 
     if (data_type == CELL_TYPE)
 	ccell = (CELL *) G_malloc(sizeof(CELL) * window.cols);
@@ -77,13 +77,12 @@
     Rast_close(fd);
 }
 
-
-void putcells(void)
+void write_cells(void)
 {
     int fd, i;
     struct History history;
 
-    fd = Rast_open_new(oname, DCELL_TYPE);
+    fd = Rast_open_new(output, DCELL_TYPE);
 
     G_message(_("Writing topographic index map..."));
 
@@ -94,7 +93,7 @@
     G_percent(i, window.rows, 2);
     Rast_close(fd);
 
-    Rast_short_history(oname, "raster", &history);
-    Rast_set_history(&history, HIST_DATSRC_1, iname);
-    Rast_write_history(oname, &history);
+    Rast_short_history(output, "raster", &history);
+    Rast_set_history(&history, HIST_DATSRC_1, input);
+    Rast_write_history(output, &history);
 }

Modified: grass/trunk/raster/r.topidx/global.h
===================================================================
--- grass/trunk/raster/r.topidx/global.h	2013-10-20 00:46:47 UTC (rev 58064)
+++ grass/trunk/raster/r.topidx/global.h	2013-10-20 00:52:00 UTC (rev 58065)
@@ -15,12 +15,13 @@
 #define GLOBAL extern
 #endif
 
-GLOBAL char *iname, *oname;
+GLOBAL char *input, *output;
 GLOBAL struct Cell_head window;
 GLOBAL DCELL **cell;
 GLOBAL DCELL **atb, **a;
 
-void getcells(void);
-void putcells(void);
+void read_cells(void);
+void write_cells(void);
+void calculate_statistics(void);
 void initialize(void);
-void atanb(void);
+void calculate_atanb(void);

Modified: grass/trunk/raster/r.topidx/main.c
===================================================================
--- grass/trunk/raster/r.topidx/main.c	2013-10-20 00:46:47 UTC (rev 58064)
+++ grass/trunk/raster/r.topidx/main.c	2013-10-20 00:52:00 UTC (rev 58065)
@@ -10,7 +10,7 @@
  * PURPOSE:      Creates topographic index map from elevation map.
  *               Based on GRIDATB.FOR.
  *
- * COPYRIGHT:    (C) 2000-2010 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2000-2013 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
@@ -41,10 +41,12 @@
     module->description =
 	_("Creates topographic index map from elevation raster map.");
 
-    params.input = G_define_standard_option(G_OPT_R_INPUT);
+    params.input = G_define_standard_option(G_OPT_R_ELEV);
+    params.input->key = "input";
 
     params.output = G_define_standard_option(G_OPT_R_OUTPUT);
-    
+    params.output->description = _("Name for output topographic index map");
+
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -53,15 +55,15 @@
 	G_fatal_error(_("Lat/Long location is not supported by %s. Please reproject map first."),
 		      G_program_name());
 
-    iname = params.input->answer;
-    oname = params.output->answer;
+    input = params.input->answer;
+    output = params.output->answer;
 
     G_get_window(&window);
 
-    getcells();
+    read_cells();
     initialize();
-    atanb();
-    putcells();
+    calculate_atanb();
+    write_cells();
 
     exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/raster/r.topidx/topidx.c
===================================================================
--- grass/trunk/raster/r.topidx/topidx.c	2013-10-20 00:46:47 UTC (rev 58064)
+++ grass/trunk/raster/r.topidx/topidx.c	2013-10-20 00:52:00 UTC (rev 58065)
@@ -25,8 +25,7 @@
     }
 }
 
-
-void atanb(void)
+void calculate_atanb(void)
 {
     int i, j, k, snatb;
     int iter, ncells, nroute, nslp;



More information about the grass-commit mailing list