[GRASS-SVN] r35864 - grass/trunk/imagery/i.atcorr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 12 17:33:34 EST 2009


Author: neteler
Date: 2009-02-12 17:33:34 -0500 (Thu, 12 Feb 2009)
New Revision: 35864

Modified:
   grass/trunk/imagery/i.atcorr/6s.cpp
   grass/trunk/imagery/i.atcorr/i.atcorr.html
   grass/trunk/imagery/i.atcorr/main.cpp
Log:
cosmetics

Modified: grass/trunk/imagery/i.atcorr/6s.cpp
===================================================================
--- grass/trunk/imagery/i.atcorr/6s.cpp	2009-02-12 22:32:46 UTC (rev 35863)
+++ grass/trunk/imagery/i.atcorr/6s.cpp	2009-02-12 22:33:34 UTC (rev 35864)
@@ -48,8 +48,7 @@
     ifstream inText;
     inText.open(icnd_name);
     if(!inText.is_open()) {
-	G_warning(_("Unable to open file <%s>"), icnd_name);
-	return -1;
+	G_fatal_error(_("Unable to open file <%s>"), icnd_name);
     }
 
     /* redirect cin to the input text file */

Modified: grass/trunk/imagery/i.atcorr/i.atcorr.html
===================================================================
--- grass/trunk/imagery/i.atcorr/i.atcorr.html	2009-02-12 22:32:46 UTC (rev 35863)
+++ grass/trunk/imagery/i.atcorr/i.atcorr.html	2009-02-12 22:33:34 UTC (rev 35864)
@@ -32,7 +32,7 @@
 <p>
 <div class="code"><pre>
 8                            - geometrical conditions=Landsat ETM+
-2 19 13.00 -47.410 -20.234   - month day hh.ddd longitude lattitude ("hh.ddd" is a decimal hour GMT)
+2 19 13.00 -47.410 -20.234   - month day hh.ddd longitude latitude ("hh.ddd" is a decimal hour GMT)
 1                            - atmospheric mode=tropical
 1                            - aerosols model=continental
 15                           - visibility [km] (aerosol model concentration)
@@ -70,7 +70,7 @@
 
 <h3>A. Geometrical conditions:</h3>
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 <tr>
 <td>Code</td>
@@ -160,7 +160,7 @@
 
 <br><h3>B. Atmospheric model</h3>
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 <tr>
 <td>Code</td>
@@ -232,7 +232,7 @@
 
 <br><h3>C. Aerosols model</h3>
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 <tr>
 <td>Code</td>
@@ -375,7 +375,7 @@
 
 <p>Define your own spectral conditions:
 <p>
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 <tr>
 <td>Code</td>
@@ -409,7 +409,7 @@
 
 <p>Pre-defined satellite bands:
 <p>
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 <tr><td>Code</td><td>Meaning</td></tr>
 
@@ -503,6 +503,30 @@
 <tr><td>71</td><td>liss (IRC 1C) band 5 (1.452-1.760)</td></tr>
 </table>
 
+<h2>EXAMPLES</h2>
+
+North Carolina sample dataset: Atmospheric correction of LANDSAT-7 channels:
+
+<div class="code"><pre>
+g.region rast=lsat7_2002_40 -p
+r.info lsat7_2002_40
+
+# create control file for channel 1 (blue)
+echo "8                            - geometrical conditions=Landsat ETM+
+5 24 14.30 -78.691 35.749    - month day hh.ddd longitude latitude ("hh.ddd" is a decimal hour GMT)
+2                            - atmospheric mode=midlatitude summer
+1                            - aerosols model=continental
+50                           - visibility [km] (aerosol model concentration)
+-.600                        - target at 600m above sea level
+-1000                        - sensor on board a satellite
+61                           - 1th band of ETM+ Landsat 7" > icnd.txt
+
+# run atmospheric correction
+i.atcorr lsat7_2002_40 ialt=elevation icnd=icnd.txt oimg=lsat7_2002_40_atcorr
+</pre></div>
+
+Note that the process is computationally intensive.
+
 <H2>AUTHORS</H2>
 
 <p><em>Original version of the program for GRASS 5:</em>
