浏览代码

MYD09CMG/MOD09CMG Qa functions upload

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@61754 15284696-431f-4ddb-bdfa-cd5b030d7da7
Yann Chemin 10 年之前
父节点
当前提交
d0b37e50e6

+ 22 - 0
imagery/i.modis.qc/mod09CMGa.c

@@ -0,0 +1,22 @@
+/* MODLAND QA Bits 500m long int bits[0-1]
+ * 00 -> class 0: Corrected product produced at ideal quality -- all bands
+ * 01 -> class 1: Corrected product produced at less than idel quality -- some or all bands
+ * 10 -> class 2: Corrected product NOT produced due to cloud effect -- all bands
+ * 11 -> class 3: Corrected product NOT produced due to other reasons -- some or all bands mayb be fill value (Note that a value of [11] overrides a value of [01])
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGa(CELL pixel) 
+{
+    CELL qctemp;
+
+    /* Select bit 0 and 1 (right-side).
+     * hexadecimal "0x03" => binary "11" 
+     * this will set all other bits to null */
+    qctemp = pixel & 0x03;
+
+    return qctemp;
+}
+
+

+ 28 - 0
imagery/i.modis.qc/mod09CMGc.c

@@ -0,0 +1,28 @@
+/* Band-wise Data Quality 500m long Int 
+ * bits[2-5][6-9][10-13][14-17][18-21][22-25][26-29]
+ * 0000 -> class 0: highest quality
+ * 0111 -> class 1: noisy detector
+ * 1000 -> class 2: dead detector; data interpolated in L1B
+ * 1001 -> class 3: solar zenith >= 86 degrees
+ * 1010 -> class 4: solar zenith >= 85 and < 86 degrees
+ * 1011 -> class 5: missing input
+ * 1100 -> class 6: internal constant used in place of climatological data for at least one atmospheric constant
+ * 1101 -> class 7: correction out of bounds, pixel constrained to extreme allowable value
+ * 1110 -> class 8: L1B data faulty
+ * 1111 -> class 9: not processed due to deep ocean or cloud
+ * Class 10-15: Combination of bits unused
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGc(CELL pixel, int bandno) 
+{
+    CELL qctemp;
+
+    pixel >>= 2 + (4 * (bandno - 1));	/* bitshift [] to [0-3] etc. */
+    qctemp = pixel & 0x0F;    
+    
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGd.c

@@ -0,0 +1,18 @@
+/* Atmospheric correction 500m long Int bit[30]
+ * 0 -> class 0: Not Corrected product
+ * 1 -> class 1: Corrected product
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGd(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 30;		/* bit no 30 becomes 0 */
+    qctemp = pixel & 0x01;    
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGe.c

@@ -0,0 +1,18 @@
+/* Adjacency correction 500m long Int bit[31]
+ * 0 -> class 0: Not Corrected product
+ * 1 -> class 1: Corrected product
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGe(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 31;		/* bit no 31 becomes 0 */
+    qctemp = pixel & 0x01; 
+    
+    return qctemp;
+}
+
+

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

@@ -0,0 +1,17 @@
+/* cloudy unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGia(CELL pixel) 
+{
+    CELL qctemp;
+
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGib.c

@@ -0,0 +1,18 @@
+/* clear unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGib(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 1;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGic.c

@@ -0,0 +1,18 @@
+/* high clouds unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGic(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 2;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGid.c

@@ -0,0 +1,18 @@
+/* low clouds unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGid(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 3;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGie.c

@@ -0,0 +1,18 @@
+/* snow unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGid(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 4;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGif.c

@@ -0,0 +1,18 @@
+/* fire unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGif(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 5;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGig.c

@@ -0,0 +1,18 @@
+/* sun glint unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGig(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 6;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGih.c

@@ -0,0 +1,18 @@
+/* dust unsigned int bits[4]
+ * 00 -> class 0: no
+ * 01 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGih(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 7;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGii.c

@@ -0,0 +1,18 @@
+/* cloud shadow unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09A1ii(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 8;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGij.c

@@ -0,0 +1,18 @@
+/* pixel adjacent to cloud unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGij(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 9;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

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

@@ -0,0 +1,20 @@
+/* cirrus unsigned int bits[4]
+ * 00 -> class 0: none
+ * 01 -> class 1: small
+ * 10 -> class 2: average
+ * 11 -> class 3: high
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGik(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 10;
+    qctemp = pixel & 0x03;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGil.c

@@ -0,0 +1,18 @@
+/* pan flag unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGil(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 12;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGim.c

@@ -0,0 +1,18 @@
+/* criteria used for aerosol retrieval unsigned int bits[2]
+ * 0 -> class 0: criterion 1
+ * 1 -> class 1: criterion 2
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGim(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 13;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+

+ 18 - 0
imagery/i.modis.qc/mod09CMGin.c

@@ -0,0 +1,18 @@
+/*  AOT (aerosol optical thinkness) has climatological values unsigned int bits[2]
+ * 0 -> class 0: no
+ * 1 -> class 1: yes
+ */  
+
+#include <grass/raster.h>
+
+CELL mod09CMGin(CELL pixel) 
+{
+    CELL qctemp;
+
+    pixel >>= 14;
+    qctemp = pixel & 0x01;
+
+    return qctemp;
+}
+
+