[GRASS-SVN] r57957 - grass/trunk/imagery/i.landsat.toar
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 8 13:25:45 PDT 2013
Author: mmetz
Date: 2013-10-08 13:25:44 -0700 (Tue, 08 Oct 2013)
New Revision: 57957
Modified:
grass/trunk/imagery/i.landsat.toar/main.c
Log:
i.landsat.toar: fix window handling
Modified: grass/trunk/imagery/i.landsat.toar/main.c
===================================================================
--- grass/trunk/imagery/i.landsat.toar/main.c 2013-10-08 14:22:49 UTC (rev 57956)
+++ grass/trunk/imagery/i.landsat.toar/main.c 2013-10-08 20:25:44 UTC (rev 57957)
@@ -35,7 +35,7 @@
struct GModule *module;
char *desc;
- struct Cell_head cellhd;
+ struct Cell_head cellhd, orig_cellhd;
void *inrast, *outrast;
int infd, outfd;
@@ -245,6 +245,8 @@
overwrite = G_check_overwrite(argc, argv);
+ Rast_get_window(&orig_cellhd);
+
G_zero(&lsat, sizeof(lsat));
if (adate->answer != NULL) {
@@ -397,10 +399,10 @@
hist[q] = 0L;
sprintf(band_in, "%s%d", inputname, lsat.band[i].code);
+ Rast_get_cellhd(band_in, "", &cellhd);
+ Rast_set_window(&cellhd);
if ((infd = Rast_open_old(band_in, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), band_in);
- Rast_get_cellhd(band_in, "", &cellhd);
- G_set_window(&cellhd);
in_data_type = Rast_get_map_type(infd);
if (in_data_type < 0)
@@ -535,6 +537,9 @@
(named->answer ? lsat.band[i].number : lsat.band[i].code));
sprintf(band_out, "%s%d", outputname, lsat.band[i].code);
+ /* set same size as original band raster */
+ Rast_get_cellhd(band_in, "", &cellhd);
+ Rast_set_window(&cellhd);
if ((infd = Rast_open_old(band_in, "")) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), band_in);
@@ -552,11 +557,7 @@
in_data_type = Rast_get_map_type(infd);
if (in_data_type < 0)
G_fatal_error(_("Unable to read data type of raster map <%s>"), band_in);
- Rast_get_cellhd(band_in, "", &cellhd);
- /* set same size as original band raster */
- G_set_window(&cellhd);
-
/* controlling, if we can write the raster */
if (G_legal_filename(band_out) < 0)
G_fatal_error(_("<%s> is an illegal file name"), band_out);
@@ -722,6 +723,7 @@
else
Rast_write_units(band_out, "unitless");
}
+ Rast_set_window(&orig_cellhd);
exit(EXIT_SUCCESS);
}
More information about the grass-commit
mailing list