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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 6 04:25:29 PDT 2012


Author: ejtizado
Date: 2012-07-06 04:25:28 -0700 (Fri, 06 Jul 2012)
New Revision: 52320

Modified:
   grass-addons/grass6/imagery/i.landsat.toar/description.html
   grass-addons/grass6/imagery/i.landsat.toar/landsat.c
   grass-addons/grass6/imagery/i.landsat.toar/landsat.h
   grass-addons/grass6/imagery/i.landsat.toar/main.c
Log:
removed sat_zenith option, evaluate inside program (9.2 to landsat 1-3, and 8.2 to landsat 4-7

Modified: grass-addons/grass6/imagery/i.landsat.toar/description.html
===================================================================
--- grass-addons/grass6/imagery/i.landsat.toar/description.html	2012-07-06 10:39:51 UTC (rev 52319)
+++ grass-addons/grass6/imagery/i.landsat.toar/description.html	2012-07-06 11:25:28 UTC (rev 52320)
@@ -179,29 +179,29 @@
 <ul>
   <li>Chander G., B.L. Markham and D.L. Helder, 2009: Remote Sensing of
     Environment, vol. 113</li>
-  
+
   <li>Chander G.H. and B. Markham, 2003.: IEEE Transactions On Geoscience And
     Remote Sensing, vol. 41, no. 11.</li>
-  
+
   <li>Chavez P.S., jr. 1996. Image-based atmospheric corrections -
     Revisited and Improved. Photogrammetric Engineering and Remote
     Sensing 62(9): 1025-1036.</li>
-  
+
   <li>Huang et al: At-Satellite Reflectance, 2002: A First Order Normalization
     Of Landsat 7 ETM+ Images.</li>
-  
+
   <li>R. Irish: <a href="http://landsathandbook.gsfc.nasa.gov/orbit_coverage/">Landsat
       7. Science Data Users Handbook</a>. February 17, 2007; 15 May 2011.</li>
-  
+
   <li>Markham B.L. and J.L. Barker, 1986: Landsat MSS and TM Post-Calibration
     Dynamic Ranges, Exoatmospheric Reflectances and At-Satellite
     Temperatures. EOSAT Landsat Technical Notes, No. 1.</li>
-  
+
   <li>Moran M.S., R.D. Jackson, P.N. Slater and P.M. Teillet, 1992: Remote
     Sensing of Environment, vol. 41.</li>
-  
-  <li>Song et al : Classification and Change Detection Using Landsat TM
-    Data, 2001: When and How to Correct Atmospheric Effects? Remote Sensing
+
+  <li>Song et al, 2001: Classification and Change Detection Using Landsat TM
+    Data, When and How to Correct Atmospheric Effects? Remote Sensing
     of Environment, vol. 75.</li>
 </ul>
 

Modified: grass-addons/grass6/imagery/i.landsat.toar/landsat.c
===================================================================
--- grass-addons/grass6/imagery/i.landsat.toar/landsat.c	2012-07-06 10:39:51 UTC (rev 52319)
+++ grass-addons/grass6/imagery/i.landsat.toar/landsat.c	2012-07-06 11:25:28 UTC (rev 52320)
@@ -49,8 +49,7 @@
 #define abs(x)	(((x)>0)?(x):(-x))
 
 void lsat_bandctes(lsat_data * lsat, int i, char method,
-		   double percent, int dos, double sat_zenith,
-		   double rayleigh)
+		   double percent, int dos, double rayleigh)
 {
     double pi_d2, sin_e, cos_v, rad_sun;
 
@@ -61,7 +60,7 @@
 
     pi_d2 = (double)(PI * lsat->dist_es * lsat->dist_es);
     sin_e = (double)(sin(D2R * lsat->sun_elev));
-    cos_v = (double)(cos(D2R * sat_zenith));
+    cos_v = (double)(cos(D2R * (lsat->number < 4 ? 9.2 : 8.2)));
 
 	/** Global irradiance on the sensor.
 		Radiance to reflectance coefficient, only NO thermal bands.

Modified: grass-addons/grass6/imagery/i.landsat.toar/landsat.h
===================================================================
--- grass-addons/grass6/imagery/i.landsat.toar/landsat.h	2012-07-06 10:39:51 UTC (rev 52319)
+++ grass-addons/grass6/imagery/i.landsat.toar/landsat.h	2012-07-06 11:25:28 UTC (rev 52320)
@@ -61,6 +61,6 @@
 double lsat_rad2ref(double, band_data *);
 double lsat_rad2temp(double, band_data *);
 
-void lsat_bandctes(lsat_data *, int, char, double, int, double, double);
+void lsat_bandctes(lsat_data *, int, char, double, int, double);
 
 #endif

Modified: grass-addons/grass6/imagery/i.landsat.toar/main.c
===================================================================
--- grass-addons/grass6/imagery/i.landsat.toar/main.c	2012-07-06 10:39:51 UTC (rev 52319)
+++ grass-addons/grass6/imagery/i.landsat.toar/main.c	2012-07-06 11:25:28 UTC (rev 52320)
@@ -29,7 +29,7 @@
 {
     struct History history;
     struct GModule *module;
-    
+
     struct Cell_head cellhd;
     char *mapset;
 
@@ -37,24 +37,24 @@
     int infd, outfd;
     void *ptr;
     int nrows, ncols, row, col;
-    
+
     RASTER_MAP_TYPE in_data_type;
 
     struct Option *input_prefix, *output_prefix, *metfn, *sensor, *adate, *pdate, *elev,
-	*bgain, *metho, *perc, *dark, *satz, *atmo;
+	*bgain, *metho, *perc, *dark, *atmo;
     char *inputname, *met, *outputname, *sensorname;
     struct Flag *msss, *frad, *l5_mtl;
-    
+
     lsat_data lsat;
     char band_in[GNAME_MAX], band_out[GNAME_MAX];
     int i, j, q, method, pixel, dn_dark[MAX_BANDS], dn_mode[MAX_BANDS];
-    double qcal, rad, ref, percent, ref_mode, sat_zenith, rayleigh;
-    
+    double qcal, rad, ref, percent, ref_mode, rayleigh;
+
     struct Colors colors;
     struct FPRange range;
     double min, max;
     unsigned long hist[256], h_max;
-    
+
     /* initialize GIS environment */
     G_gisinit(argv[0]);
 
@@ -110,7 +110,7 @@
     metho->description = _("Required only if 'metfile' not given");
     metho->answer = "uncorrected";
     metho->guisection = _("Metadata");
-    
+
     adate = G_define_option();
     adate->key = "date";
     adate->type = TYPE_STRING;
@@ -119,7 +119,7 @@
     adate->label = _("Image acquisition date (yyyy-mm-dd)");
     adate->description = _("Required only if 'metfile' not given");
     adate->guisection = _("Metadata");
-    
+
     elev = G_define_option();
     elev->key = "solar_elevation";
     elev->type = TYPE_DOUBLE;
@@ -162,14 +162,6 @@
     dark->answer = "1000";
     dark->guisection = _("Settings");
 
-    satz = G_define_option();
-    satz->key = "sat_zenith";
-    satz->type = TYPE_DOUBLE;
-    satz->required = NO;
-    satz->description = _("Satellite zenith in degrees");
-    satz->answer = "8.2000";
-    satz->guisection = _("Settings");
-
     atmo = G_define_option();
     atmo->key = "rayleigh";
     atmo->type = TYPE_DOUBLE;
@@ -182,7 +174,7 @@
     frad = G_define_flag();
     frad->key = 'r';
     frad->description = _("Output at-sensor radiance for all bands");
-    
+
     msss = G_define_flag();
     msss->key = 's';
     msss->description = _("Set sensor of Landsat TM4/5 to MSS");
@@ -206,9 +198,9 @@
     inputname = input_prefix->answer;
     outputname = output_prefix->answer;
     sensorname = sensor -> answer ? sensor->answer: "";
-    
+
     G_zero(&lsat, sizeof(lsat));
-    
+
     if (adate->answer != NULL) {
 	strncpy(lsat.date, adate->answer, 11);
 	lsat.date[10] = '\0';
@@ -232,7 +224,6 @@
     lsat.sun_elev = elev->answer == NULL ? 0. : atof(elev->answer);
     percent = atof(perc->answer);
     pixel = atoi(dark->answer);
-    sat_zenith = atof(satz->answer);
     rayleigh = atof(atmo->answer);
 
     /* Data from MET file: only Landsat-7 ETM+ and Landsat-5 TM  */
@@ -404,8 +395,7 @@
 	    G_close_cell(infd);
 	}
 	/* Calculate transformation constants */
-	lsat_bandctes(&lsat, i, method, percent, dn_dark[i], sat_zenith,
-		      rayleigh);
+	lsat_bandctes(&lsat, i, method, percent, dn_dark[i], rayleigh);
     }
 
     if (strlen(lsat.creation) == 0)
@@ -483,7 +473,7 @@
 	in_data_type = G_raster_map_type(band_in, mapset);
 	if (G_get_cellhd(band_in, mapset, &cellhd) < 0)
 	    G_fatal_error(_("Unable to read header of raster map <%s>"), band_in);
-	
+
 	/* set same size as original band raster */
 	G_set_window(&cellhd);
 
@@ -550,7 +540,7 @@
 	    G_put_raster_row(outfd, outrast, DCELL_TYPE);
 	}
 	G_percent(1, 1, 1);
-	
+
 	ref_mode = 0.;
 	if (method > DOS && !lsat.band[i].thermal) {
 	    ref_mode = lsat_qcal2rad(dn_mode[i], &lsat.band[i]);
@@ -627,7 +617,7 @@
 	sprintf(history.edhist[history.edlinecnt],
 		"-----------------------------------------------------------------");
 	history.edlinecnt++;
-	
+
 	G_command_history(&history);
 	G_write_history(band_out, &history);
 



More information about the grass-commit mailing list