[GRASS-SVN] r38267 - in grass-addons/grass7/imagery: . i.landsat.toar

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jul 5 15:11:08 EDT 2009


Author: martinl
Date: 2009-07-05 15:11:08 -0400 (Sun, 05 Jul 2009)
New Revision: 38267

Added:
   grass-addons/grass7/imagery/i.landsat.toar/
   grass-addons/grass7/imagery/i.landsat.toar/i.landsat.toar.html
Removed:
   grass-addons/grass7/imagery/i.landsat.toar/description.html
Modified:
   grass-addons/grass7/imagery/i.landsat.toar/main.c
Log:
i.landsat.toar upgraded for GRASS 7


Deleted: grass-addons/grass7/imagery/i.landsat.toar/description.html
===================================================================
--- grass-addons/imagery/i.landsat.toar/description.html	2009-07-05 13:13:50 UTC (rev 38251)
+++ grass-addons/grass7/imagery/i.landsat.toar/description.html	2009-07-05 19:11:08 UTC (rev 38267)
@@ -1,139 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>i.landsat.toar</EM> is to transform calibrated digital number of Landsat products to top-of-atmosphere radiance or top-of-atmosphere reflectance and temperature (band 6 of the sensors TM and ETM+). Optionally, to calculate the at-surface radiance or reflectance with atmosferic correction (DOS method).
-
-<p>Usually, to do this the production date, the acquisition date, and the solar elevation is needed. Moreover, also is needed for Landsat-7 ETM+ the gain (high or low) of the nine bands.</p>
-
-<p>Optionally, the data can be read from header file (.met) for all Landsat MSS, TM and ETM+. However, if the solar elevation or the product creation date are given the values of metfile are overwriten. This is necessary when this data in metfile are incorrects or imprecisses.</p>
-
-<p><b>Attention</b>: Any null value or less than QCALmin in input raster is set to null in output raster and it is not included in the equations.</p>
-
-
-<H2>Uncorrected at-sensor values (method=uncorrected, default)</H2>
-
-<p>The standard geometric and radiometric correction results in a calibrated digital number (QCAL = DN) images. To further standardize the impact of illumination geometry, the QCAL images are converted first to at-sensor radiance and then to at-sensor reflectance. The thermal band is first converted from QCAL to at-sensor radiance, and then to effective at-sensor temperature in Kelvin degrees.</p>
-
-<p>Radiometric calibration convert QCAL to <b>at-sensor radiance</b>, a radiometric quantity measured in  W/(m²·sr·µm) with the equations:
-  <ul>
-  <li> gain = (Lmax - Lmin) / (QCALmax - QCALmin)</li>
-  <li> bias = Lmin - gain · QCALmin </li>
-  <li> radiance = gain · QCAL + bias </li>
-  </ul>
-where,
-<em>Lmax</em> and <em>Lmin</em> are the calibration constants, and
-<em>QCALmax</em> and <em>QCALmin</em> are the highest and the lowest points of the range of rescaled radiance in QCAL.
-</p>
-
-<p>Then, to calculate <b>at-sensor reflectance</b> the equations are:
-    <ul>
-    <li> sun_radiance = [Esun · sin(e)] / (PI · d^2)</li>
-    <li> reflectance = radiance / sun_radiance </li>
-  </ul>
-where,
-<em>d</em> is the earth-sun distance in astronomical units,
-<em>e</em> is the solar elevation angle, and
-<em>Esun</em> is the mean solar exoatmospheric irradiance in W/(m²·µm).
-</p>
-
-
-<H2>Corrected at-sensor values (method=corrected)</H2>
-
-<p>At-sensor reflectance values range from zero to one, whereas at-sensor radiance must be greater or equal to zero. However, since Lmin can be a negative number then the at-sensor values also it can be negative. To avoid these possible negative values and set the minimum possible values at-sentor to zero, this method correct the radiance to output a corrected at-sensor values with the equations (not for thermal bands):
-    <ul>
-    <li> radiance = (uncorrected_radiance - Lmin) </li>
-    <li> reflectance = radiance / sun_radiance </li>
-  </ul>
-</p>
-
-<p><b>Note</b>: Other possibility to avoid negative values is set to zero this values (radiance and/or reflectance), but this option is ease with uncorrected method and r.mapcalc.</p>
-
-
-<H2>Simplified at-surface values (method=dos[1-4])</H2>
-
-<p>Atmospheric correction and reflectance calibration remove the path radiance, i.e. the stray light from the atmosphere, and the spectral effect of solar illumination. To output these simple <b>at-surface radiance</b> and <b>at-surface reflectance</b>, the equations are (not for thermal bands):
-    <ul>
-    <li> sun_radiance = TAUv · [Esun · sin(e) · TAUz + Esky] / (PI · d^2) </li>
-    <li> radiance_path = radiance_dark - percent · sun_radiance </li>
-    <li> radiance = (at-sensor_radiance - radiance_path) </li>
-    <li> reflectance = radiance / sun_radiance </li>
-  </ul>
-where,
-<em>percent</em> is a value between 0.0 and 1.0 (usually 0.01),
-<em>Esky</em> is the diffuse sky irradiance,
-<em>TAUz</em> is the atmospheric transmittance along the path from the sun to the ground surface, and
-<em>TAUv</em> is the atmospheric transmittance along the path from the ground surface to the sensor.
-<em>radiance_dark</em> is the at-sensor radiance calculated from the darkest object, i.e. DN with a least 'dark_parameter' (usually 1000) pixels for the entire image.</p>
-
-The values are,
-	<ul>
-	<li>DOS1: TAUv = 1.0, TAUz = 1.0 and Esky = 0.0</li>
-	<li>DOS2: TAUv = 1.0, Esky = 0.0, and TAUz = sin(e) for all bands with maximum wave length less than 1. (i.e. bands 4-6 MSS, 1-4 TM, and 1-4 ETM+) other bands TAUz = 1.0</li>
-	<li>DOS3: TAUv = exp[-t/cos(sat_zenith)], TAUz = exp[-t/sin(e)], Esky = rayleigh</li>
-	<li>DOS4: TAUv = exp[-t/cos(sat_zenith)], TAUz = exp[-t/sin(e)], Esky = PI · radiance_dark </li>
-	</ul>
-
-<p><b>Attention</b>: Output radiance remain untouched (i.e. no set to 0. when it is negative) then they are possible negative values. However, output reflectance is set to 0. when is obtained a negative value.</p>
-
-
-<H2>NOTES</H2>
-
-<p>In verbose mode (flag -v), the program write basic data of satellite and the parameters used in
-transformations.</p>
-
-<p>Production date is not a exact value and it is necessary to apply correct calibration constants, which were changed in the dates:
-    <ul>
-    <li>Landsat-1 MSS: never </li>
-    <li>Landsat-2 MSS: July 16, 1975</li>
-    <li>Landsat-3 MSS: June 1, 1978</li>
-    <li>Landsat-4 MSS: August 26, 1982 and April 1, 1983</li>
-    <li>Landsat-4 TM:  August 1, 1983 and January 15, 1984</li>
-    <li>Landsat-5 MSS: April 6, 1984 and November 9, 1984</li>
-    <li>Landsat-5 TM:  May 4, 2003 and April, 2 2007</li>
-    <li>Landsat-7 ETM+: July 1, 2000</li>
-    </ul>
-</p>
-
-<H2>EXAMPLES</H2>
-
-<p>Transform digital numbers of Landsat-7 ETM+ in band rasters 203_30.1, 203_30.2
-[...] to uncorrected at-sensor reflectance in output files 203_30.toar.1,
-203_30.toar.2 [...] and at-sensor temperature in output files 293_39.toar.61 and 293_39.toar.62:</p>
-
-<div class="code"><pre>
-i.landsat.toar -7 band=203_30 met=p203r030_7x20010620.met
-</pre></div>
-
-<p>or</p>
-
-<div class="code"><pre>
-i.landsat.toar -7 band=203_30 product=2004-06-07 date=2001-06-20 solar=64.3242970 gain="HHHLHLHHL"
-</pre></div>
-
-<H2>REFERENCES</H2>
-<ol>
-    <li>Chander G.H. and B. Markham: IEEE Transactions On Geoscience And Remote Sensing, vol. 41, no. 11, November 2003.</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: A First Order Normalization Of Landsat 7 ETM+ Images. 2002.</li>
-    <li>R. Irish: <a href="http://ltpwww.gsfc.nasa.gov/IAS/handbook/handbook_toc.html">Landsat 7. Science Data Users Handbook. February 17, 2007.</a></li>
-    <li>Markham B.L. and J.L. Barker: Landsat MSS and TM Post-Calibration Dynamic Ranges, Exoatmospheric Reflectances and At-Satellite Temperatures. EOSAT Landsat Technical Notes, No. 1, 1986</li>
-    <li>Moran M.S., R.D. Jackson, P.N. Slater and P.M. Teillet: Remote Sensing of Environment, vol. 41. 1992.</li>
-    <li> Song et al : Classification and Change Detection Using Landsat TM Data: When and How to Correct Atmospheric Effects?. Remote Sensing of Environment, vol. 75. 2001. </li>
-
-</ol>
-
-
-<H2>SEE ALSO</H2>
-
-<em>
-<A HREF="r.mapcalc.html">r.mapcalc</A><br>
-<A HREF="r.in.gdal.html">r.in.gdal</A><br>
-</em>
-
-
-<H2>AUTHOR</H2>
-
-E. Jorge Tizado  (ej.tizado unileon es)<br>
-Dept. Biodiversity and Environmental Management, University of León, Spain<BR>
-
-<p>
-<i>Last changed: $Date: 2008/02/10 00:00:00 $</i>

