/////////////////////////////////////////////////////////////////////////// // NAME: MODIS_ADP.cpp // FUNCTION: Implementation of the Class_ABI_ADP class. // DESCRIPTION: This is the major program of MODIS smoke/dust detection. // REFERENCE: none // CALLING SEQUENCE: none // INPUTS: none // OUTPUTS: none // DEPENDENCIES: ABI_ADP.h // RESTRICTIONS: none // HISTORY: none ////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include #include "utility.h" #include "ABI_const.h" #include "ABI_ADP.h" /////////////////////////////////////////////////////////////////////////// // NAME: Class_ABI_ADP::Class_ABI_ADP() // FUNCTION: Initial housekeeping // DESCRIPTION: Constructor of class "Class_ABI_ADP" // REFERENCE: non // CALLING SEQUENCE: non // INPUTS: non // OUTPUTS: non // DEPENDENCIES: non RESTRICTIONS: non // HISTORY: non ////////////////////////////////////////////////////////////////////////// Class_ABI_ADP::Class_ABI_ADP() { m_count_fitRefl4=0; } /////////////////////////////////////////////////////////////////////////// // NAME: Class_ABI_ADP::~Class_ABI_ADP() // FUNCTION: Termination housekeeping // DESCRIPTION: Destructor of class "Class_ABI_ADP" // REFERENCE: non // CALLING SEQUENCE: non // INPUTS: non // OUTPUTS: non // DEPENDENCIES: non // RESTRICTIONS: non // HISTORY: non ////////////////////////////////////////////////////////////////////////// Class_ABI_ADP::~Class_ABI_ADP() { } /////////////////////////////////////////////////////////////////////////// // NAME: int main // FUNCTION: The main program // DESCRIPTION: The main routine for the smoke and dust detection algorithm // REFERENCE: non // CALLING SEQUENCE: main(argc, argv[]) // INPUTS: // int argc - number of command line input arguments // char* argv[] - pointer to the command line input argument // OUTPUTS: return value 0: normal // DEPENDENCIES: ProcessADP (called functions) // granuleData - reference of Class_ABI_ADP // RESTRICTIONS: non // HISTORY: non ////////////////////////////////////////////////////////////////////////// int main( ) { cout << "------------- Program Start Now -------------" << endl; string strHelp =""; strHelp = strHelp + "Example script to run this program: \n\n" + " create_SDR_ADP_v5_GranuleHDF_ospo.exe [, configure_file_name] \n\n" + " ex: create_SDR_ADP_v5_GranuleHDF_dblue_ospo.exec \n\n" + " other parameters required will be read from the configure file,\n" + " by default is 'MODIS_ADP_OSPO.config' \n \n" + "Please check the parameters and run again. \n"; char configFname[STRMAX] = "MODIS_ADP_OSPO.config"; Class_ABI_ADP granuleData; granuleData.ProcessADP(configFname); cout << "------------ Program Completed Successfully ------------" << endl; return 0; } /*********************************************/ /******* P U B L I C F U N C T I O N S ******/ /*********************************************/ /////////////////////////////////////////////////////////////////////////// // NAME: void Class_ABI_ADP::ProcessADP // FUNCTION: The driving class // DESCRIPTION: The driving class for processing the smoke and dust detection // REFERENCE: non // CALLING SEQUENCE: ProcessADP(granuleName, configFname) // INPUTS: // string granuleName - name of current granule // char *configFname - pointer to the name of the configuration file // OUTPUTS: non // DEPENDENCIES: // Subroutines: // read_ABI_ADP_configFile, create_ADP_file, openInputFiles, // cleanData, closeInputFiles // mgd - reference of ABI_GranuleData // RESTRICTIONS: non // HISTORY: non ////////////////////////////////////////////////////////////////////////// void Class_ABI_ADP::ProcessADP(char *configFname) { ABI_GranuleData mgd; read_ABI_ADP_configFile(configFname); string sep="/"; string temp=sep; strcat(m_Config.MODIS_data_folder, temp.c_str()); bool dataNeeded[3] = {true, true, true}; bool success; /*************** S E T U P ***************/ success = mgd.openInputFiles(m_Config.MODIS_data_folder,dataNeeded); if (!success) return ; //cout<<"opening completed!"<= (NX_size-boxSize_half)) index_x=NX_size-boxSize_half-1; if( index_y < boxSize_half) index_y=boxSize_half; if( index_y >= (NY_size-boxSize_half)) index_y=NY_size-boxSize_half-1; int Nvalidpindex_xels=0; float32 rmean = 0; float32 rsqd = 0; float32 value; for (int jindex=index_y-boxSize_half; jindex<= index_y+boxSize_half; jindex++){ int32 pos= jindex * NX_size ; for (int iindex=index_x-boxSize_half; iindex<= index_x+boxSize_half; iindex++){ value = *(pdata +pos+iindex); if (value > 0) { rmean += value; rsqd += (value * value); Nvalidpindex_xels++; } }//iindex }//jindex *mean_value = MeanStdDev_Default; *StdDev_value = MeanStdDev_Default; if(Nvalidpindex_xels ==1) { *mean_value = rmean ; *StdDev_value = 0; }else if(Nvalidpindex_xels >1) { value = (rsqd - (rmean *rmean /Nvalidpindex_xels) ) / (Nvalidpindex_xels-1); if (value > 0.) { *mean_value = rmean /Nvalidpindex_xels; *StdDev_value = sqrt(value); } } return Nvalidpindex_xels; } /////////////////////////////////////////////////////////////////////////// // NAME: void Class_ABI_ADP::sliding_mean_StdDev_of_scan // FUNCTION: Perform spatial average. // DESCRIPTION: Perfrom 3 by 3 pixel spatial average for a scan // REFERENCE: none // CALLING SEQUENCE: sliding_mean_StdDev_of_scan(NX_size, NY_size, boxsize, // data, meandata, stddata) // INPUTS: // int NX_size - Size of subdomain in x-direction // int NY_size - Size of subdomain in y-direction // int boxsize - Size of subdomain // float32 *data - Pointer to the processed data // OUTPUTS: // float32 *meandata - Pointer to spatially averaged data // float32 *stddata - Standard deviation of spatially averaged data // DEPENDENCIES: calculateStdDev - Subroutine // RESTRICTIONS: non // HISTORY: non ////////////////////////////////////////////////////////////////////////// void Class_ABI_ADP::sliding_mean_StdDev_of_scan(int NX_size,int NY_size, int boxsize,float32 *data, float32 *meandata, float32 *stddata) { // loop over each scan line for (int32 index_y=0; index_ypCLDMS_Bit15 + index2KM); Cloud35_Bit16 = *(pABIData->pCLDMS_Bit16 + index2KM); Cloud35_Bit18 = *(pABIData->pCLDMS_Bit18 + index2KM); Snow_Ice = *(pABIData->pSICMS + index2KM); if ((Snow_Ice ==1 )) { tmp_mask=10; return; } if ((Cloud35_Bit15 == 1 ) || (Cloud35_Bit16 == 1 ) || (Cloud35_Bit18 == 1 )) { tmp_mask=1; return; } float64 Refl_Chn1, Refl_Chn2, Refl_Chn3, Refl_Chn5, Refl_Chn7; float64 Refl_Chn2_Mean, Refl_Chn2_Sigma, Refl_Chn3_Mean; uint8 fire=0; Refl_Chn1 = *(pABIData->pREFB1 + index2KM); //0.66um Refl_Chn2 = *(pABIData->pREFB2 + index2KM); //0.86um Refl_Chn3 = *(pABIData->pREFB3 + index2KM); //0.47um Refl_Chn5 = *(pABIData->pREFB6 + index2KM); //1.61um Refl_Chn7 = *(pABIData->pREFB7 + index2KM); //2.13um Refl_Chn2_Mean = *(pABIData->spaMean2 + index2KM); //0.86um Refl_Chn2_Sigma = *(pABIData->spaStd2 + index2KM); //0.86um Refl_Chn3_Mean = *(pABIData->spaMean31 + index2KM); //11.0um tmp_mask=2; if(Refl_Chn2 > 0 && Refl_Chn3 > 0 && Refl_Chn5>0 && Refl_Chn7 > 0 ) { tmp_mask=3; float64 smkrat1 = Refl_Chn3/Refl_Chn5; float64 smkrat2 = Refl_Chn7/Refl_Chn5; if(Refl_Chn2_Sigma <= SONCSTD086) { if((smkrat1 >=SONCRAT1_1) && (Refl_Chn3 >= SONC047) && (Refl_Chn5 >= SONC123_L) && (Refl_Chn5 < SONC123_U) && (smkrat2 < SONCRAT2_1)) { tmp_mask=5; //Determine confidence level float32 Con_Lev1 = ConfidenceLevel_U(smkrat1, SONCRAT1_1); float32 Con_Lev2 = ConfidenceLevel_U(Refl_Chn3, SONC047); float32 Con_Lev3 = ConfidenceLevel_M(Refl_Chn5, SONC123_L,SONC123_U); float32 Con_Lev4 = ConfidenceLevel_L(smkrat2,SONCRAT2_1); float32 Con_Lev =(Con_Lev1+Con_Lev2+Con_Lev3+Con_Lev4)/4.0; if( Con_Lev <=0.25 ) int mask_con=1; if( Con_Lev >=0.75 ) int mask_con=3; if( Con_Lev >0.25 && Con_Lev <0.75 ) int mask_con=2; return; //end of determination } if (Refl_Chn2>SONC086) { if((smkrat1 >=SONCRAT1_2 )) { tmp_mask=4; //Determine confidence level float32 Con_Lev1 =ConfidenceLevel_U(smkrat1, SONCRAT1_2); float32 Con_Lev =Con_Lev1; /* if(Con_Lev ==0.0 ) int mask_con=1; if(Con_Lev ==0.5 ) int mask_con=2; if(Con_Lev ==1.0 ) int mask_con=3; if( abs(Con_Lev) <1.e-6 ) int mask_con=1; if( abs(Con_Lev-0.5) <1.e-6 ) int mask_con=2; if( abs(Con_Lev-1.0) <1.e-6 ) int mask_con=3; if( abs(Con_Lev) <1.e-15 ) int mask_con=1; if( abs(Con_Lev-0.5) <1.e-15 ) int mask_con=2; if( abs(Con_Lev-1.0) <1.e-15 ) int mask_con=3; */ if((int) Con_Lev == 0 ) mask_con=1; if((int) (Con_Lev*10) ==5 ) mask_con=2; if((int) (Con_Lev*10) ==10 ) mask_con=3; return; //end of determination } } } if (Refl_Chn2>SONC086) { if((smkrat1 >=SONCRAT1_2) && (smkrat2 < SONCRAT2_2)) { tmp_mask=4; //Determine confidence level float32 Con_Lev1 =ConfidenceLevel_U(smkrat1, SONCRAT1_2); float32 Con_Lev2 =ConfidenceLevel_L(smkrat2, SONCRAT2_2); float32 Con_Lev =(Con_Lev1+Con_Lev2)/2.0; if(Con_Lev <=0.25 ) int mask_con=1; if(Con_Lev >=0.75 ) int mask_con=3; if(Con_Lev >0.25 && Con_Lev <0.75 ) int mask_con=2; return; //end of determination } } } } /////////////////////////////////////////////////////////////////////////// // NAME: void Class_ABI_ADP::dustMaskingOcean // FUNCTION: Peform dust detection over water // DESCRIPTION: Peform dust detection over water // Dust Value // 0: no dust detected. // 1: dust detected. // REFERENCE: ATBD of ABI Aerosol Imagery Product (Version 0.1) // CALLING SEQUENCE: dustMaskingOcean(pABIData,index2KM,mask) // INPUTS: // STRUCT_ABI_DATA *pABIData - Pointer to the current processing data // int32 index2KM - Index of the data in 1-km resolution // OUTPUTS: uint8 &mask - Reference to the masking flag // DEPENDENCIES: none // RESTRICTIONS: none // HISTORY: none ////////////////////////////////////////////////////////////////////////// void Class_ABI_ADP::dustMaskingOcean(STRUCT_ABI_DATA *pABIData, int32 index2KM, uint8 &tmp_mask,uint8 &tmp_mask_db,uint8 &mask_con) //int32 index2KM, short &tmp_mask,short &tmp_mask_db,short &mask_con) { int8 Cloud35_Bit09, Cloud35_Bit15, Cloud35_Bit16, Cloud35_Bit18, Cloud35_Bit19, Cloud35_Bit27; uint8 Snow_Ice; mask_con=1; /* Pass M?D35 15, 18 Cloud Test */ Cloud35_Bit15 = *(pABIData->pCLDMS_Bit15 + index2KM); Cloud35_Bit18 = *(pABIData->pCLDMS_Bit18 + index2KM); Snow_Ice = *(pABIData->pSICMS + index2KM); if ((Snow_Ice ==1 )) { tmp_mask=20; return; } if ((Cloud35_Bit15 == 1 ) || (Cloud35_Bit18 == 1 )) { //cout<<"Cloud35_Bit15= "<= (total_scans-1)) scanEnd = total_scans-1; memset(pCM0,0,field_size*4); memset(pqual0,0,field_size*5); gd.readScanDataToBuffer(scanStart, scanEnd); printf(" Read scans= [%d, %d] \n",scanStart, scanEnd); /* perfrom spatial varibility test on reflectance at Band3 (0.47um) */ // spatialVaribityTests(gd); /* perform spatial average on reflectance at Band1 (0.66um) (land smoke); Band 2 (0.86um) (ocean dust), and on BT at Band31 (11um) (land dust) used for smoke and dust detection. */ spatialMeanStd(gd); pIsLand = pABIData->pLSMSK; float32 **pMdata= (float32 **)&gd.m_ABIData; for (i_index=0; i_index< gd.m_linesInBuffer_2KM; i_index++){ for (j_index=0; j_index< gd.m_nPixScan_2KM; j_index++){ index2KM = i_index * nPixScan2km +j_index; // index of 2KM data // for(int k_index=0; k_index<7; k_index++){ // float temp = absCorRefl[k_index] ; // gd.m_count_REFL[3][k_index]++; // if(temp >0 && temp <1 ) gd.m_count_REFL[2][k_index]++; // } //Initilization uint8 mask=0; uint8 mask_ism=0; uint8 mask_db=0; uint8 mask_c=0; /*short mask=0; short mask_ism=0; short mask_db=0; short mask_c=0;*/ float32 SunGlintA=Missing_Value; // calculating sunglint angle float32 SOLZA = pABIData->pSOLZA[index2KM]; float32 SENZA = pABIData->pSENZA[index2KM]; float32 SOLAZ = pABIData->pSOLAZ[index2KM]; float32 SENAZ = pABIData->pSENAZ[index2KM]; SunGlintA = SunGlintAng(SOLZA, SENZA, SOLAZ, SENAZ); // ADP.sungt[index2KM]=0; // if ( SunGlintA < ABI_SunGlint ) { // ADP.sungt[index2KM]=1; // } /*if (pix_index == 25363 || pix_index == 25364 || pix_index == 25365) { cout<<"---------------------------------"< 0.0 && SunGlintA < ABI_SunGlint ) { Qual_Flag.Byte3[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte3[index2KM], 2); //sunglint source Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 1); } //land/sea mask from input (0 - water, 1 - land) // ADP.lndwat[index2KM]=pABIData->pLSMSK[index2KM]; //set product quality information: land/water flag if (*(pABIData->pLSMSK + index2KM) ==1 ) { Qual_Flag.Byte3[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte3[index2KM], 3); } //day/night defined by solar zenith angle // product quality information: day/night 1 -night 0- day if (SOLZA > 87.0) { // ADP.day[index2KM]=1; Qual_Flag.Byte3[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte3[index2KM], 4); continue; //jump out the process for this pixel. } //* set product quality information: input quality (0 -good 1- bad) if (*(pABIData->pLONGD + index2KM) >180 || *(pABIData->pLONGD + index2KM) <-180) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 1); continue; } if (*(pABIData->pLATGD + index2KM) >90 || *(pABIData->pLATGD + index2KM) <-90) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 2); continue; } if (*(pABIData->pSOLZA + index2KM) <0 || *(pABIData->pSOLZA + index2KM) > 90) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 4); continue; } if (*(pABIData->pSOLZA + index2KM) >60 && *(pABIData->pSOLZA + index2KM) <= 90) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 3); Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 4); } if (*(pABIData->pSENZA + index2KM) <0 || *(pABIData->pSENZA + index2KM) > 90) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 6); continue; } if (*(pABIData->pSENZA + index2KM) >60 && *(pABIData->pSENZA + index2KM) <= 90) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 5); Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 6); } //* set product quality information: input source: (fix me later) //SNOW/ICE MASK /*if (CASE 1:from IMS) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 8); } */ if (*(pIsLand + index2KM) == 1) { /* Land process */ /* Smoke detection */ smokeMaskingLand(pABIData, index2KM, mask,mask_ism,mask_c); //quality flag: snow/ice source (00: from ABI mask; 01:from IMS mask ; 11 from internal mask) if (mask_ism == 16 ) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 7); Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 8); } if (mask == 2 ) { // set production quality information: input data Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 5); } //set quality flag: smoke over land //determination flag (0 determined 1-not determined) if (mask == 2 || mask==10 ||mask==1 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 1); } // set production quality information: clouds if (mask == 1 ) { Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 6); } //set production quality information: snow/ice mask // if(mask_snow == 5 || mask_snow == 6){ // Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 7); // } if(mask == 10 ){ Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 7); } if(mask_ism == 16 && mask != 1){ Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 7); } //set production quality information: smoke type if(mask == 5 ) { Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 8); } // confidence flag for smoke if(mask_c ==2 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 4); } if(mask_c ==3 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 3); Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 4); } // // if(mask == 1 ) ADP.cldmsk[index2KM] =1; if (mask == 4 || mask ==5 ) ADP.smoke[index2KM] =1; // if(mask_snow == 5 || mask_snow == 6) ADP.snowice[index2KM]=1; if (mask == 4 || mask ==5 ) ADP.aerosol[index2KM] =1; /* Dust detection */ dustMaskingLand(pABIData, index2KM, mask,mask_ism,mask_db,mask_c); if (mask == 12) { // set production quality information: input data Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 1); } //set qulaity flag: dust over land //determination flag (0 determined 1-not determined) if (mask == 12 || mask==20 || mask == 11 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 2); } // // set production quality information: clouds if (mask == 11 ) { Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 2); } // set production quality information: snow/ice // if(mask_snow == 5 || mask_snow == 6){ // // Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 3); // } //quality flag: snow/ice source if (mask_ism == 26 ) { Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 7); Qual_Flag.Byte2[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte2[index2KM], 8); } if(mask == 20 ){ Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 3); } if( mask_ism == 26 && mask !=11){ Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 3); } // set production quality information: dust type if(mask == 15 ) { Qual_Flag.Byte5[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte5[index2KM], 4); } // confidence flag for dust if(mask_c == 2 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 6); } if(mask_c == 3 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 5); Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 6); } // // if(mask == 11 ) ADP.cldmsk[index2KM] =1; if(mask_db == 14 ) ADP.dust_db[index2KM] =1; if(mask == 14 || mask ==15 ) ADP.dust[index2KM] =1; if(mask == 14 || mask ==15 ) ADP.aerosol[index2KM] =1; // if(mask_snow == 5 || mask_snow == 6) ADP.snowice[index2KM]=1; /*if (pix_index == 25363 || pix_index == 25364 || pix_index == 25365) cout<<" Land----"<pCLDMS_Bit15 + index2KM)); printf("Cloud35_Bit18= %d\n",*(pABIData->pCLDMS_Bit18 + index2KM)); }*/ if (mask == 12 ) { // set production quality information: input data Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 1); } //set qulaity flag: dust over water //determination flag (0 determined 1-not determined) if ( mask == 12 || mask == 20 || mask == 11 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 2); } //set production quality information: cloud if ( mask == 11 ) { Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 2); } //set production quality information: snow/ice if( mask == 20 ){ Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 3); } //set production quality information: dust type if( mask == 15 ) { Qual_Flag.Byte4[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte4[index2KM], 4); } // confidence flag for dust if(mask_c ==2 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 6); } if(mask_c ==3 ) { Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 5); Qual_Flag.Byte1[index2KM]= Set_QualityFlag_bit(Qual_Flag.Byte1[index2KM], 6); } //if (pix_index == 25363) // cout<<"DB dust mask = "<pLATGD+pos_skipped); printf(" write SDS: '%s'\n", output_sd_name[0]); HDF_SWwritefield(swid, output_sd_name[1], start2d, NULL, edge2d,pABIData->pLONGD+pos_skipped); printf(" write SDS: '%s'\n", output_sd_name[1]); // 3 flag from ABI algorithm char IP_SDname3Flag[20]="ABI ADP Flags"; char IP_SDname3Flag_qual[25]="ABI ADP Quality Flags"; /* the SDS "ABI ADP Flags" contains: aerosol flag, smoke flsg,dust flag */ // one byte per variable for (k_index=0; k_index< 4; k_index++){ start3d[0]= k_index; HDF_SWwritefield(swid, IP_SDname3Flag, start3d, NULL, edge3d,pADP[k_index]+pos_skipped); } /* the SDS "ABI ADP Quality Flags" contains various quality flgas as shown in Table 1 in ATBD*/ // one byte per variable for (k_index=0; k_index< 5; k_index++){ start3d[0]= k_index; HDF_SWwritefield(swid, IP_SDname3Flag_qual, start3d, NULL, edge3d,pqual[k_index]+pos_skipped); } time_t time_end=time(NULL); //how much time used to read data int seconds_used = int(difftime( time_end , time_begin)); printf(" used% d seconds, estimated total time= %5.2f minutes\n", seconds_used, (double(time_end - time_begin)/(iBlock+1) * NBlocks /60 )); } free(pqual0); free(pCM0); } /////////////////////////////////////////////////////////////////////////// // NAME: void Class_ABI_ADP::read_ABI_ADP_configFile // FUNCTION: Read input configuration file. // DESCRIPTION: Read input configuration file. // REFERENCE: // CALLING SEQUENCE: read_ABI_ADP_configFile(configFname) // INPUTS: char *configFname - Pointer to the configuration file // OUTPUTS: none // DEPENDENCIES: // Subroutine // getTextFileContent, getTagValue // RESTRICTIONS: none // HISTORY: none ////////////////////////////////////////////////////////////////////////// void Class_ABI_ADP::read_ABI_ADP_configFile(char *configFname) { char *strConfig = getTextFileContent(configFname); if (VERBOSE > 0 ) printf(" Read config file: '%s'.\n", configFname ); char tempstring[STRMAX]; getTagValue(strConfig, "MODIS_data_folder", tempstring); strcpy(m_Config.MODIS_data_folder , (strcmp(tempstring, "") == 0 )? "./" : tempstring); getTagValue(strConfig, "output_ADP_folder", tempstring); strcpy(m_Config.output_ADP_folder,(strcmp(tempstring, "") == 0 )? "./" : tempstring); free(strConfig); }