[GRASS-SVN] r43894 - grass/branches/develbranch_6/imagery/i.atcorr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 13 15:32:57 EDT 2010


Author: martinl
Date: 2010-10-13 12:32:56 -0700 (Wed, 13 Oct 2010)
New Revision: 43894

Modified:
   grass/branches/develbranch_6/imagery/i.atcorr/main.cpp
Log:
i.atcorr: cosmetics in descriptions


Modified: grass/branches/develbranch_6/imagery/i.atcorr/main.cpp
===================================================================
--- grass/branches/develbranch_6/imagery/i.atcorr/main.cpp	2010-10-13 19:24:34 UTC (rev 43893)
+++ grass/branches/develbranch_6/imagery/i.atcorr/main.cpp	2010-10-13 19:32:56 UTC (rev 43894)
@@ -76,14 +76,14 @@
 int mis = 0;
 
 /* function prototypes */
-static void adjust_region (char *, const char *);
-static CELL round_c (FCELL);
-static void write_fp_to_cell (int, FCELL *);
-static void process_raster (int, InputMask, ScaleRange, int, int, int, bool, ScaleRange, bool);
-static void copy_colors (char *, const char *, char *);
-static void define_module (void);
-static struct Options define_options (void);
-static void read_scale (Option *, ScaleRange &);
+static void adjust_region(char *, const char *);
+static CELL round_c(FCELL);
+static void write_fp_to_cell(int, FCELL *);
+static void process_raster(int, InputMask, ScaleRange, int, int, int, bool, ScaleRange, bool);
+static void copy_colors(char *, const char *, char *);
+static void define_module(void);
+static struct Options define_options(void);
+static void read_scale(Option *, ScaleRange &);
 
 
 /* 
@@ -91,7 +91,7 @@
    Atmospheric corrections should be done on the whole
    satelite image, not just portions.
 */