Copied: grass-addons/grass7/imagery/i.landsat.toar/i.landsat.toar.html (from rev 38251, grass-addons/imagery/i.landsat.toar/description.html)
===================================================================
--- grass-addons/grass7/imagery/i.landsat.toar/i.landsat.toar.html	                        (rev 0)
+++ grass-addons/grass7/imagery/i.landsat.toar/i.landsat.toar.html	2009-07-05 19:11:08 UTC (rev 38267)
@@ -0,0 +1,139 @@
+<H2>DESCRIPTION</H2>
+
+<EM>i.landsat.toar</EM> is to transform calibrated digital number of Landsat products to top-of-atmosphere radiance or top-of-atmosphere reflectance and temperature (band 6 of the sensors TM and ETM+). Optionally, to calculate the at-surface radiance or reflectance with atmosferic correction (DOS method).
+
+<p>Usually, to do this the production date, the acquisition date, and the solar elevation is needed. Moreover, also is needed for Landsat-7 ETM+ the gain (high or low) of the nine bands.</p>
+
+<p>Optionally, the data can be read from header file (.met) for all Landsat MSS, TM and ETM+. However, if the solar elevation or the product creation date are given the values of metfile are overwriten. This is necessary when this data in metfile are incorrects or imprecisses.</p>
+
+<p><b>Attention</b>: Any null value or less than QCALmin in input raster is set to null in output raster and it is not included in the equations.</p>
+
+
+<H2>Uncorrected at-sensor values (method=uncorrected, default)</H2>
+
+<p>The standard geometric and radiometric correction results in a calibrated digital number (QCAL = DN) images. To further standardize the impact of illumination geometry, the QCAL images are converted first to at-sensor radiance and then to at-sensor reflectance. The thermal band is first converted from QCAL to at-sensor radiance, and then to effective at-sensor temperature in Kelvin degrees.</p>
+
+<p>Radiometric calibration convert QCAL to <b>at-sensor radiance</b>, a radiometric quantity measured in  W/(m²·sr·µm) with the equations:
+  <ul>
+  <li> gain = (Lmax - Lmin) / (QCALmax - QCALmin)</li>
+  <li> bias = Lmin - gain · QCALmin </li>
+  <li> radiance = gain · QCAL + bias </li>
+  </ul>
+where,
+<em>Lmax</em> and <em>Lmin</em> are the calibration constants, and
+<em>QCALmax</em> and <em>QCALmin</em> are the highest and the lowest points of the range of rescaled radiance in QCAL.
+</p>
+
+<p>Then, to calculate <b>at-sensor reflectance</b> the equations are:
+    <ul>
+    <li> sun_radiance = [Esun · sin(e)] / (PI · d^2)</li>
+    <li> reflectance = radiance / sun_radiance </li>
+  </ul>
+where,
+<em>d</em> is the earth-sun distance in astronomical units,
+<em>e</em> is the solar elevation angle, and
+<em>Esun</em> is the mean solar exoatmospheric irradiance in W/(m²·µm).
+</p>
+
+
+<H2>Corrected at-sensor values (method=corrected)</H2>
+
+<p>At-sensor reflectance values range from zero to one, whereas at-sensor radiance must be greater or equal to zero. However, since Lmin can be a negative number then the at-sensor values also it can be negative. To avoid these possible negative values and set the minimum possible values at-sentor to zero, this method correct the radiance to output a corrected at-sensor values with the equations (not for thermal bands):
+    <ul>
+    <li> radiance = (uncorrected_radiance - Lmin) </li>
+    <li> reflectance = radiance / sun_radiance </li>
+  </ul>
+</p>
+
+<p><b>Note</b>: Other possibility to avoid negative values is set to zero this values (radiance and/or reflectance), but this option is ease with uncorrected method and r.mapcalc.</p>
+
+
+<H2>Simplified at-surface values (method=dos[1-4])</H2>
+
+<p>Atmospheric correction and reflectance calibration remove the path radiance, i.e. the stray light from the atmosphere, and the spectral effect of solar illumination. To output these simple <b>at-surface radiance</b> and <b>at-surface reflectance</b>, the equations are (not for thermal bands):
+    <ul>
+    <li> sun_radiance = TAUv · [Esun · sin(e) · TAUz + Esky] / (PI · d^2) </li>
+    <li> radiance_path = radiance_dark - percent · sun_radiance </li>
+    <li> radiance = (at-sensor_radiance - radiance_path) </li>
+    <li> reflectance = radiance / sun_radiance </li>
+  </ul>
+where,
+<em>percent</em> is a value between 0.0 and 1.0 (usually 0.01),
+<em>Esky</em> is the diffuse sky irradiance,
+<em>TAUz</em> is the atmospheric transmittance along the path from the sun to the ground surface, and
+<em>TAUv</em> is the atmospheric transmittance along the path from the ground surface to the sensor.
+<em>radiance_dark</em> is the at-sensor radiance calculated from the darkest object, i.e. DN with a least 'dark_parameter' (usually 1000) pixels for the entire image.</p>
+
+The values are,
+	<ul>
+	<li>DOS1: TAUv = 1.0, TAUz = 1.0 and Esky = 0.0</li>
+	<li>DOS2: TAUv = 1.0, Esky = 0.0, and TAUz = sin(e) for all bands with maximum wave length less than 1. (i.e. bands 4-6 MSS, 1-4 TM, and 1-4 ETM+) other bands TAUz = 1.0</li>
+	<li>DOS3: TAUv = exp[-t/cos(sat_zenith)], TAUz = exp[-t/sin(e)], Esky = rayleigh</li>
+	<li>DOS4: TAUv = exp[-t/cos(sat_zenith)], TAUz = exp[-t/sin(e)], Esky = PI · radiance_dark </li>
+	</ul>
+
+<p><b>Attention</b>: Output radiance remain untouched (i.e. no set to 0. when it is negative) then they are possible negative values. However, output reflectance is set to 0. when is obtained a negative value.</p>
+
+
+<H2>NOTES</H2>
+
+<p>In verbose mode (flag -v), the program write basic data of satellite and the parameters used in
+transformations.</p>
+
+<p>Production date is not a exact value and it is necessary to apply correct calibration constants, which were changed in the dates:
+    <ul>
+    <li>Landsat-1 MSS: never </li>
+    <li>Landsat-2 MSS: July 16, 1975</li>
+    <li>Landsat-3 MSS: June 1, 1978</li>
+    <li>Landsat-4 MSS: August 26, 1982 and April 1, 1983</li>
+    <li>Landsat-4 TM:  August 1, 1983 and January 15, 1984</li>
+    <li>Landsat-5 MSS: April 6, 1984 and November 9, 1984</li>
+    <li>Landsat-5 TM:  May 4, 2003 and April, 2 2007</li>
+    <li>Landsat-7 ETM+: July 1, 2000</li>
+    </ul>
+</p>
+
+<H2>EXAMPLES</H2>
+
+<p>Transform digital numbers of Landsat-7 ETM+ in band rasters 203_30.1, 203_30.2
+[...] to uncorrected at-sensor reflectance in output files 203_30.toar.1,
+203_30.toar.2 [...] and at-sensor temperature in output files 293_39.toar.61 and 293_39.toar.62:</p>
+
+<div class="code"><pre>
+i.landsat.toar -7 band=203_30 met=p203r030_7x20010620.met
+</pre></div>
+
+<p>or</p>
+
+<div class="code"><pre>
+i.landsat.toar -7 band=203_30 product=2004-06-07 date=2001-06-20 solar=64.3242970 gain="HHHLHLHHL"
+</pre></div>
+
+<H2>REFERENCES</H2>
+<ol>
+    <li>Chander G.H. and B. Markham: IEEE Transactions On Geoscience And Remote Sensing, vol. 41, no. 11, November 2003.</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: A First Order Normalization Of Landsat 7 ETM+ Images. 2002.</li>
+    <li>R. Irish: <a href="http://ltpwww.gsfc.nasa.gov/IAS/handbook/handbook_toc.html">Landsat 7. Science Data Users Handbook. February 17, 2007.</a></li>
+    <li>Markham B.L. and J.L. Barker: Landsat MSS and TM Post-Calibration Dynamic Ranges, Exoatmospheric Reflectances and At-Satellite Temperatures. EOSAT Landsat Technical Notes, No. 1, 1986</li>
+    <li>Moran M.S., R.D. Jackson, P.N. Slater and P.M. Teillet: Remote Sensing of Environment, vol. 41. 1992.</li>
+    <li> Song et al : Classification and Change Detection Using Landsat TM Data: When and How to Correct Atmospheric Effects?. Remote Sensing of Environment, vol. 75. 2001. </li>
+
+</ol>
+
+
+<H2>SEE ALSO</H2>
+
+<em>
+<A HREF="r.mapcalc.html">r.mapcalc</A><br>
+<A HREF="r.in.gdal.html">r.in.gdal</A><br>
+</em>
+
+
+<H2>AUTHOR</H2>
+
+E. Jorge Tizado  (ej.tizado unileon es)<br>
+Dept. Biodiversity and Environmental Management, University of León, Spain<BR>
+
+<p>
+<i>Last changed: $Date: 2008/02/10 00:00:00 $</i>

