[GRASS-SVN] r56906 - grass/trunk/imagery/i.landsat.toar

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 24 08:49:48 PDT 2013


Author: mmetz
Date: 2013-06-24 08:49:48 -0700 (Mon, 24 Jun 2013)
New Revision: 56906

Modified:
   grass/trunk/imagery/i.landsat.toar/main.c
Log:
i.landsat.toar: multiple lsatmet options

Modified: grass/trunk/imagery/i.landsat.toar/main.c
===================================================================
--- grass/trunk/imagery/i.landsat.toar/main.c	2013-06-24 15:34:19 UTC (rev 56905)
+++ grass/trunk/imagery/i.landsat.toar/main.c	2013-06-24 15:49:48 UTC (rev 56906)
@@ -275,33 +275,40 @@
         lsat.flag = METADATAFILE;
         lsat_metadata(met, &lsat);
 	if (print_meta->answer) {
+	    char *lsatmeta;
+
 	    if (lsatmet->answer == NULL) {
 		G_fatal_error(_("Please use a metadata keyword with -p"));
 	    }
-	    if (strcmp(lsatmet->answer, "number") == 0) {
-		fprintf(stdout,"%d\n",lsat.number);
+
+	    for (i = 0; lsatmet->answers[i] != NULL; i++) {
+		lsatmeta = lsatmet->answers[i];
+		
+		if (strcmp(lsatmeta, "number") == 0) {
+		    fprintf(stdout,"number=%d\n",lsat.number);
+		}
+		if (strcmp(lsatmeta, "creation") == 0) {
+		    fprintf(stdout,"creation=%s\n",lsat.creation);
+		}
+		if (strcmp(lsatmeta, "date") == 0) {
+		    fprintf(stdout,"date=%s\n",lsat.date);
+		}
+		if (strcmp(lsatmeta, "sun_elev") == 0) {
+		    fprintf(stdout,"sun_elev=%f\n",lsat.sun_elev);
+		}
+		if (strcmp(lsatmeta, "sunaz") == 0) {
+		    fprintf(stdout,"sunaz=%f\n",lsat.sun_az);
+		}
+		if (strcmp(lsatmeta, "sensor") == 0) {
+		    fprintf(stdout,"sensor=%s\n",lsat.sensor);
+		}
+		if (strcmp(lsatmeta, "bands") == 0) {
+		    fprintf(stdout,"bands=%d\n",lsat.bands);
+		}
+		if (strcmp(lsatmet->answer, "time") == 0) {
+		    fprintf(stdout,"%f\n",lsat.time);
+		}
 	    }
-	    if (strcmp(lsatmet->answer, "creation") == 0) {
-		fprintf(stdout,"%s\n",lsat.creation);
-	    }
-	    if (strcmp(lsatmet->answer, "date") == 0) {
-		fprintf(stdout,"%s\n",lsat.date);
-	    }
-	    if (strcmp(lsatmet->answer, "sun_elev") == 0) {
-		fprintf(stdout,"%f\n",lsat.sun_elev);
-	    }
-	    if (strcmp(lsatmet->answer, "sunaz") == 0) {
-		fprintf(stdout,"%f\n",lsat.sun_az);
-	    }
-	    if (strcmp(lsatmet->answer, "sensor") == 0) {
-		fprintf(stdout,"%s\n",lsat.sensor);
-	    }
-	    if (strcmp(lsatmet->answer, "bands") == 0) {
-		fprintf(stdout,"%d\n",lsat.bands);
-	    }
-	    if (strcmp(lsatmet->answer, "time") == 0) {
-		fprintf(stdout,"%f\n",lsat.time);
-	    }
 	    exit(EXIT_SUCCESS);
 	}
         G_debug(1, "lsat.number = %d, lsat.sensor = [%s]",



More information about the grass-commit mailing list