[GRASS-SVN] r53589 - grass/branches/releasebranch_6_4/imagery/i.landsat.toar

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 28 03:14:02 PDT 2012


Author: neteler
Date: 2012-10-28 03:14:02 -0700 (Sun, 28 Oct 2012)
New Revision: 53589

Modified:
   grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat.h
   grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_set.c
   grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c
Log:
Jorge Tizado: better management of metadata file

Modified: grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat.h
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat.h	2012-10-28 10:11:39 UTC (rev 53588)
+++ grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat.h	2012-10-28 10:14:02 UTC (rev 53589)
@@ -3,6 +3,7 @@
 
 #define UNCORRECTED     0
 #define CORRECTED       1
+
 #define DOS      		10
 #define DOS1			12
 #define DOS2			14
@@ -10,6 +11,8 @@
 #define DOS3			16
 #define DOS4			18
 
+#define NOMETADATAFILE  0
+#define METADATAFILE    1
 
 /*****************************************************
  * Landsat Structures
@@ -40,6 +43,7 @@
 
 typedef struct
 {
+    int flag;
     unsigned char number;	/* Landsat number                */
 
     char creation[11];		/* Image production date         */

Modified: grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_set.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_set.c	2012-10-28 10:11:39 UTC (rev 53588)
+++ grass/branches/releasebranch_6_4/imagery/i.landsat.toar/landsat_set.c	2012-10-28 10:14:02 UTC (rev 53589)
@@ -421,10 +421,9 @@
     }
 
     jbuf = julian_char("2004-04-04");
-    if (julian >= jbuf) {
-	G_warning
-	    ("Using QCalMin=1.0 as a NLAPS product processed after 4/4/2004");
-	G_warning("Ignore this message when using the metfile option");
+    if (julian >= jbuf && !(lsat->flag & METADATAFILE) )
+    {
+        G_warning("Using QCalMin=1.0 as a NLAPS product processed after 04/04/2004");
     }
     lsat->number = 5;
     sensor_TM(lsat);

Modified: grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c	2012-10-28 10:11:39 UTC (rev 53588)
+++ grass/branches/releasebranch_6_4/imagery/i.landsat.toar/main.c	2012-10-28 10:14:02 UTC (rev 53589)
@@ -10,7 +10,7 @@
  * PURPOSE:      Calculate TOA Radiance or Reflectance and Kinetic Temperature
  *               for Landsat 1/2/3/4/5 MS, 4/5 TM or 7 ETM+
  *
- * COPYRIGHT:    (C) 2002-2012 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2006-2012 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
@@ -200,8 +200,10 @@
 	    G_fatal_error(_("Illegal date format: [%s] (yyyy-mm-dd)"),
 			  lsat.date);
     }
+    /* Unnecessary because G_zero filled
     else
 	lsat.date[0] = '\0';
+	*/
 
     if (pdate->answer != NULL) {
 	strncpy(lsat.creation, pdate->answer, 11);
@@ -210,17 +212,23 @@
 	    G_fatal_error(_("Illegal date format: [%s] (yyyy-mm-dd)"),
 			  lsat.creation);
     }
+    /* Unnecessary because G_zero filled
     else
 	lsat.creation[0] = '\0';
+	*/
 
     lsat.sun_elev = elev->answer == NULL ? 0. : atof(elev->answer);
     percent = atof(perc->answer);
     pixel = atoi(dark->answer);
     rayleigh = atof(atmo->answer);
 
+    /* Unnecessary because G_zero filled
+    lsat.flag = NOMETADATAFILE;
+     */
     /* Data from metadata file */
     if (met != NULL)
     {
+        lsat.flag = METADATAFILE;
         i = strlen(met);
         if (strcmp(met + i - 7, "MTL.txt") == 0)
         {
@@ -229,7 +237,7 @@
         else if (strcmp(met + i - 4, ".met") == 0)
         {
             if (strcmp(sensorname, "tm7") == 0)
-                lsat_mtldata(met, &lsat);  /* .met of Landsat-7 = new MTL file */
+                lsat_mtldata(met, &lsat);  /* old .met of Landsat-7 = new MTL file */
             else
                 lsat_metdata(met, &lsat);
         }



More information about the grass-commit mailing list