Modified: grass-addons/grass7/imagery/i.landsat.toar/main.c
===================================================================
--- grass-addons/imagery/i.landsat.toar/main.c	2009-07-05 13:13:50 UTC (rev 38251)
+++ grass-addons/grass7/imagery/i.landsat.toar/main.c	2009-07-05 19:11:08 UTC (rev 38267)
@@ -19,6 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <grass/gis.h>
+#include <grass/raster.h>
 #include <grass/glocale.h>
 
 #include "local_proto.h"
@@ -59,7 +60,8 @@
     /* initialize module */
     module = G_define_module();
     module->description = _("Calculates top-of-atmosphere radiance or reflectance and temperature for Landsat MSS/TM/ETM+");
-    module->keywords = _("Top-Of-Atmosphere Radiance or Reflectance.\n Landsat-1 MSS, Landsat-2 MSS, Landsat-3 MSS, Landsat-4 MSS, Landsat-5 MSS,\n Landsat-4 TM, Landsat-5 TM,\n Landsat-7 ETM+");
+    G_add_keyword(_("imagery"));
+    G_add_keyword(_("top-of-atmosphere radiance or reflectance"));
 
     /* It defines the different parameters */
     input = G_define_option();
@@ -303,20 +305,20 @@
 			for (j = 0; j < 256; j++) hist[j] = 0L;
 
 			snprintf(band_in, 127, "%s.%d", name, lsat.band[i].code);
