[GRASS-SVN] r43776 - grass-addons/imagery/i.landsat.toar

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 3 08:03:08 EDT 2010


Author: hamish
Date: 2010-10-03 12:03:08 +0000 (Sun, 03 Oct 2010)
New Revision: 43776

Modified:
   grass-addons/imagery/i.landsat.toar/landsat_met.c
   grass-addons/imagery/i.landsat.toar/main.c
Log:
add some debug messages and assertions

Modified: grass-addons/imagery/i.landsat.toar/landsat_met.c
===================================================================
--- grass-addons/imagery/i.landsat.toar/landsat_met.c	2010-10-03 11:17:45 UTC (rev 43775)
+++ grass-addons/imagery/i.landsat.toar/landsat_met.c	2010-10-03 12:03:08 UTC (rev 43776)
@@ -158,11 +158,19 @@
     if (lsat->creation[0] == 0)
 	G_fatal_error(_("Product creation date not in metadata file <%s>"),
 		      metfile);
+    G_debug(1, "met_TM5: Product creation date = [%s]", lsat->creation);
 
+
     get_value_met(mettext, "SolarElevation", value);
-    lsat->sun_elev = atof(value);
+    if (!value)
+	G_warning("Unable to read solar elevation from metadata file");
+    else
+	lsat->sun_elev = atof(value);
+    G_debug(1, "met_TM5: value=[%s], SolarElevation = %.2f", value, lsat->sun_elev);
 
+
     get_value_met(mettext, "PLATFORMSHORTNAME", value);
+    G_debug(1, "met_TM5: PLATFORMSHORTNAME=[%s]", value);
     switch (value[8]) {
     case '1':
 	set_MSS1(lsat);
@@ -187,6 +195,9 @@
 	else
 	    set_TM5(lsat);
 	break;
+    default:
+	G_warning("Unable to recognize satellite platform [%s]", value);
+	break;
     }
 
     (void)fclose(f);

Modified: grass-addons/imagery/i.landsat.toar/main.c
===================================================================
--- grass-addons/imagery/i.landsat.toar/main.c	2010-10-03 11:17:45 UTC (rev 43775)
+++ grass-addons/imagery/i.landsat.toar/main.c	2010-10-03 12:03:08 UTC (rev 43776)
@@ -220,6 +220,10 @@
 	else
 	    met_TM5(met, &lsat);
 
+	G_debug(1, "lsat.number = %d, lsat.sensor = [%s]", lsat.number, lsat.sensor);
+	if (!lsat.sensor || lsat.number > 7 || lsat.number < 1)
+	    G_fatal_error(_("Failed to identify satellite"));
+
 	G_message(_("Landsat-%d %s with data set in met file [%s]"),
 		  lsat.number, lsat.sensor, met);
 	if (elev->answer != NULL)



More information about the grass-commit mailing list