ocssw  1.0
/disk01/web/ocssw/build/src/l1bgen_modisa/Preprocess.h (r8218/r6020)
Go to the documentation of this file.
00001 #ifndef PREPROCESS_H
00002 #define PREPROCESS_H
00003 
00004 #include    "L1B_Tables.h" /* contained variable definitions used here */
00005 
00006 /*
00007 !C-INC********************************************************************** 
00008 !Description:      Header file Preprocess.h to be included in files 
00009                    where the preprocess routines and data structures 
00010                    are used. 
00011 !Revision History:
00012  $Log: Preprocess.h,v $
00013  Revision 1.12  2011-07-28 15:31:47-04  xgeng
00014  Added FPA index to retrieve LWIR FPA temperature
00015 
00016  Revision 1.10  2011-04-07 14:40:41-04  xgeng
00017  1. RSB &TEB uncertainty algorithm update; 2. The quadratic RSB RVS changed to 4th order.
00018 
00019  Revision 1.9  2006-10-27 11:01:35-04  ltan
00020  Changed for ANSI-C compliance. Correction for the generation of code change log.
00021 
00022  Revision 02.20 June 28, 2002    Razor Issue #161
00023  Moved NUM_*_SUBSAMP definitions to Granule.h
00024  Gwyn Fireman, SAIC-GSO <Gwyn.Fireman@gsfc.nasa.gov>
00025 
00026  Revision 02.18, March 25, 2001  Razor Issue #178
00027  Removed ADC Correction passed parameters
00028  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov) 
00029 
00030  Revision 02.16  March 11, 2002  Razor Issue #174
00031  Added L1B_Gran to Preprocess.c call
00032  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
00033 
00034  Revision 02.15, Dec. 7, 2000, Razor issue 146
00035  Removed DN_sat_prime arrays.
00036  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00037 
00038  Revision 02.14 August 23, 1999
00039  Removed DELTA_bb and dn_bb from Preprocess_Emiss_t.
00040  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
00041 
00042  Revision 02.13 May 7, 1999
00043  Moved DN_to_DN_star to Reflective_Cal, because it is not used in Preporcess
00044  anymore
00045  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
00046 
00047  Revision 02.12 Feb 17, 1999
00048  Moved external function DN_to_DN_star into this module from Reflective_Cal to
00049  avoid circular include dependencies.
00050  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00051 
00052  Revision 02.11 Oct, 1998
00053  Added the prototype for Get_Leading_Gran_Temperatures(), Get_Middle_Gran_Temperatures(),
00054  Get_Trailing_and_Average_Temperatures(), Calculate_PP_Planck_Mir(), Get_Emissive_Bands_ADC_Board(),
00055  Get_Leading_Gran_Emiss_Coeff(), Get_Middle_Gran_Emiss_Coeff(), Get_Trailing_Gran_Emiss_Coeff(),
00056  Get_All_Emiss_Coeff()
00057  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
00058  
00059  Revision 02.10 June 2 , 1998
00060  Modified the prototype for Preprocess_L1A_Data(), Write_L1B_OBCEng() 
00061  ADDed the Calculate_SD_DN_star prototype.
00062  Zhenying Gu (zgu@ltpmail.gsfc.nasa.gov)
00063   
00064  Revision 02.10 Apr. 14, 1998
00065  Removed all old unused v2.0 prototype interfaces (e.g. cleanup.., malloc.. )
00066  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
00067 
00068  Revision 02.10 Apr. 7, 1998
00069  Added MirrorSide to the Overlap_OBCEng_t
00070  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
00071 
00072  Revision 02.10 Apr. 7, 1998
00073  Added the Get_Temps_From_Eng_Data() prototype.
00074  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
00075 
00076  Revision 02.10 Mar. 1998
00077  Rewrite the L1B TEB algorithm using DN vs L
00078  Split the Preprocess_Data_t into Preprocess_Refl_t and Preprocess_Emiss_t
00079  Add the QA_Emiss_t to handle the new TEB QA data
00080  Rewrite the Temperatures_t to include more temperatures and lwir(mwir)_adc
00081  Add macro VAR_Calculation(..)
00082  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
00083  
00084  Revision 01.10 Aug. 1997
00085  Inlined DN_to_Voltage().
00086  Added Temperatures_t and the interface prototypes. 
00087  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
00088 
00089  Revision 01.00 Jan. 1997
00090  Initial development
00091  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
00092 
00093 !References and Credits:
00094    This software is developed by the MODIS Characterization Support
00095    Team (MCST)for the National Aeronautics and Space Administration,
00096    Goddard Space Flight Center, under contract NAS5-32373.
00097 
00098    HDF portions developed at the National Center for Supercomputing
00099    Applications at the University of Illinois at Urbana-Champaign.
00100 
00101 !Design Notes:
00102 
00103 !END***********************************************************************
00104 */
00105 
00106 /* If moon vector is bad value (0, 0, 0), set moon_in_SV_KOB to be -1 */
00107 #define MOON_INSIDE_SV_KOB           1
00108 #define MOON_OUTSIDE_SV_KOB          0
00109 #define UNDETERMINED_MOON_IN_SV_KOB -1
00110 typedef enum {
00111   FP_VIS,              /*index for VIS focal plane*/
00112   FP_NIR,              /*index for NIR focal plane*/
00113   FP_SMIR,             /*index for SMIR/MWIR focal plane*/
00114   FP_LWIR              /*index for LWIR focal plane*/
00115 }FP_Index_t;
00116 
00117 typedef struct {
00118   float32 DN_obc_250m_avg[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP];
00119   float32 DN_obc_500m_avg[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP];
00120   float32 DN_obc_1km_day_avg[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP];
00121   float32 DN_obc_1km_night_avg[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
00122   float32 DN_obc_250m_var[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP];
00123   float32 DN_obc_500m_var[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP];
00124   float32 DN_obc_1km_day_var[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP];
00125   float32 DN_obc_1km_night_var[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
00126   uint32 DN_obc_250m_outlier_mask[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP][2];
00127   uint32 DN_obc_500m_outlier_mask[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP][2];
00128   uint32 DN_obc_1km_day_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP][2];
00129   uint32 DN_obc_1km_night_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP][2]; 
00130 }DN_OBC_Avg_t;
00131 
00132 typedef struct {
00133   float32 var_T_ins; /* holds variance of T_ins over the granule */
00134 } Preprocess_Refl_t;
00135 
00136 typedef struct {
00137 
00138   float32   Planck_mir[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00139   float32   a0        [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00140   float32   sigma_a0  [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00141   float32   b1        [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00142   float32   a2        [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00143   float32   sigma_a2  [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00144   float32   DN_sv     [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00145   float32   dn_bb     [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00146   float32   dn_bb_sdev[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00147   float32   L_bb      [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00148   float32   L_cav     [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS]; 
00149   float32   NEdL[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
00150   /* Temperatures running averaged XGranule
00151   */
00152   float32  T_fp       [NUM_FOCAL_PLANES][MAX_NUM_SCANS];    
00153   float32  T_bb                        [MAX_NUM_SCANS];
00154   float32  T_mir                       [MAX_NUM_SCANS];
00155   float32  T_ins                       [MAX_NUM_SCANS];
00156  
00157 
00158   /* Temperatures averaged over a granule, used in metadata
00159   */
00160   float32 T_bb_gran;
00161   float32 T_mir_gran;
00162   float32 T_fp1;
00163   float32 T_fp2;
00164   float32 T_fp3;
00165   float32 T_fp4;
00166   
00167   /* Focal_Plane_Set_Point_State
00168   */
00169   int8   fp_set_point_state[MAX_NUM_SCANS];
00170 
00171 } Preprocess_Emiss_t;
00172 
00173 typedef struct {
00174   DN_OBC_Avg_t        DN_OBC_Avg;
00175   Preprocess_Refl_t   PP_Refl;
00176   Preprocess_Emiss_t  PP_Emiss;
00177 } Preprocess_Data_t;
00178 
00179 /*
00180  * Preprocess_L1A_Data -- called from main().
00181  */
00182 
00183 PGSt_SMF_status  Preprocess_L1A_Data (lookup_tables_t     *tables,
00184                                       L1A_granule_t       *L1A_Gran, 
00185                                       L1B_granule_t       *L1B_Gran,
00186                                       QA_Data_t           *QA,
00187                                       Preprocess_Data_t   *PP); 
00188 
00189 
00190 #endif
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204