-			mapset = G_find_cell2(band_in, "");
+			mapset = (char *)G_find_cell2(band_in, "");
 			if (mapset == NULL) {
 				G_warning(_("Raster file [%s] not found"), band_in);
 				continue;
 			}
-			if ((infd = G_open_cell_old(band_in, mapset)) < 0)
+			if ((infd = Rast_open_old(band_in, mapset)) < 0)
 				G_fatal_error(_("Cannot open cell file [%s]"), band_in);
-			if (G_get_cellhd(band_in, mapset, &cellhd) < 0)
+			if (Rast_get_cellhd(band_in, mapset, &cellhd) < 0)
 				G_fatal_error(_("Cannot read file header of [%s]"), band_in);
 			if (G_set_window(&cellhd) < 0)
 				G_fatal_error(_("Unable to set region"));
 
-			in_data_type = G_raster_map_type(band_in, mapset);
-			inrast = G_allocate_raster_buf(in_data_type);
+			in_data_type = Rast_map_type(band_in, mapset);
+			inrast = Rast_allocate_buf(in_data_type);
 
 			nrows = G_window_rows();
 			ncols = G_window_cols();
@@ -324,7 +326,7 @@
 			G_message("Calculating dark pixel of [%s] ... ", band_in);
 			for (row = 0; row < nrows; row++)
 			{
-				G_get_raster_row(infd, inrast, row, in_data_type);
+				Rast_get_row(infd, inrast, row, in_data_type);
 				for (col = 0; col < ncols; col++)
 				{
 					switch(in_data_type)
@@ -342,7 +344,7 @@
 							q = (int)*((DCELL *)ptr);
 							break;
 					}
-					if (!G_is_null_value(ptr, in_data_type) &&
+					if (!Rast_is_null_value(ptr, in_data_type) &&
 						q >= lsat.band[i].qcalmin && q < 256)
 						hist[q]++;
 				}
@@ -372,7 +374,7 @@
 						hist[255] > hist[dn_mode[i]] ? ", excluding DN > 241" : "");
 
 			G_free(inrast);
