[GRASS-SVN] r46512 - grass/branches/develbranch_6/imagery/i.topo.corr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jun 2 04:36:06 EDT 2011


Author: martinl
Date: 2011-06-02 01:36:06 -0700 (Thu, 02 Jun 2011)
New Revision: 46512

Modified:
   grass/branches/develbranch_6/imagery/i.topo.corr/correction.c
   grass/branches/develbranch_6/imagery/i.topo.corr/main.c
Log:
i.topo.corr: coding style improved
	     (merge r46511 from relbr64)


Modified: grass/branches/develbranch_6/imagery/i.topo.corr/correction.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.topo.corr/correction.c	2011-06-02 08:34:00 UTC (rev 46511)
+++ grass/branches/develbranch_6/imagery/i.topo.corr/correction.c	2011-06-02 08:36:06 UTC (rev 46512)
@@ -97,12 +97,12 @@
     case MINNAERT:
 	cka = ckb = 0.;
 	kk = m;
-	G_message("Minnaert constant = %lf", kk);
+	G_message(_("Minnaert constant = %lf"), kk);
 	break;
     case C_CORRECT:
 	cka = ckb = a / m; /* Richter changes to m/a */
 	kk = 1.;
-	G_message("C-factor constant = %lf (a=%.4f; m=%.4f)", cka, a, m);
+	G_message(_("C-factor constant = %lf (a=%.4f; m=%.4f)"), cka, a, m);
 	break;
     case PERCENT:
 	cka = 2. - cos_z;

Modified: grass/branches/develbranch_6/imagery/i.topo.corr/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.topo.corr/main.c	2011-06-02 08:34:00 UTC (rev 46511)
+++ grass/branches/develbranch_6/imagery/i.topo.corr/main.c	2011-06-02 08:36:06 UTC (rev 46512)
@@ -30,11 +30,11 @@
 
     gf->mapset = G_find_cell2(gf->name, "");
     if (gf->mapset == NULL)
-	G_fatal_error("Cell file <%s> not found", gf->name);
+	G_fatal_error(_("Raster map <%s> not found"), gf->name);
 
     gf->fd = G_open_cell_old(gf->name, gf->mapset);
     if (gf->fd < 0)
-	G_fatal_error(_("Cannot open file [%s] in mapset [%s]"), gf->name,
+	G_fatal_error(_("Unable to open raster map <%s@%s>"), gf->name,
 		      gf->mapset);
 
     gf->type = G_raster_map_type(gf->name, gf->mapset);
@@ -54,9 +54,8 @@
     gf->mapset = G_mapset();
     gf->fd = G_open_raster_new(gf->name, gf->type);
     if (gf->fd < 0)
-	G_fatal_error(_("Cannot create file <%s> in mapset <%s>"), gf->name,
-		      gf->mapset);
-
+	G_fatal_error(_("Unable to create raster map <%s>"), gf->name);
+    
     return gf->fd;
 }
 
@@ -81,64 +80,50 @@
 
     /* initialize module */
     module = G_define_module();
-    module->description = _("Topografic correction of reflectance");
+    module->description = _("Computes topografic correction of reflectance.");
     module->keywords =
-	_("Topographic correction, Cosine, Minnaert, C-Factor, Percent");
-
+	_("imagery, topographic correction, Cosine, Minnaert, C-Factor, Percent");
+    
     /* It defines the different parameters */
 
-    input = G_define_option();
-    input->key = _("input");
-    input->type = TYPE_STRING;
+    input = G_define_standard_option(G_OPT_R_INPUTS);
     input->required = NO;
     input->multiple = YES;
-    input->gisprompt = _("input,cell,raster");
     input->description =
-	_("List of reflectance band maps to correct topographically");
+	_("Name of reflectance raster maps to correct topographically");
 
-    output = G_define_option();
-    output->key = _("output");
-    output->type = TYPE_STRING;
-    output->required = YES;
-    output->gisprompt = _("output,cell,raster");
+    output = G_define_standard_option(G_OPT_R_OUTPUT);
     output->description =
-	_("File name of output (flag -i) or prefix of output files");
+	_("Name (flag -i) or prefix for output raster maps");
 
-    base = G_define_option();
-    base->key = _("basemap");
-    base->type = TYPE_STRING;
-    base->required = YES;
-    base->gisprompt = _("base,cell,raster");
-    base->description = _("Base map for analysis (elevation or ilumination)");
+    base = G_define_standard_option(G_OPT_R_MAP);
+    base->key = "basemap";
+    base->description = _("Name of input base raster map (elevation or ilumination)");
 
     zeni = G_define_option();
-    zeni->key = _("zenith");
+    zeni->key = "zenith";
     zeni->type = TYPE_DOUBLE;
     zeni->required = YES;
-    zeni->gisprompt = _("zenith,float");
     zeni->description = _("Solar zenith in degrees");
 
     azim = G_define_option();
-    azim->key = _("azimuth");
+    azim->key = "azimuth";
     azim->type = TYPE_DOUBLE;
     azim->required = NO;
-    azim->gisprompt = _("azimuth,float");
     azim->description = _("Solar azimuth in degrees (only if flag -i)");
 
     metho = G_define_option();
-    metho->key = _("method");
+    metho->key = "method";
     metho->type = TYPE_STRING;
     metho->required = NO;
     metho->options = "cosine,minnaert,c-factor,percent";
-    metho->gisprompt = _("topographic correction method");
     metho->description = _("Topographic correction method");
     metho->answer = "c-factor";
 
     ilum = G_define_flag();
     ilum->key = 'i';
     ilum->description = _("To output sun ilumination terrain model");
-    ilum->answer = 0;
-
+    
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -146,8 +131,7 @@
 	G_fatal_error(_("Solar azimuth is necessary to calculate ilumination terrain model"));
 
     if (!ilum->answer && input->answer == NULL)
-	G_fatal_error
-	    (_("Reflectance maps are necessary to make topographic correction"));
+	G_fatal_error(_("Reflectance maps are necessary to make topographic correction"));
 
     zenith = atof(zeni->answer);
 
@@ -179,7 +163,7 @@
 	    eval_d_cosi(&out, &dem, zenith, azimuth);
 	}
 	else {
-	    G_fatal_error(_("Elevation file of unknown type"));
+	    G_fatal_error(_("Elevation raster map of unknown type"));
 	}
 	/* Close files, buffers, and write history */
 	G_free(dem.rast);
@@ -216,11 +200,11 @@
 	    G_fatal_error(_("Illumination model is of CELL type"));
 
 	for (i = 0; input->answers[i] != NULL; i++) {
-	    G_message("\nBand %s: ", input->answers[i]);
+	    G_message("Band %s: ", input->answers[i]);
 	    /* Abre fichero de bandas y el de salida */
 	    full_open_old(&band, input->answers[i]);
 	    if (band.type != DCELL_TYPE) {
-		G_warning(_("Reflectance of <%s> is not of DCELL type - ignored."),
+		G_warning(_("Reflectance of raster map <%s> is not of DCELL type - ignored"),
 			  input->answers[i]);
 		G_close_cell(band.fd);
 		continue;



More information about the grass-commit mailing list