Bläddra i källkod

cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35864 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 år sedan
förälder
incheckning
59904827bf
3 ändrade filer med 46 tillägg och 14 borttagningar
  1. 1 2
      imagery/i.atcorr/6s.cpp
  2. 31 7
      imagery/i.atcorr/i.atcorr.html
  3. 14 5
      imagery/i.atcorr/main.cpp

+ 1 - 2
imagery/i.atcorr/6s.cpp

@@ -48,8 +48,7 @@ int init_6S(char* icnd_name)
     ifstream inText;
     ifstream inText;
     inText.open(icnd_name);
     inText.open(icnd_name);
     if(!inText.is_open()) {
     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 */
     /* redirect cin to the input text file */

+ 31 - 7
imagery/i.atcorr/i.atcorr.html

@@ -32,7 +32,7 @@ An example 6s parameters <em>icnd</em> file for <b>i.atcorr</b>:
 <p>
 <p>
 <div class="code"><pre>
 <div class="code"><pre>
 8                            - geometrical conditions=Landsat ETM+
 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                            - atmospheric mode=tropical
 1                            - aerosols model=continental
 1                            - aerosols model=continental
 15                           - visibility [km] (aerosol model concentration)
 15                           - visibility [km] (aerosol model concentration)
@@ -70,7 +70,7 @@ speeding them up.
 
 
 <h3>A. Geometrical conditions:</h3>
 <h3>A. Geometrical conditions:</h3>
 
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 
 <tr>
 <tr>
 <td>Code</td>
 <td>Code</td>
@@ -160,7 +160,7 @@ and &lt;0 for western.
 
 
 <br><h3>B. Atmospheric model</h3>
 <br><h3>B. Atmospheric model</h3>
 
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 
 <tr>
 <tr>
 <td>Code</td>
 <td>Code</td>
@@ -232,7 +232,7 @@ ozone content:
 
 
 <br><h3>C. Aerosols model</h3>
 <br><h3>C. Aerosols model</h3>
 
 
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 
 <tr>
 <tr>
 <td>Code</td>
 <td>Code</td>
@@ -375,7 +375,7 @@ pre-defined satellites.
 
 
 <p>Define your own spectral conditions:
 <p>Define your own spectral conditions:
 <p>
 <p>
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 
 <tr>
 <tr>
 <td>Code</td>
 <td>Code</td>
@@ -409,7 +409,7 @@ micrometer.</td>
 
 
 <p>Pre-defined satellite bands:
 <p>Pre-defined satellite bands:
 <p>
 <p>
-<table CELLPADDING="3">
+<table CELLPADDING="3" border="1">
 
 
 <tr><td>Code</td><td>Meaning</td></tr>
 <tr><td>Code</td><td>Meaning</td></tr>
 
 
@@ -503,6 +503,30 @@ micrometer.</td>
 <tr><td>71</td><td>liss (IRC 1C) band 5 (1.452-1.760)</td></tr>
 <tr><td>71</td><td>liss (IRC 1C) band 5 (1.452-1.760)</td></tr>
 </table>
 </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>
 <H2>AUTHORS</H2>
 
 
 <p><em>Original version of the program for GRASS 5:</em>
 <p><em>Original version of the program for GRASS 5:</em>
@@ -517,7 +541,7 @@ micrometer.</td>
 Second simulation of the satellite signal in the solar spectrum, 6S: An
 Second simulation of the satellite signal in the solar spectrum, 6S: An
 overview., IEEE Trans. Geosc. and Remote Sens. 35(3):675-686.
 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>
 <p>Mauro A. Homem Antunes <a href="http://www.ltid.inpe.br/dsr/mauro/6s/download_6s.html">website about his 6s version</a>
 
 

+ 14 - 5
imagery/i.atcorr/main.cpp

@@ -22,6 +22,13 @@
     supplying an elevation map has not been run to completion, because it
     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.
     takes to long and no sensible data for the test data was at hand.
     Testing would be welcomed. :)  
     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>
 #include <cstdlib>
@@ -265,7 +272,7 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
     FCELL* vis = NULL;         /* buffer for the visibility values */
     FCELL* vis = NULL;         /* buffer for the visibility values */
     FCELL  prev_alt = -1.f;
     FCELL  prev_alt = -1.f;
     FCELL  prev_vis = -1.f;
     FCELL  prev_vis = -1.f;
-    int row, col;
+    int row, col, nrows, ncols;
 
 
     /* do initial computation with global elevation and visibility values */
     /* do initial computation with global elevation and visibility values */
     TransformInput ti;
     TransformInput ti;
@@ -279,10 +286,12 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
     if(ivis_fd >= 0) vis = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
     if(ivis_fd >= 0) vis = (FCELL*)G_allocate_raster_buf(FCELL_TYPE);
 
 
     G_verbose_message(_("Percent complete..."));
     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 */
         /* read the next row */
 	if(G_get_raster_row(ifd, buf, row, FCELL_TYPE) < 0)
 	if(G_get_raster_row(ifd, buf, row, FCELL_TYPE) < 0)
@@ -302,7 +311,7 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
 			       row);
 			       row);
 
 
         /* loop over all the values in the 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]) || 
 	    if(vis && G_is_f_null_value(&vis[col]) || 
 	       alt && G_is_f_null_value(&alt[col]) || 
 	       alt && G_is_f_null_value(&alt[col]) || 
@@ -372,7 +381,7 @@ static void process_raster (int ifd, InputMask imask, ScaleRange iscale,
                     }
                     }
                 }
                 }
             }
             }
-
+	    G_debug(3, "Computed r%d, c%d", row, col);
             /* transform from iscale.[min,max] to [0,1] */
             /* transform from iscale.[min,max] to [0,1] */
             buf[col] = (buf[col] - iscale.min) / ((float)iscale.max - (float)iscale.min);
             buf[col] = (buf[col] - iscale.min) / ((float)iscale.max - (float)iscale.min);
             buf[col] = transform(ti, imask, buf[col]);
             buf[col] = transform(ti, imask, buf[col]);