-			G_close_cell(infd);
+			Rast_close(infd);
 		}
 		/* Calculate transformation constants */
 		lsat_bandctes(&lsat, i, method, percent, dn_dark[i], sat_zenith, rayleigh);
@@ -434,16 +436,16 @@
 		snprintf(band_in, 127, "%s.%d", name, lsat.band[i].code);
 		snprintf(band_out, 127, "%s.toar.%d", name, lsat.band[i].code);
 
-		mapset = G_find_cell2(band_in, "");
+		mapset = (char *) G_find_cell2(band_in, "");
 		if (mapset == NULL) {
 	    	G_warning(_("raster file [%s] not found"), band_in);
 	    	continue; }
 
-		in_data_type = G_raster_map_type(band_in, mapset);
-		if ((infd = G_open_cell_old(band_in, mapset)) < 0)
+		in_data_type = Rast_map_type(band_in, mapset);
+		if ((infd = Rast_open_old(band_in, mapset)) < 0)
 	    	G_fatal_error(_("Cannot open cell file [%s]"), band_in);
 
-		if (G_get_cellhd(band_in, mapset, &cellhd) < 0)
+		if (Rast_get_cellhd(band_in, mapset, &cellhd) < 0)
 	    	G_fatal_error(_("Cannot read file header of [%s]"), band_in);
 
 		/* set same size as original band raster */