-static void adjust_region (char *name, const char *mapset)
+static void adjust_region(char *name, const char *mapset)
 {
     struct Cell_head iimg_head;	/* the input image header file */
 
@@ -105,9 +105,9 @@
 
 
 /* Rounds a floating point cell value */
-static CELL round_c (FCELL x)
+static CELL round_c(FCELL x)
 {
-    if (x >= 0.0)
+    if(x >= 0.0)
 	return (CELL)(x + .5);
 
     return (CELL)(-(-x + .5));
@@ -115,7 +115,7 @@
 
 
 /* Converts the buffer to cell and write it to disk */
-static void write_fp_to_cell (int ofd, FCELL* buf)
+static void write_fp_to_cell(int ofd, FCELL* buf)
 {
     CELL* cbuf;
     int col;
@@ -237,7 +237,7 @@
 typedef std::map<IntPair, TransformInput> CacheMap;
 
 
-const TransformInput& optimize_va (const FCELL& vis, const FCELL& alt)
+const TransformInput& optimize_va(const FCELL& vis, const FCELL& alt)
 {
     static CacheMap timap;
     static TransformInput ti;
@@ -274,7 +274,7 @@
    oflt: if true use FCELL_TYPE for output
    oscale: output file's range (default is min = 0, max = 255)
 */
-static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
+static void process_raster(int ifd, InputMask imask, ScaleRange iscale,
 			    int ialt_fd, int ivis_fd, int ofd, bool oflt,
 			    ScaleRange oscale, bool optimize)
 {
@@ -400,7 +400,7 @@
             buf[col] = buf[col] * ((float)oscale.max - (float)oscale.min) + oscale.min;
 
             if(~oflt && (buf[col] > (float)oscale.max))
-		G_warning (_("The output data will overflow. Reflectance > 100%%"));
+		G_warning(_("The output data will overflow. Reflectance > 100%%"));
 	}
 
         /* write output */
@@ -417,7 +417,7 @@
 
 
 /* Copy the colors from map named iname to the map named oname */
-static void copy_colors (char *iname, const char *imapset, char *oname)
+static void copy_colors(char *iname, const char *imapset, char *oname)
 {
     struct Colors colors;
 
@@ -427,7 +427,7 @@
 
 
 /* Define our module so that Grass can print it if the user wants to know more. */
-static void define_module (void)
+static void define_module(void)
 {
     struct GModule *module;
 
@@ -457,42 +457,41 @@
 
 
 /* Define the options and flags */
-static struct Options define_options (void)
+static struct Options define_options(void)
 {
     struct Options opts;
 
-    opts.iimg = G_define_standard_option (G_OPT_R_INPUT);
-    opts.iimg->key		= "iimg";
-
+    opts.iimg = G_define_standard_option(G_OPT_R_INPUT);
+    opts.iimg->key = "iimg";
+    
     opts.iscl = G_define_option();
     opts.iscl->key          = "iscl";
     opts.iscl->type         = TYPE_INTEGER;
     opts.iscl->key_desc     = "min,max";
     opts.iscl->required     = NO;
     opts.iscl->answer       = "0,255";
-    opts.iscl->description  = _("Input imagery range [0,255]");
+    opts.iscl->description  = _("Input range");
     opts.iscl->guisection = _("Input");
 
-    opts.ialt = G_define_standard_option (G_OPT_R_INPUT);
-    opts.ialt->key		= "ialt";
+    opts.ialt = G_define_standard_option(G_OPT_R_ELEV);
     opts.ialt->required	        = NO;
-    opts.ialt->answer	        = "dem_float";
-    opts.ialt->description	= _("Input altitude raster map in m (optional)");
+    opts.ialt->description      = _("Name of input elevation raster map (in m)");
     opts.ialt->guisection       = _("Input");
-
-    opts.ivis = G_define_standard_option (G_OPT_R_INPUT);
+    opts.ialt->key              = "ialt";
+    
+    opts.ivis = G_define_standard_option(G_OPT_R_INPUT);
     opts.ivis->key		= "ivis";
     opts.ivis->required	        = NO;
-    opts.ivis->description	= _("Input visibility raster map in km (optional)");
+    opts.ivis->description	= _("Name of input visibility raster map (in km)");
     opts.ivis->guisection       = _("Input");
 
-    opts.icnd = G_define_standard_option (G_OPT_F_INPUT);
+    opts.icnd = G_define_standard_option(G_OPT_F_INPUT);
     opts.icnd->key		= "icnd";
     opts.icnd->required	        = YES;
     opts.icnd->description	= _("Name of input text file");
 
-    opts.oimg = G_define_standard_option (G_OPT_R_OUTPUT);
-    opts.oimg->key		= "oimg";
+    opts.oimg = G_define_standard_option(G_OPT_R_OUTPUT);
+    opts.oimg->key = "oimg";
 
     opts.oscl = G_define_option();
     opts.oscl->key          = "oscl";
@@ -500,17 +499,17 @@
     opts.oscl->key_desc     = "min,max";
     opts.oscl->answer       = "0,255";
     opts.oscl->required     = NO;
-    opts.oscl->description  = _("Rescale output raster map [0,255]");
+    opts.oscl->description  = _("Rescale output raster map");
     opts.oscl->guisection = _("Output");
 
     opts.oflt = G_define_flag();
     opts.oflt->key = 'f';
-    opts.oflt->description = _("Output raster is floating point");
+    opts.oflt->description = _("Output raster map as floating point");
     opts.oflt->guisection = _("Output");
 
     opts.irad = G_define_flag();
     opts.irad->key = 'r';
-    opts.irad->description = _("Input map converted to reflectance (default is radiance)");
+    opts.irad->description = _("Input raster map converted to reflectance (default is radiance)");
     opts.irad->guisection = _("Input");
 
     opts.etmafter = G_define_flag();
@@ -531,7 +530,7 @@
 }
 
 /* Read the min and max values from the iscl and oscl options */
-void read_scale (Option *scl, ScaleRange &range)
+void read_scale(Option *scl, ScaleRange &range)
 {
     /* set default values */
     range.min = 0;
@@ -544,7 +543,7 @@
 
         if(range.min==range.max)
         {
-            G_warning (_("Scale range length should be > 0; Using default values: [0,255]"));
+            G_warning(_("Scale range length should be > 0; Using default values: [0,255]"));
 
             range.min = 0;
             range.max = 255;
@@ -582,14 +581,14 @@
 
     /**** Start ****/
     G_gisinit(argv[0]);
-    if (G_parser(argc, argv) < 0)
-	exit (EXIT_FAILURE);
+    if(G_parser(argc, argv) < 0)
+	exit(EXIT_FAILURE);
 
     /* open input raster */
     if ( (iimg_mapset = G_find_cell2 ( opts.iimg->answer, "") ) == NULL )
 	G_fatal_error ( _("Raster map <%s> not found"), opts.iimg->answer);
     if((iimg_fd = G_open_cell_old(opts.iimg->answer, iimg_mapset)) < 0)
-	G_fatal_error (_("Unable to open raster map <%s>"),
+	G_fatal_error(_("Unable to open raster map <%s>"),
 		       G_fully_qualified_name(opts.iimg->answer, iimg_mapset));
 
     adjust_region(opts.iimg->answer, iimg_mapset);
@@ -598,7 +597,7 @@
 	if ( (ialt_mapset = G_find_cell2 ( opts.ialt->answer, "") ) == NULL )
 	    G_fatal_error ( _("Raster map <%s> not found"), opts.ialt->answer);
 	if((ialt_fd = G_open_cell_old(opts.ialt->answer, ialt_mapset)) < 0)
-            G_fatal_error (_("Unable to open raster map <%s>"),
+            G_fatal_error(_("Unable to open raster map <%s>"),
 			   G_fully_qualified_name(opts.ialt->answer, ialt_mapset));
     }
 
@@ -606,7 +605,7 @@
 	if ( (iviz_mapset = G_find_cell2 ( opts.ivis->answer, "") ) == NULL )
 	    G_fatal_error ( _("Raster map <%s> not found"), opts.ivis->answer);
 	if((ivis_fd = G_open_cell_old(opts.ivis->answer, iviz_mapset)) < 0)
-            G_fatal_error (_("Unable to open raster map <%s>"),
+            G_fatal_error(_("Unable to open raster map <%s>"),
 			   G_fully_qualified_name(opts.ivis->answer, iviz_mapset));
     }
                 
@@ -614,13 +613,13 @@
     if(opts.oflt->answer)
     {
 	if((oimg_fd = G_open_fp_cell_new(opts.oimg->answer)) < 0)
-	    G_fatal_error (_("Unable to create raster map <%s>"),
+	    G_fatal_error(_("Unable to create raster map <%s>"),
 			   opts.oimg->answer);
     }
     else
     {
 	if((oimg_fd = G_open_raster_new(opts.oimg->answer, CELL_TYPE)) < 0)
-	    G_fatal_error (_("Unable to create raster map <%s>"),
+	    G_fatal_error(_("Unable to create raster map <%s>"),
 			   opts.oimg->answer);
     }
 
@@ -657,5 +656,5 @@
        Scaling is ignored and color ranges might not be correct. */
     copy_colors(opts.iimg->answer, iimg_mapset, opts.oimg->answer);
 
-    exit (EXIT_SUCCESS);
+    exit(EXIT_SUCCESS);
 }



More information about the grass-commit mailing list