[GRASS-SVN] r48917 -
grass/branches/develbranch_6/imagery/i.landsat.toar
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 23 16:20:12 EDT 2011
Author: martinl
Date: 2011-10-23 13:20:12 -0700 (Sun, 23 Oct 2011)
New Revision: 48917
Modified:
grass/branches/develbranch_6/imagery/i.landsat.toar/main.c
Log:
i.landsat.toar: add overwrite flag
Modified: grass/branches/develbranch_6/imagery/i.landsat.toar/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.landsat.toar/main.c 2011-10-23 20:04:33 UTC (rev 48916)
+++ grass/branches/develbranch_6/imagery/i.landsat.toar/main.c 2011-10-23 20:20:12 UTC (rev 48917)
@@ -48,6 +48,7 @@
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];
+ int overwrite;
double qcal, rad, ref, percent, ref_mode, sat_zenith, rayleigh;
struct Colors colors;
@@ -63,7 +64,8 @@
module->description =
_("Calculates top-of-atmosphere radiance or reflectance and temperature for Landsat MSS/TM/ETM+.");
module->keywords = _("imagery, landsat, top-of-atmosphere reflectance, dos-type simple atmospheric correction");
-
+ module->overwrite = TRUE;
+
/* It defines the different parameters */
input_prefix = G_define_option();
input_prefix->key = "input_prefix";
@@ -207,6 +209,8 @@
outputname = output_prefix->answer;
sensorname = sensor -> answer ? sensor->answer: "";
+ overwrite = G_check_overwrite(argc, argv);
+
G_zero(&lsat, sizeof(lsat));
if (adate->answer != NULL) {
@@ -478,6 +482,15 @@
continue;
}
+ if (G_find_cell2(band_out, "")) {
+ if (overwrite) {
+ G_warning(_("Raster map <%s> already exists and will be overwritten"), band_out);
+ }
+ else {
+ G_warning(_("Raster map <%s> exists. Skipping."), band_out);
+ continue;
+ }
+ }
if ((infd = G_open_cell_old(band_in, mapset)) < 0)
G_fatal_error(_("Unable to open raster map <%s>"), band_in);
in_data_type = G_raster_map_type(band_in, mapset);
More information about the grass-commit
mailing list