Forráskód Böngészése

i.landsat.toar: added scale parameter to make output usable for i.gensigset

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@60957 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 11 éve
szülő
commit
b1443814d7

+ 4 - 0
imagery/i.landsat.toar/i.landsat.toar.html

@@ -103,6 +103,10 @@ output reflectance is set to 0.0 when is obtained a negative value.
 
 <h2>NOTES</h2>
 
+The output raster cell values can be rescaled with the <b>scale</b>
+parameter (e.g., with 100 in case of using reflectance output
+in <em>i.gensigset</em>).
+
 <h3>On Landsat-8 metadata file </h3>
 
 NASA reports a structure of the L1G Metadata file 

+ 11 - 3
imagery/i.landsat.toar/main.c

@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
     RASTER_MAP_TYPE in_data_type;
 
     struct Option *input_prefix, *output_prefix, *metfn, *sensor, *adate,
-	*pdate, *elev, *bgain, *metho, *perc, *dark, *atmo, *lsatmet;
+	*pdate, *elev, *bgain, *metho, *perc, *dark, *atmo, *lsatmet, *oscale;
     char *inputname, *met, *outputname, *sensorname;
     struct Flag *frad, *print_meta, *named;
 
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
     char band_in[GNAME_MAX], band_out[GNAME_MAX];
     int i, j, q, method, pixel, dn_dark[MAX_BANDS], dn_mode[MAX_BANDS], dn_sat;
     int overwrite;
-    double qcal, rad, ref, percent, ref_mode, rayleigh;
+    double qcal, rad, ref, percent, ref_mode, rayleigh, scale;
     unsigned long hist[QCALMAX], h_max;
 
     struct Colors colors;
@@ -213,6 +213,13 @@ int main(int argc, char *argv[])
     lsatmet->descriptions = desc;
     lsatmet->guisection = _("Settings");
 
+    oscale = G_define_option();
+    oscale->key = "scale";
+    oscale->type = TYPE_DOUBLE;
+    oscale->answer = "1.0";
+    oscale->required = NO;
+    oscale->description = _("Scale factor for output");
+
     /* define the different flags */
     frad = G_define_flag();
     frad->key = 'r';
@@ -269,6 +276,7 @@ int main(int argc, char *argv[])
     percent = atof(perc->answer);
     pixel = atoi(dark->answer);
     rayleigh = atof(atmo->answer);
+    scale = atof(oscale->answer);
 
     /*
      * Data from metadata file
@@ -612,7 +620,7 @@ int main(int argc, char *argv[])
 			    ref = lsat_rad2temp(rad, &lsat.band[i]);
 			}
 			else {
-			    ref = lsat_rad2ref(rad, &lsat.band[i]);
+			    ref = lsat_rad2ref(rad, &lsat.band[i]) * scale;
 			    if (ref < 0. && method > DOS)
 				ref = 0.;
 			}