mod09Q1c.c 887 B

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