Browse Source

added missing mcd43B2 functions

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@44891 15284696-431f-4ddb-bdfa-cd5b030d7da7
Yann Chemin 14 years ago
parent
commit
2857bff53a

+ 20 - 0
imagery/i.modis.qc/mcd43B2a.c

@@ -0,0 +1,20 @@
+/* mcd43B2 SDS Albedo Ancillary QA Flags 1Km bits[0-3]
+ * 0000 -> class 0: Satellite Platform: Terra
+ * 0001 -> class 1: Satellite Platform: Terrra/Aqua
+ * 0010 -> class 2: Satellite Platform: Aqua
+ * 1111 -> class 15: Fill Value
+ * Classes 3-14: Not used
+ */  
+
+#include <grass/raster.h>
+
+CELL mcd43B2a (CELL pixel) 
+{
+    CELL qctemp;
+
+    qctemp = pixel & 0x0F;
+    
+    return qctemp;
+}
+
+

+ 26 - 0
imagery/i.modis.qc/mcd43B2b.c

@@ -0,0 +1,26 @@
+/* mcd43B2 SDS Albedo Ancillary QA Land/Water Flags 1Km bits[4-7]
+ * 0000 -> class 0: Shallow Ocean
+ * 0001 -> class 1: Land (Nothing else but land)
+ * 0010 -> class 2: Ocean and lake shorelines
+ * 0011 -> class 3: Shallow inland water
+ * 0100 -> class 4: Ephemeral water
+ * 0101 -> class 5: Deep inland water
+ * 0110 -> class 6: Moderate or continental ocean
+ * 0111 -> class 7: Deep ocean
+ * 1111 -> class 15: Fill Value
+ * Classes 8-14: Not used
+ */  
+
+#include <grass/raster.h>
+
+CELL mcd43B2b (CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 4;		/*bits [4-7] become [0-3] */
+    qctemp = pixel & 0x0F;
+    
+    return qctemp;
+}
+
+

+ 17 - 0
imagery/i.modis.qc/mcd43B2c.c

@@ -0,0 +1,17 @@
+/* mcd43B2 SDS Albedo Ancillary QA Sun Zenith Angle at local solar noon bits[8-14]
+   Returns integer value [0-90], 127 is Fill Value
+ */  
+
+#include <grass/raster.h>
+
+CELL mcd43B2c (CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 8;		/*bits [8-14] become [0-7] */
+    qctemp = pixel & 0x7F;
+    
+    return qctemp;
+}
+
+

+ 25 - 0
imagery/i.modis.qc/mcd43B2qa.c

@@ -0,0 +1,25 @@
+/* Band-wise Albedo Quality Data 1Km long Int
+ * SDS: BRDF_Albedo_Band_Quality
+ * bits[0-3][4-7][8-11][12-15][16-19][20-23][24-27]
+ * 0000 -> class 0: best quality, 75% or more with best full inversions 
+ * 0001 -> class 1: good quality, 75% or more with full inversions
+ * 0010 -> class 2: Mixed, 50% or less full inversions and 25% or less fill values 
+ * 0011 -> class 3: All magnitude inversions or 50% or less fill values 
+ * 0100 -> class 4: 75% or more fill values 
+ * Classes 5-14: Not Used
+ * 1111 -> class 15: Fill Value
+ */ 
+
+#include <grass/raster.h>
+
+CELL mcd43B2qa(CELL pixel, int bandno) 
+{
+    CELL qctemp;
+
+    pixel >>= 4 * (bandno - 1);	/* bitshift [] to [0-3] etc. */
+    qctemp = pixel & 0x0F;    
+    
+    return qctemp;
+}
+
+