@@ -454,12 +456,12 @@
 		if (G_legal_filename(band_out) < 0)
 	    	G_fatal_error(_("[%s] is an illegal name"), band_out);
 
-		if ((outfd = G_open_raster_new(band_out, DCELL_TYPE)) < 0)
+		if ((outfd = Rast_open_new(band_out, DCELL_TYPE)) < 0)
 			G_fatal_error(_("Could not open <%s>"), band_out);
 
 		/* Allocate input and output buffer */
-		inrast  = G_allocate_raster_buf(in_data_type);
-		outrast = G_allocate_raster_buf(DCELL_TYPE);
+		inrast  = Rast_allocate_buf(in_data_type);
+		outrast = Rast_allocate_buf(DCELL_TYPE);
 
 		nrows = G_window_rows();
 		ncols = G_window_cols();
@@ -474,7 +476,7 @@
 			if (verbose)
 				G_percent(row, nrows, 2);
 
-			G_get_raster_row(infd, inrast, row, in_data_type);
+			Rast_get_row(infd, inrast, row, in_data_type);
 			for (col = 0; col < ncols; col++)
 			{
 				switch(in_data_type)
@@ -492,10 +494,10 @@
 							qcal = (double)((DCELL *) inrast)[col];
 							break;
 				}
-				if (G_is_null_value(ptr, in_data_type) ||
+				if (Rast_is_null_value(ptr, in_data_type) ||
 					qcal < lsat.band[i].qcalmin)
 				{
-					G_set_d_null_value((DCELL *)outrast + col, 1);
+					Rast_set_d_null_value((DCELL *)outrast + col, 1);
 				}
 				else
 				{
@@ -519,7 +521,7 @@
 					((DCELL *) outrast)[col] = ref;
 				}
 			}
