/////////////////////////////////////////////////////////////////////////// // NAME: ABI_ADP.h // FUNCTION: Head file. // DESCRIPTION: This is the head file for subroutine "ABI_GranuleData.cpp" // REFERENCE: none // CALLING SEQUENCE: none // INPUTS: none // OUTPUTS: none // DEPENDENCIES: none // RESTRICTIONS: none // HISTORY: none ////////////////////////////////////////////////////////////////////////// /* * ---------------- Convention for Input ABI data -------------------------- * inputs: date - YYYYMMDD * satelliteID - 0: Terra; 1: Aqua * granuleName - example: "A2006252.0005" * * Naming convention for the ABI data files * M?D02xxx.Ayyyyddd.hhmm.vvv.yyyydddhhmmss.hdf * * M?D02 represents an L1B product (?=O: Terra; ?=Y: Aqua) * xxx has value QKM for quarter-kilometer resolution, * HKM for half-kilometer resolution, * 2KM for one-kilometer resolution, * OBC for engineering/calibration data * M?D03_L2: Level 2 data * * A: acquisition date * yyyyddd.hhmm represents the four-digit year; three-digit day (001-366) * hours and minutes for the start of the granule (UTC time) * vvv represents a three-digit Collection Version * yyyydddhhmmss represents the time at which the granule was processed * (UTC time) */ #ifndef _ABIGRANULEDATA_H_ #define _ABIGRANULEDATA_H_ //#include "geninfo.h" #include "mfhdf.h" #include #include "utility.h" #include "ADP_IO.h" using namespace std; // ABI data sets const int32 NUM_ABI_DATASETS = 3; enum ABI_DATASETS {MXD021KM, MXD03, MXD35}; const float64 MISVAL = -999.; // 31 data sets from ABI satellite data , 3 for spaVarFlag, // 3 for spaStd, and 3 for spaMean. const int16 ABI_NDS = 41; // one ABI unit data is 20 x 20 2KM pixels // one scan has 20 2KM pixels along track //const int32 ABI_LINES_PER_SCAN_2KM = 20; //const int32 ABI_LINES_PER_SCAN_2KM = 10; const int32 ABI_LINES_PER_SCAN_2KM = 10; //const int32 ABI_LINES_PER_SCAN_2KM = 1; // 33 index of ABI data variables stored in the m_ABIData (buffers) enum VARINDEX { REFB1, REFB2, REFB3, REFB5, REFB6, REFB7,REFB8,REFB9,REFB10, REFB26,BTB20, BTB21, BTB29, BTB31, BTB32, LATGD,LONGD, HEGHT, SOLZA, SENZA, SOLAZ, SENAZ, LSMSK, CLDMS_Bit09,CLDMS_Bit15,CLDMS_Bit16,CLDMS_Bit18,CLDMS_Bit19,CLDMS_Bit20,CLDMS_Bit27, SICMS, SUNGNT}; /** * pointers of data buffers for a few scans (at least one scan) * (total ABI_NDS[=32] data sets ) * * index explanation unit data type HDF data type *------------------------------------------------------------------------------ * === MXD022KM === * 0- 6: reflectance at channel 1-7 [float64] 23 uint16 * 7-13: %uncertainty of reflectance at channel 1-7 [float64] 21 uint8 * === MXD022KM === * 14: reflectance at channel 26 (1.38um) [float64] 23 uint16 * 15: brightnessTemperature at channel 20(3.75um)K [float64] 23 uint16 * 16: brightnessTemperature at channel 21(3.96um)K [float64] 23 uint16 * 17: brightnessTemperature at channel 29(8.55um)K [float64] 23 uint16 * 18: brightnessTemperature at channel 31(11 um) K [float64] 23 uint16 * 19: brightnessTemperature at channel 32(12 um) K [float64] 23 uint16 * === MXD03 (2KM) === *20-21: latitude/longitude (degree) [float64] 5 float32 * 22: Height (m) [int32] 22 int16 *23-26: sza/vza/sazi/vazi angles (degree) [float64] 22 int16 * 27: land/sea mask [int8] 21 uint8 * === MXD35 (2KM) === * 28: cloud mask [int8] 20 int8 * 29: cloud mask1 [int8] 20 int8 * 30: cloud mask quality [int8] 20 int8 * === MXD07 (5KM) === * 31: total ozone (Dobson) [float64] 22 int16 * 32: total water vapor (cm) [float64] 22 int16 */ typedef struct STRUCT_ABI_DATA{ float32 *pREFB1, *pREFB2, *pREFB3, *pREFB5, *pREFB6, *pREFB7; float32 *pREFB8, *pREFB9,*pREFB10,*pREFB26; float32 *pBTB20, *pBTB21, *pBTB29, *pBTB31, *pBTB32; float32 *pLATGD, *pLONGD; float32 *pHEGHT; float32 *pSOLZA, *pSENZA, *pSOLAZ, *pSENAZ; uint8 *pLSMSK; uint8 *pCLDMS_Bit09; uint8 *pCLDMS_Bit15; uint8 *pCLDMS_Bit16; uint8 *pCLDMS_Bit18; uint8 *pCLDMS_Bit19; uint8 *pCLDMS_Bit20; uint8 *pCLDMS_Bit27; uint8 *pSICMS; uint8 *pSUNGNT; // float32 *pOZONE, *pWATER; /* flag for spatial variability test */ uint8 *spaVarFlag3; // spatial variability test of reflectance on // band 3, 4 and 26 uint8 *spaVarFlag4; // 1: cloudy 0: clear uint8 *spaVarFlag26; // band 3,4 in 2KM resolution; band 26 in 2KM // resolution /* STD and Mean of spatial average for band 1, 2, 31 used in smoke and dust detection */ float32 *spaStd1, *spaStd2, *spaStd31; float32 *spaMean1, *spaMean2, *spaMean31; /* STRUCT_ADP MOD35ASD; // ABI CM from MOD35 file */ }STRUCT_ABI_DATA; class ABI_GranuleData{ public: void allocateRAMforBuffer(int MaxScansPerBlock); void closeInputFiles(); void cleanData(); /* Constructor */ ABI_GranuleData(); /* Destructor */ ~ABI_GranuleData(); /* Set up the data information m_bDataFileNeeded: [MXD022KM, MXD03, MXD35, MXD07] */ bool openInputFiles(string folder, bool* bDataFileNeeded); /* Get how many unit data item from the granule */ public: int32 m_sdsID[ABI_NDS]; char m_inputFileNames[NUM_ABI_DATASETS][STRMAX]; //input HDF file names bool m_bDataFilesNeeded [NUM_ABI_DATASETS]; // flags specifying needed ABI data sets // true: needed (MXD022KM, MXD03, MXD35, MXD07) //uncertainty for each possible scaled uncertainty values of the //first 7 bands float32 m_uncertainty[7][256]; bool m_bReadUncertaintyOf7Bands ; int32 m_nPixTrack_2KM; // number of pixels along track int32 m_nPixScan_2KM; // number of pixels along scan int32 m_linesInBuffer_2KM; int32 scanStart, scanEnd; // index of the scan being stored STRUCT_ABI_DATA m_ABIData; /* h e l p e r f u n c t i o n s */ /* read scan data into memory */ void readScanDataToBuffer(int scanStart, int scanEnd); /* check whether the granule is in night mode */ bool isNightMode(char *filename); //bool isNotUSA(char *filename); // /* functions to collect HDF info and get data */ // void getInputData(); /* functions to collect HDF info and get data */ void getMXD021KMData(); void getMXD021KMBTData(); void getMXD03Data(); void getMXD35Data(); void calRefl(); // int m_count_REFL[6][10]; //int m_count_REFL[6][6]; int32 get021KM_index() const { return m_fileID[MXD021KM]; } int32 get03_index() const { return m_fileID[MXD03]; } private: int32 selectSD(int32 aind, int32 sd_id, char *sds_name, int resolution); int32 m_fileID[NUM_ABI_DATASETS]; bool getFileName(string folder, string type, char* filename); }; #endif /*_ABIGRANULEDATA_H_*/