[GRASS-SVN] r66632 - grass/trunk/imagery/i.modis.qc

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 28 02:33:14 PDT 2015


Author: ychemin
Date: 2015-10-28 02:33:14 -0700 (Wed, 28 Oct 2015)
New Revision: 66632

Modified:
   grass/trunk/imagery/i.modis.qc/main.c
Log:
bug fix again for constraint on band number for 09 and 43

Modified: grass/trunk/imagery/i.modis.qc/main.c
===================================================================
--- grass/trunk/imagery/i.modis.qc/main.c	2015-10-28 08:47:11 UTC (rev 66631)
+++ grass/trunk/imagery/i.modis.qc/main.c	2015-10-28 09:33:14 UTC (rev 66632)
@@ -339,13 +339,20 @@
 	G_fatal_error(_("This bit flag is only available for MOD09Q1 @ 250m products"));
 
     if (!strcmp(qcflag, "data_quality")) {
-	if ((bandno < 1 || bandno > 7) 
-        && (!(strcmp(product, "mod09Q1")) 
-        || !(strcmp(product, "mod09A1"))
-        || !(strcmp(product, "mod09CMG"))
-        || !(strcmp(product, "myd09CMG"))
-        || !(strcmp(product, "mcd43B2q"))))
+	if (!strcmp(product, "mod09Q1") && (bandno < 1 || bandno > 2)) 
+	    G_fatal_error(_("Band number out of allowed range [1-2]"));
+	if (!strcmp(product, "mod09A1") && (bandno < 1 || bandno > 7)) 
 	    G_fatal_error(_("Band number out of allowed range [1-7]"));
+	if (!strcmp(product, "mod09CMG") && (bandno < 1 || bandno > 7)) 
+	    G_fatal_error(_("Band number out of allowed range [1-7]"));
+	if (!strcmp(product, "mod09CMGs") && (bandno < 1 || bandno > 7)) 
+	    G_fatal_error(_("Band number out of allowed range [1-7]"));
+	if (!strcmp(product, "mod09CMGi") && (bandno < 1 || bandno > 7)) 
+	    G_fatal_error(_("Band number out of allowed range [1-7]"));
+	if (!strcmp(product, "mod43B2") && (bandno < 1 || bandno > 7))
+	    G_fatal_error(_("Band number out of allowed range [1-7]"));
+	if (!strcmp(product, "mod43B2q") && (bandno < 1 || bandno > 7)) 
+	    G_fatal_error(_("Band number out of allowed range [1-7]"));
 	if (!strcmp(product, "mod09Q1") && bandno > 2)
 	    G_fatal_error(_("mod09Q1 product only has 2 bands"));
     }
@@ -399,7 +406,7 @@
         G_fatal_error(_("This bit flag is only available for MCD43B2 @ 1km products"));
 
      /*mcd43B2q*/
-    if (strcmp(product, "mcd43B2q") && (bandno < 1 || bandno > 7))
+    if (!strcmp(product, "mcd43B2q") && (bandno < 1 || bandno > 7))
 	    G_fatal_error(_("Band number out of allowed range [1-7]"));
 
     infd = Rast_open_old(qcchan, "");



More information about the grass-commit mailing list