-			if (G_put_raster_row(outfd, outrast, DCELL_TYPE) < 0)
+			if (Rast_put_row(outfd, outrast, DCELL_TYPE) < 0)
 				G_fatal_error(_("Cannot write to <%s>"), band_out);
 		}
 		ref_mode = 0.;
@@ -532,15 +534,15 @@
 	/* ================================================================= */
 
 		G_free(inrast);
-		G_close_cell(infd);
+		Rast_close(infd);
 		G_free(outrast);
-		G_close_cell(outfd);
+		Rast_close(outfd);
 
 		char command[300];
 		sprintf(command, "r.colors map=%s color=grey", band_out);
 		system(command);
 
-		G_short_history(band_out, "raster", &history);
+		Rast_short_history(band_out, "raster", &history);
 
 		sprintf(history.edhist[0], " %s of Landsat-%d %s (method %s)", lsat.band[i].thermal ? "Temperature": "Reflectance",
 				lsat.number, lsat.sensor, metho->answer);
@@ -568,8 +570,8 @@
 		sprintf (history.edhist[history.edlinecnt], "-----------------------------------------------------------------");
 		history.edlinecnt++;
 
-		G_command_history(&history);
-		G_write_history(band_out, &history);
+		Rast_command_history(&history);
+		Rast_write_history(band_out, &history);
 	}
 
 	exit(EXIT_SUCCESS);



More information about the grass-commit mailing list