[GRASS-SVN] r64255 - grass-addons/grass7/imagery/i.spec.sam

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 20 07:06:02 PST 2015


Author: ychemin
Date: 2015-01-20 07:06:01 -0800 (Tue, 20 Jan 2015)
New Revision: 64255

Modified:
   grass-addons/grass7/imagery/i.spec.sam/global.h
   grass-addons/grass7/imagery/i.spec.sam/main.c
   grass-addons/grass7/imagery/i.spec.sam/open.c
Log:
rm struct flag and replaced by G_verbose_message mostly

Modified: grass-addons/grass7/imagery/i.spec.sam/global.h
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/global.h	2015-01-20 14:43:49 UTC (rev 64254)
+++ grass-addons/grass7/imagery/i.spec.sam/global.h	2015-01-20 15:06:01 UTC (rev 64255)
@@ -24,5 +24,3 @@
 extern char result_name[80];
 extern char *result_prefix, *matrixfile;
 
-extern struct Flag *flag_quiet;
-                

Modified: grass-addons/grass7/imagery/i.spec.sam/main.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/main.c	2015-01-20 14:43:49 UTC (rev 64254)
+++ grass-addons/grass7/imagery/i.spec.sam/main.c	2015-01-20 15:06:01 UTC (rev 64255)
@@ -45,8 +45,6 @@
 char result_name[80];
 char *result_prefix, *matrixfile;
 
-struct Flag *flag_quiet;
-
 int open_files();
 void spectral_angle();
 CELL myround(x);
@@ -86,11 +84,6 @@
     parm.result->required = YES;
     parm.result->description = "Raster map prefix to hold spectral angles";
 
-    flag_quiet = G_define_flag();
-    flag_quiet->key = 'q';
-    flag_quiet->description = "Run quietly";
-
-
     if (G_parser(argc,argv))
 	exit(1);
 
@@ -169,15 +162,12 @@
     nrows = Rast_window_rows();
     ncols = Rast_window_cols();
     
-    if (!flag_quiet->answer)
-    	{
-	 fprintf (stderr, "Calculating for %i x %i = %i pixels:\n",nrows,ncols, (ncols * ncols));
-	 fprintf (stderr, "%s ... ", G_program_name());
-	}
+    G_verbose_message("Calculating for %i x %i = %i pixels:\n",nrows,ncols, (ncols * ncols));
+    G_verbose_message("%s ... ", G_program_name());
+
     for (row = 0; row < nrows; row++)                 /* rows loop*/
     {
-	if (!flag_quiet->answer)
-	    G_percent(row, nrows, 2);
+	G_percent(row, nrows, 2);
 	for (band = 0; band < Ref.nfiles; band++)     /* get row for all bands*/
 	    Rast_get_c_row (cellfd[band], cell[band], row);
 
@@ -210,8 +200,7 @@
 
     } /* rows loop */
 
-    if (!flag_quiet->answer)
-	G_percent(row, nrows, 2);
+    G_percent(row, nrows, 2);
 	
    /* close files */
     for (i = 0; i < Ref.nfiles; i++)

Modified: grass-addons/grass7/imagery/i.spec.sam/open.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.sam/open.c	2015-01-20 14:43:49 UTC (rev 64254)
+++ grass-addons/grass7/imagery/i.spec.sam/open.c	2015-01-20 15:06:01 UTC (rev 64255)
@@ -35,9 +35,9 @@
     fclose (fp);
     if ( A->m < A->n )
 	G_fatal_error("Need m (rows) >= n (cols) to obtain least squares fit\n");
-    if (!flag_quiet->answer)
+    G_verbose_message("Your spectral matrix = ");
+    if (G_verbose() == 3)
     {
-	G_message("Your spectral matrix = ");
 	m_output(A);
     }
     matrixsize = A->n;
@@ -73,8 +73,7 @@
 	cell[i] = Rast_allocate_c_buf();
 	name = Ref.file[i].name;
 	mapset = Ref.file[i].mapset;
-	if (!flag_quiet->answer)
-	    G_message("Opening input file no. %i [%s]\n", (i+1), name);
+	G_verbose_message("Opening input file no. %i [%s]\n", (i+1), name);
 	if ((cellfd[i] = Rast_open_old (name, mapset)) < 0)
 	    G_fatal_error("Unable to proceed\n");
     }
@@ -85,8 +84,7 @@
     for (i=0; i < Ref.nfiles; i++)
     {
 	sprintf(result_name, "%s.%d", result_prefix, (i+1));
-	if (!flag_quiet->answer)
-	    G_message("Opening output file [%s]\n", result_name);	 
+	G_verbose_message("Opening output file [%s]\n", result_name);	 
 	result_cell[i] = Rast_allocate_c_buf();
 	resultfd[i] = Rast_open_c_new (result_name);
     }



More information about the grass-commit mailing list