@@ -517,7 +541,7 @@
 Second simulation of the satellite signal in the solar spectrum, 6S: An
 overview., IEEE Trans. Geosc. and Remote Sens. 35(3):675-686.
 
-<p><a href="http://modis-sr.ltdri.org/6S_code/6S_code2_thinner_stuff/6S_ltdri_org_manual.html">6s manual</a> at the <a href="http://modis-sr.ltdri.org/6S_code/index.html">6s homepage</a> of the Land Surface Reflectance Science Computing Facility
+<p><a href="http://modis-sr.ltdri.org/6S_code/6S_code2_thinner_stuff/6S_ltdri_org_manual.html">6s manual</a> at the <a href="http://modis-sr.ltdri.org/6S_code/index.html">6s homepage</a> of the Land Surface Reflectance Science Computing Facility (also <a href="www.rsgis.ait.ac.th/~honda/textbooks/advrs/6smanv2.0_P1.pdf">PDF1</a>, <a href="www.rsgis.ait.ac.th/~honda/textbooks/advrs/6smanv2.0_P2.pdf">PDF2</a>, and <a href="www.rsgis.ait.ac.th/~honda/textbooks/advrs/6smanv2.0_P3.pdf">PDF3</a>)
 
 <p>Mauro A. Homem Antunes <a href="http://www.ltid.inpe.br/dsr/mauro/6s/download_6s.html">website about his 6s version</a>
 

Modified: grass/trunk/imagery/i.atcorr/main.cpp
===================================================================
--- grass/trunk/imagery/i.atcorr/main.cpp	2009-02-12 22:32:46 UTC (rev 35863)
+++ grass/trunk/imagery/i.atcorr/main.cpp	2009-02-12 22:33:34 UTC (rev 35864)
@@ -22,6 +22,13 @@
     supplying an elevation map has not been run to completion, because it
     takes to long and no sensible data for the test data was at hand.
     Testing would be welcomed. :)  
+**********
+
+* Code clean-up and port to GRASS 6.3, 15.12.2006:
+  Yann Chemin, ychemin(at)gmail.com 
+
+* Addition of IRS-1C LISS, Feb 2009: Markus Neteler
+
 ***************************************************************************/
 
 #include <cstdlib>
@@ -265,7 +272,7 @@
     FCELL* vis = NULL;         /* buffer for the visibility values */
     FCELL  prev_alt = -1.f;
     FCELL  prev_vis = -1.f;
-    int row, col;
+    int row, col, nrows, ncols;
 
     /* do initial computation with global elevation and visibility values */
     TransformInput ti;
@@ -279,10 +286,12 @@
     if(ivis_fd >= 0) vis = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
 
     G_verbose_message(_("Percent complete..."));
+    nrows = G_window_rows();
+    ncols = G_window_cols();
 
-    for(row = 0; row < G_window_rows(); row++)
+    for(row = 0; row < nrows; row++)
     {
-	G_percent(row, G_window_rows(), 1);     /* keep the user informed of our progress */
+	G_percent(row, nrows, 1);     /* keep the user informed of our progress */
 		
         /* read the next row */
 	if(G_get_raster_row(ifd, buf, row, FCELL_TYPE) < 0)
@@ -302,7 +311,7 @@
 			       row);
 
         /* loop over all the values in the row */
-	for(col = 0; col < G_window_cols(); col++)
+	for(col = 0; col < ncols; col++)
 	{
 	    if(vis && G_is_f_null_value(&vis[col]) || 
 	       alt && G_is_f_null_value(&alt[col]) || 
@@ -372,7 +381,7 @@
                     }
                 }
             }
-
+	    G_debug(3, "Computed r%d, c%d", row, col);
             /* transform from iscale.[min,max] to [0,1] */
             buf[col] = (buf[col] - iscale.min) / ((float)iscale.max - (float)iscale.min);
             buf[col] = transform(ti, imask, buf[col]);



More information about the grass-commit mailing list