ocssw  1.0
/disk01/web/ocssw/build/src/l1bgen_modisa/L1B_Tables.h (r8087/r6020)
Go to the documentation of this file.
00001 #ifndef  L1B_TABLES_H
00002 #define  L1B_TABLES_H
00003 
00004 #include  "Granule.h" /* contain hdf.h, mfhdf.h, etc, and the definition of macros */
00005 
00006 /*
00007 !C-INC**********************************************************************
00008 !Description:  Header file L1B_Tables.h to be included in files where the 
00009                lookup table routines are defined.
00010 
00011 !Revision History:
00012  $Log: L1B_Tables.h,v $
00013  Revision 1.52  2011-07-28 15:30:07-04  xgeng
00014  Added 3 new luts for the Aqua default b1 algorithm change
00015 
00016  Revision 1.50  2011-04-19 13:46:52-04  ltan
00017  PGE02_VERSION updated
00018 
00019  Revision 1.49  2011-04-07 18:04:59-04  xgeng
00020  1. RSB &TEB uncertainty algorithm update; 2. The quadratic RSB RVS changed to 4th order.
00021 
00022  Revision 1.46  2010-11-15 11:23:22-05  xgeng
00023  PGE02_VERSION updated to 6.1.9
00024 
00025  Revision 1.44  2009/11/27 19:18:28  xgeng
00026  PGE02_VERSION updated to V6.1.7
00027 
00028  Revision 1.43  2009/08/31 17:40:19  xgeng
00029  Change LOG to Log
00030 
00031  Revision 1.38  2009/07/24 15:50:46  xgeng
00032  PGE Version updated to 6.1.3
00033 
00034  Revision 1.37  2008/12/24 15:50:46  xgeng
00035  PGE Version updated to 6.1.1
00036  
00037  Revision 1.36, Janurary 7, 2007  Razor Issue #216
00038  Added a new QA table name "DET_QUAL_FLAG2_VALS_LUT_NAME"
00039  Added "Detector_Quality_Flag2_Values" and "Detector_Quality_Flag2"
00040        in structure common_QA_tables_t
00041  Updated PGE02_VERSION
00042  Xu Geng, SAIC GSO (xu.geng@saic.com)
00043  
00044  Revision 1.35  2008/01/24 15:50:46  ltan
00045  PGE02_VERSION updated for version 5.0.35
00046 
00047  Revision 1.33  2006/10/30 20:28:56  ltan
00048  Changed for ANSI-C compliance. Correction for the generation of code change log. Comments updated.
00049 
00050  Revision 03.22, October 15, 2004  Razor Issue #201
00051  Added a new dimension of Mirror Side to array "Band_21_b1".
00052  Liqin Tan, SAIC GSO  (ltan@saicmodis.com)
00053 
00054  Revision 03.21, October 15, 2004  Razor Issue #199
00055  Added a new macro definition of "SWIR_CORR_SENDING_DETECTOR_LUT_NAME".
00056  Added a new one-dimension array of "SWIR_corr_sending_detector" in
00057  structure SWIR_correction_tables_t.
00058  Liqin Tan, SAIC GSO  (ltan@saicmodis.com)
00059 
00060  Revision 03.20, November 7, 2003
00061  Increased buffer sizes for ALGORITHMPACKAGEMATURITYCODE and MISSION_PHASE
00062  to 15.
00063  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00064 
00065  Revision 03.19, October 31, 2003  Razor Issue #195
00066  Removed LUT ProcessingCenter from the QA LUT structure. Removed macros
00067  "MAX_PROCESSINGCENTER_BUFFER" and "PROCESSING_CENTER_LUT_NAME.
00068  Liqin Tan, SAIC GSO  (ltan@saicmodis.com)
00069 
00070  Revision 03.18  October 24, 2003  Razor Issue #196 (formerly Issue #184)
00071  Added LUTs roll_threshold_angle, pitch_threshold_angle, and
00072  yaw_threshold_angle to QA LUT structure. Added macro
00073  "NUM_ATTITUDE_ANGLES".
00074  Liqin Tan, SAIC GSO  (ltan@saicmodis.com)
00075 
00076  Revision 03.17  March 26, 2003  Razor Issue #190
00077  Added LUTs "B26_B5_Corr", "B26_B5_Corr_Switch",
00078    "B26_B5_Frame_Offset", previously added to Terra code
00079    (Razor Issue #182)
00080  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00081 
00082  Revision 03.16  March 26, 2003  Razor Issue #191
00083  Added SWIR OOB sending band LUT structure.
00084  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00085 
00086  Revision 03.15 Oct. 3, 2002    Razor Issue #187
00087  Removed R_star from refl_tables_t structure. 
00088  Liqin Tan, SAIC GSO (ltan@saicmodis.com)
00089 
00090  Revision 03.14 July 2, 2002    Razor Issue #161
00091  Added function prototypes for BDSM_index and Expand_BDSM_LUTs.
00092  Gwyn Fireman, SAIC-GSO <Gwyn.Fireman@gsfc.nasa.gov>
00093 
00094  Revision 03.13  June 5, 2002  Razor Issue #183
00095  Change type of dn_sat_ev to float64.
00096  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00097 
00098  Revision 03.12  March 25, 2002  Razor Issue #178
00099  Remove ADC Correction and Associated LUTs
00100  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00101 
00102  Revision 03.1   March 8, 2002   Razor Issue #174
00103  Removed LUTs "RVS_250m", "RVS_500m", "RVS_1km_RefSB", "RVS_1km_Emiss_SV", 
00104      "RVS_1km_Emiss_BB", "RVS_1km_Emiss_EV"
00105  Added LUTs "RVS_RefSB", "RVS_TEB", "RVS_BB_SV_Frame_No"
00106  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00107  
00108  Revision 03.08 January 27, 2002 
00109  Razor Issue #175:  Added new LUTs BB_T_SAT_SWITCH_AQUA, BB_T_SAT_AQUA,
00110    BB_T_SAT_DEFAULT_B1_AQUA to emiss_tables_t for use with Aqua.  
00111  Razor Issue #179: Changed maximum number of allowable wavelengths for 
00112    RSR tables to 66 to accomodate Aqua
00113  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov)
00114 
00115  Revision 03.07  November 6, 2001  Razor Issue #166
00116  Added runtime_params to argument list for Read_Lookup_Tables 
00117  Alice Isaacman, SAIC GSO  (Alice.R.Isaacman.1@gsfc.nasa.gov)
00118 
00119  Revision 03.06 March 26, 2001, Razor Issue 159
00120  Added new LUT dn_sat_ev and removed LUT DN_sat
00121  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov)
00122 
00123  Revision 03.05 March 5, 2001, Razor Issue 156
00124  Added TDLUT_PIECEWISE_LINEAR, TDLUT_ALGORITHM_ATTR_NAME, and 
00125     TDLUT_PIECEWISE_LINEAR_TIMES.  Added function prototype for
00126     TDLUT_ReadPiecewiseLinearFunction.
00127  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov)
00128   
00129  
00130  Revision 03.04 December 19, 2000, Razor issue 148
00131  Changed num_overlap_scans_b1_T_bb to num_overlap_scans_b1 and
00132  deleted num_overlap_scans_temps.
00133  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00134 
00135  Revision 03.03 December 8, 2000, Razor issue 143
00136  Esun, Radiance Scales and Offsets
00137  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00138 
00139  Revision 03.02 December 1, 2000
00140  Changed for new SWIR correction algorithm, issue 145.
00141  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00142 
00143  Revision 03.02 October 29, 2000
00144  Added common QA LUT "Control options" for Razor issue 142.
00145  NOTE: earlier added emissive LUT "SV_DN_moon_include_frames"
00146  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00147 
00148  ... (gap) ...
00149 
00150  Revision 03.01 December 22, 1999
00151  Revised the variables and structure members.  The same variables which
00152  define the LUTs are also used by the LUTs generation code.
00153  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00154 
00155  Revision 03.00 November 17, 1999
00156  Completely revised the organization to allow for valid range checking
00157  and to enable ease of writing meaningful error messages.
00158  Add new versioning strategy.
00159  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
00160 
00161  Revision 02.17 August 23, 1999
00162  Removed LUT INT_correction_switch
00163  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
00164 
00165  Revision 02.16 August 12, 1999
00166  Added macros and variables for LUTs L_Max and L_Min
00167  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
00168 
00169  Revision 02.15 April 12, 1999
00170  Removed A3 lookup table.
00171  Steven Gu(zgu@mcst.gsfc.nasa.gov)
00172  
00173  Revision 02.10 April 9, 1998
00174  Changed LUT "Time_gain_factor" to
00175  "Time_gain_factor_rad".
00176  Added 2 new Reflective LUTs:
00177  "Time_gain_factor_refl", and "L_SD".
00178  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
00179 
00180  Revision 02.10 April 1998
00181  Removed the Cleanup_Emiss_Tables(), read_SIL_All_Bands(),
00182  SIL_Lookup(), and SIL_Cleanup() prototypes and the SIL_t
00183  type definition. (they're obsolete).
00184  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
00185 
00186  Revision 02.10 Mar. 1998
00187  added the SWIR_correction_tables_t
00188  structure and an instance of this new 
00189  type in the refl_tables_t structure.
00190  updated the refl_table dimension constants.
00191  updated the refl_table table names.
00192  got rid of DIL_t and it's supporting functions.
00193  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
00194 
00195  Revision 02.10 Mar. 1998
00196  updated the emiss_tables_t
00197  added a new structure: QA_tables_t
00198  updated the emiss_table dimension constants
00199  updated the emiss_table table names
00200  deleted constants from V2.0 of V vs L algo
00201  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
00202 
00203  Revision 02.00 Dec. 1996
00204  Summarized L1B_Tables.h, HDF_Tables.h, and part of Gen_Lib.h; 
00205  added new lookup tables for L1B_v2. 
00206  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
00207 
00208  Revision 01.00 1996/01/29 13:54:59
00209  Initial development
00210  John Hannon(hannon@highwire.gsfc.nasa.gov)
00211  Joan Baden(baden@highwire.gsfc.nasa.gov)
00212 
00213 !Team-unique Header:
00214  This software is developed by the MODIS Characterization Support
00215  Team (MCST)for the National Aeronautics and Space Administration,
00216  Goddard Space Flight Center, under contract NAS5-32373.
00217 
00218 !References and Credits:
00219  HDF portions developed at the National Center for Supercomputing
00220  Applications at the University of Illinois at Urbana-Champaign.
00221 
00222 !Design Notes:
00223 
00224  Currently, the maximum rank is 5, which covers almost all LUTs.
00225 
00226  Versioning Strategy
00227  -------------------
00228  1.  The PGE version currently represents the version of the code itself.
00229      When the code changes, the PGE version must also change.
00230      Therefore, this is set as a macro "PGE02_VERSION".  For each
00231      actual Level 1B delivery, of the code, we need to agree with the
00232      DAAC and SDST as to what the PGE version will be and then set this
00233      macro accordingly.  Note that this macro should be set prior to
00234      generating any LUTs.  The LUT generation software will also use this
00235      macro to set the PGE version in each LUT file (see item 2 below).
00236      In the code, this macro value will be checked against the value of
00237      PGE02_Version retrieved from the PCF file to make sure they are
00238      identical.
00239  2.  Each LUT file contains the PGE version as a LUT.  The code will
00240      check that the PGE version set in the LUT matches the code macro
00241      PGE02_VERSION.  This is to help prevent out-of-date LUT files
00242      from being used with a release of the code (which has happened
00243      numerous times outside of MCST).
00244  3.  Each LUT file contain the MCST version (which is set in the archive
00245      metadata "AlgorithmPackageVersion").  These should all agree with
00246      each other.  When a LUT update is delivered to SDST, only the MCST
00247      version changes -- the PGE version remains the same.
00248 
00249  Problems with Versioning Strategy
00250  ---------------------------------
00251  1.  The PGE version really includes MOD_PR02QA code as well.  If that
00252      code has to change, then we may have to deliver another version of L1B
00253      so that the PGE version is changed (???).
00254  2.  SDST has talked about adding a "process version" at some point.
00255      This could change the strategy if they ever do.
00256 
00257  Writing the Versions to the product
00258  -----------------------------------
00259  The value in PGE02_Version retrieved from the PCF file will be written to
00260  the product.
00261 
00262 !END********************************************************************
00263 */
00264 
00265 /* 
00266  * The following macros define look up table types, e.g. constant LUT,
00267  * step function time-dependent LUT, and the names of the attributes
00268  * of SDS LUTs.
00269  */
00270 
00271 #define TDLUT_INVALID                 -1
00272 #define TDLUT_CONSTANT                0
00273 #define TDLUT_STEPFUNCTION            1
00274 #define TDLUT_PIECEWISE_LINEAR        2   
00275 #define TDLUT_ALGORITHM_ATTR_NAME     "algorithm"
00276 #define TDLUT_STEPFUNCTION_TIMES      "times"
00277 #define TDLUT_PIECEWISE_LINEAR_TIMES  "times"
00278 
00279 /*
00280  * The following structure is used to define all the information necessary
00281  * to read in a LUT from an ASCII file and write it to the HDF file (for
00282  * LUT generation) or read the LUT from the HDF file (L1B code).
00283  * Some conventions that apply for all L1B LUTs:
00284  * 1) Strings and scalars are stored as global attributes.
00285  * 2) Arrays of non-character data are stored as SDSs.
00286  * NOTE: the structure members "ascii_file", "revdet" and "dimnames"
00287  * are not used in the L1B code.  They are only used in the LUT generation
00288  * software.
00289  */
00290 
00291 typedef struct 
00292 {
00293   char *name;         /* LUT name in the HDF file */
00294   char *ascii_file;   /* name of the ASCII file holding the LUT. */
00295   int32 kind;         /* attribute or SDS), using macros in L1B_Tables.h */
00296   int32 type;         /* data type (DFNT ...) of the LUT */
00297   int32 rank;         /* matrix rank (maximum = 5) */
00298   int32 dims[5];      /* number of values in each dimension */
00299   char *dimnames[5];  /* dimension names of the LUTs */
00300   void  *data;        /* generic pointer, dynamically assigned */
00301   boolean revdet;     /* flag denoting to reverse detector order */
00302   char  *a_lb;        /* ASCII form of the lower bound */
00303   char  *a_ub;        /* ASCII form of the upper bound */
00304   char  *a_fv;        /* ASCII form of the fill value */
00305 } LUT_Definition_t;
00306 
00307 /*
00308  * The following variables define all LUTs in each file.  The reason that
00309  * these are external is because the LUTs generation
00310  * code links to L1B_Tables and uses these variables.
00311  */
00312 
00313 extern LUT_Definition_t refl_luts[];
00314 extern LUT_Definition_t emiss_luts[];
00315 extern LUT_Definition_t qa_luts[];
00316 
00317 
00318 /*-----------------------------------------------------------------------
00319                        PGE VERSION MACRO
00320 ------------------------------------------------------------------------*/
00321 
00322 #define PGE02_VERSION   "6.1.15b"
00323 
00324 /*-----------------------------------------------------------------------
00325                    DIMENSIONS AND INDEXING MACROS
00326            (See also "Granule.h" for other dimension macros)
00327 ------------------------------------------------------------------------*/
00328 
00329 /*---------------------------------------------
00330    Common Lookup Table Dims
00331 ----------------------------------------------*/
00332 
00333 #define MAX_SERIAL_NUMBER_BUFFER                  31
00334 #define MAX_PGE_VERSION_BUFFER                    11
00335 #define MAX_MCST_VERSION_BUFFER                   21
00336 #define MAX_ASSOCIATEDPLATFORMSHORTNAME_BUFFER    21
00337 #define MAX_ALGORITHMPACKAGEACCEPTANCEDATE_BUFFER 11
00338 #define MAX_ALGORITHMPACKAGEMATURITYCODE_BUFFER   15
00339 #define MAX_MISSION_PHASE_BUFFER                  15
00340 #define NUM_DN_VALUES                 4096   /* 2^12 = 4096 (0..4095) */
00341 #define NUM_PRI_RED_SYSTEMS                        2
00342 #define NUM_BITS_IN_UINT8                          8
00343 
00344 #define NUM_1ST_ORDER_COEFFS                       2
00345 #define NUM_2ND_ORDER_COEFFS                       3
00346 #define NUM_4TH_ORDER_COEFFS                       5
00347 /*
00348  * The following is used specifically for the emissive and reflective 
00349  * 4th order polynomial evaluations as part of the uncertainty calculation.
00350  * The arrays dimensioned "NUM_4TH_ORDER_COEFFS" are the coefficients.
00351  */
00352 #define EVAL_4TH_ORDER_POLYNOMIAL(p,a,x) \
00353   p = a[0] + x * (a[1] + x * (a[2] + x * (a[3] + x * a[4])));
00354 
00355 /*
00356  * The following is used specifically for the emissive and reflective 
00357  * 1st order polynomial evaluations as part of the RVS calculation.
00358  * The arrays dimensioned "NUM_2ND_ORDER_COEFFS" are the coefficients.
00359  * Input "x" is the variable and input "y" is x*x, previously computed.
00360  */
00361 #define EVAL_2ND_ORDER_POLYNOMIAL(p,a,x,y) \
00362   p = a[0] + x * a[1] + y * a[2];
00363 
00364 /*---------------------------------------------
00365    SWIR-band (Reflective) Table Dims
00366 ----------------------------------------------*/
00367 
00368 #define NUM_SWIR_BANDS                 4
00369 #define MAX_NUM_SWIR_SUBSAMPLES        2
00370 #define MAX_DETECTORS_PER_SWIR_BAND   20
00371 #define MAX_SWIR_BAND_EV_FRAMES     2708
00372 #define MAX_NUM_SWIR_RSR_WL           27     
00373 
00374 /*---------------------------------------------
00375    Emissive Tables Dimensions and other macros
00376 
00377  Use caution when changing any of these, especially
00378  those related to polynomial evaluations.  For
00379  efficiency reasons, the code may not be general.
00380 ----------------------------------------------*/
00381 
00382   /* Bands for MODIS/Aqua (FM1) which show dn BB saturation on BB warmup: */
00383 #define NUM_AQUA_BB_SAT_BANDS      3
00384 
00385 #define NUM_PC_XT_BANDS            5
00386 #define NUM_PC_XT_PARAMETERS       4
00387 #define MAX_NUM_RSR_vs_LAMBDA     66
00388 #define NUM_a0_vs_T_inst_COEFF     3  /* see caution above */
00389 #define NUM_a2_vs_T_inst_COEFF     3  /* see caution above */
00390 /* obsolete due to TEB UI algorithm update, 3/22/2011, Xu Geng */
00391 /*
00392 #define NUM_UI_PARAMETERS          8
00393 #define NUM_UI_POLYNOMIAL_COEFF    2
00394 #define NUM_FI_POLYNOMIAL_COEFF    5  
00395 */
00396 #define NUM_T_MIR_THERMISTORS  2     /* number of values in LUT */
00397 #define NUM_T_INS_THERMISTORS  4     /* number of values in LUT */
00398 #define INDEX_TP_AO_SMIR_OBJ   0     /* LUT index */
00399 #define INDEX_TP_AO_LWIR_OBJ   1     /* LUT index */
00400 #define INDEX_TP_AO_SMIR_LENS  2     /* LUT index */
00401 #define INDEX_TP_AO_LWIR_LENS  3     /* LUT index */
00402 
00403 #define NUM_T_CAV_THERMISTORS  4     /* number of values in LUT */
00404 #define INDEX_TP_MF_CALBKHD_SR 0     /* LUT index */
00405 #define INDEX_TP_SR_SNOUT      1     /* LUT index */
00406 #define INDEX_TP_MF_Z_BKHD_BB  2     /* LUT index */
00407 #define INDEX_TP_MF_CVR_OP_SR  3     /* LUT index */
00408 
00409 #define NUM_U2_FRAME           7     /* number of frames in uncertainty term u2 LUT */
00410 #define NUM_RSB_RVS_COEFFS     5     /* number of coefficients used to calcuate RVS */
00411 
00412 /*--------------------------------------------
00413    Dimensions for QA Tables
00414 ---------------------------------------------*/
00415 #define NUM_MOON_OFFSET_LIMITS 4
00416 #define NUM_ATTITUDE_ANGLES    3
00417 
00418 /*
00419  * The following macros define the meaning of the index within the
00420  * "NUM_MOON_OFFSET_LIMITS" dimension of "moon_offset_limits"
00421  * in the common_QA_tables_t structure.
00422  */
00423 #define TRK_UPPER 0  /* track upper limit index */
00424 #define TRK_LOWER 1  /* track lower limit index */
00425 #define SCN_UPPER 2  /* scan upper limit index */
00426 #define SCN_LOWER 3  /* scan lower limit index */
00427 
00428 /*-----------------------------------------------------------------------
00429                          LUT Information Macros
00430 ------------------------------------------------------------------------*/
00431 
00432 /*
00433  * The following macros are used to determine the "kind" of LUT
00434  * as it exists inside the LUT file.
00435  */
00436 
00437 #define GLOBAL_ATTRIBUTE_LUT  0      /* Must use read_attribute */
00438 #define SDS_LUT               1      /* Must use read_sds_rankn */
00439 
00440 /*---------------------------------------------
00441       Common Lookup Table names
00442 (These tables should exist in all three files)
00443 ----------------------------------------------*/
00444 
00445 #define PGE_VERSION_LUT_NAME             "PGE_Version"
00446 #define MCST_VERSION_LUT_NAME            "MCST_Version"
00447 
00448 /*---------------------------------------------
00449     Reflective Lookup Table names
00450 ----------------------------------------------*/
00451 
00452 #define REFL_SERIAL_NUMBER_LUT_NAME        "Serial Number of Reflective LUT"
00453 #define M0_LUT_NAME                        "m0"
00454 #define M1_LUT_NAME                        "m1"
00455 #define DN_STAR_MAX_LUT_NAME               "dn_star_Max"
00456 #define DN_STAR_MIN_LUT_NAME               "dn_star_Min"
00457 #define K_INST_LUT_NAME                    "K_inst"
00458 #define K_FPA_LUT_NAME                     "K_FPA"
00459 #define T_INST_REF_LUT_NAME                "T_inst_ref"
00460 #define T_FPA_REF_LUT_NAME                 "T_FPA_ref"
00461 #define RVS_RSB_LUT_NAME                   "RVS_RefSB"
00462 /* obsolete due to RSB UI algorithm update, 2/23/2011, Xu Geng */
00463 /*
00464 #define SIGMA_RVS_RSB_LUT_NAME             "Sigma_RVS_RSB"
00465 #define SIGMA_M1_LUT_NAME                  "Sigma_m1"
00466 #define SIGMA_K_INST_LUT_NAME              "Sigma_K_inst"
00467 #define SIGMA_T_INST_LUT_NAME              "Sigma_T_inst"
00468 #define SIGMA_PV_RESID_ELEC_LUT_NAME       "Sigma_PV_Resid_Elec"
00469 #define SIGMA_R_STAR_LIN_RESID_UCOEFF_LUT_NAME  "Sigma_R_Star_Lin_Resid_Ucoeff"
00470 #define RSB_NEDL_LUT_NAME                  "RSB_NEdL"
00471 #define SIGMA_RSB_ADC_LUT_NAME             "Sigma_RSB_ADC"
00472 */
00473 #define DN_OBC_1ST_FRAME_LUT_NAME          "DN_obc_avg_first_frame_to_use"
00474 #define DN_OBC_NUM_FRAMES_LUT_NAME         "DN_obc_avg_number_of_frames_to_use"
00475 #define SWIR_CORRECTION_SWITCH_LUT_NAME    "SWIR_OOB_correction_switch"
00476 #define X_OOB_0_LUT_NAME                   "X_OOB_0"
00477 #define X_OOB_1_LUT_NAME                   "X_OOB_1"
00478 #define X_OOB_2_LUT_NAME                   "X_OOB_2"
00479 #define RSB_SPECIFIED_UNCERTAINTY_LUT_NAME "RSB_specified_uncertainty"
00480 #define RSB_UI_SCALING_FACTOR_LUT_NAME     "RSB_UI_scaling_factor"
00481 #define E_SUN_OVER_PI_LUT_NAME             "E_sun_over_pi"
00482 #define RSB_SV_DN_MOON_INCLUDE_FRAMES_LUT_NAME "RSB_SV_DN_moon_include_frames"
00483 #define DN_SAT_EV_LUT_NAME                 "dn_sat_ev"
00484 #define B26_B5_CORR_LUT_NAME               "B26_B5_Corr"
00485 #define B26_B5_CORR_SWITCH_LUT_NAME        "B26_B5_Corr_Switch"
00486 #define B26_B5_FRAME_OFFSET_LUT_NAME       "B26_B5_Frame_Offset"
00487 #define SWIR_CORR_SENDING_BAND_LUT_NAME    "SWIR_OOB_corr_sending_band"
00488 #define SWIR_CORR_SENDING_DETECTOR_LUT_NAME "SWIR_OOB_corr_sending_detector"
00489 /* new luts tables due to RSB uncertainty algorithm update 2/22/2011, Xu Geng */
00490 #define U1_LUT_NAME                        "u1"
00491 #define U2_LUT_NAME                        "u2"
00492 #define U3_LUT_NAME                        "u3"
00493 #define U4_LUT_NAME                        "u4"
00494 #define U2_FRAMES_LUT_NAME                 "u2_frames"
00495 #define SWIR_UI_FACTOR_LUT_NAME            "swir_ui_factor"
00496 
00497 /*---------------------------------------------
00498     Emissive Lookup Table names
00499 ----------------------------------------------*/
00500 
00501 #define EMISS_SERIAL_NUMBER_LUT_NAME       "Serial Number of Emissive LUT"
00502 #define EPSILON_BB_LUT_NAME                "epsilon_bb"
00503 #define EPSILON_CAV_LUT_NAME               "epsilon_cav"
00504 #define DELTA_T_BB_BETA_LUT_NAME           "delta_T_bb_beta"
00505 #define DELTA_T_BB_DELTA_LUT_NAME          "delta_T_bb_delta"
00506 #define PCX_TALK_LUT_NAME                  "PC_XT"
00507 #define RVS_TEB_LUT_NAME                   "RVS_TEB"
00508 #define RVS_BB_SV_FRAME_NO_LUT_NAME        "RVS_BB_SV_Frame_No"
00509 #define RSR_LUT_NAME                       "RSR"
00510 #define WAVELENGTH_LUT_NAME                "WAVELENGTH"
00511 #define NUM_WL_INCREMENT_LUT_NAME          "NWL"
00512 #define CALIB_A0_LUT_NAME                  "A0"
00513 #define CALIB_A2_LUT_NAME                  "A2"
00514 /* obsolete due to TEB UI algorithm update, 3/22/2011, Xu Geng */
00515 /*
00516 #define UI_UCOEFF_LUT_NAME                 "Ucoeff"
00517 #define SIGMA_TEB_PV_RESID_ELEC_LUT_NAME   "Sigma_TEB_PV_resid_elec"
00518 #define SIGMA_TEB_ADC_LUT_NAME             "Sigma_TEB_ADC"
00519 #define UCOEFF_CALIBR_RESID_LUT_NAME       "Ucoeff_Calibr_resid"
00520 #define BAND_21_UNCERT_LSAT_LUT_NAME       "Band_21_Uncert_Lsat"
00521 */
00522 #define T_INS_FUNCTION_FLAG_LUT_NAME       "T_ins_function_flag"
00523 #define T_INS_DEFAULT_LUT_NAME             "T_ins_default"
00524 #define T_INS_OFFSET_LUT_NAME              "T_ins_offset"
00525 #define T_CAV_FUNCTION_FLAG_LUT_NAME       "T_cav_function_flag"
00526 #define T_CAV_DEFAULT_LUT_NAME             "T_cav_default"
00527 #define T_MIR_FUNCTION_FLAG_LUT_NAME       "T_mir_function_flag"
00528 #define T_MIR_DEFAULT_LUT_NAME             "T_mir_default"
00529 #define BB_WEIGHT_LUT_NAME                 "BB_Weight"
00530 #define BB_DN_1ST_FRAME_LUT_NAME           "BB_DN_first_frame_to_use"
00531 #define BB_DN_NUM_FRAMES_LUT_NAME          "BB_DN_number_of_frames_to_use"
00532 #define SV_DN_1ST_FRAME_LUT_NAME           "SV_DN_first_frame_to_use"
00533 #define SV_DN_NUM_FRAMES_LUT_NAME          "SV_DN_number_of_frames_to_use"
00534 #define SV_DN_MOON_INCLUDE_FRAMES_LUT_NAME "SV_DN_moon_include_frames"
00535 #define PCX_CORRECTION_SWITCH_LUT_NAME     "PCX_correction_switch"
00536 #define OVERLAP_SCANS_B1_LUT_NAME          "num_overlap_scans_b1"
00537 #define BAND_21_B1_LUT_NAME                "Band_21_b1"
00538 #define L_MIN_LUT_NAME                     "L_Min"
00539 #define L_MAX_LUT_NAME                     "L_Max"
00540 #define TEB_SPECIFIED_UNCERTAINTY_LUT_NAME "TEB_specified_uncertainty"
00541 #define TEB_UI_SCALING_FACTOR_LUT_NAME     "TEB_UI_scaling_factor"
00542 #define BB_T_SAT_SWITCH_AQUA_LUT_NAME      "BB_T_sat_switch_aqua"
00543 #define BB_T_SAT_AQUA_LUT_NAME             "BB_T_sat_aqua"
00544 #define BB_T_SAT_DEFAULT_B1_BASELINE_AQUA_LUT_NAME  "BB_T_sat_default_b1_baseline_aqua"
00545 #define BB_T_SAT_DEFAULT_B1_C1_AQUA_LUT_NAME  "BB_T_sat_default_b1_c1_aqua"
00546 #define BB_T_SAT_DEFAULT_B1_TLWIR_BASELINE_AQUA_LUT_NAME  "BB_T_sat_default_b1_Tlwir_baseline_aqua"
00547 /* new luts tables due to TEB uncertainty algorithm update 3/22/2011, Xu Geng */
00548 #define SIGMA_A0_LUT_NAME                  "sigma_a0"
00549 #define SIGMA_A2_LUT_NAME                  "sigma_a2"
00550 #define SIGMA_RVS_EV_LUT_NAME              "sigma_RVS_EV"
00551 #define SIGMA_EPSILON_BB_LUT_NAME          "sigma_epsilon_BB"
00552 #define SIGMA_EPSILON_CAV_LUT_NAME         "sigma_epsilon_CAV"
00553 #define SIGMA_L_LAMBDA_LUT_NAME            "sigma_L_lambda"
00554 #define SIGMA_L_TBB_LUT_NAME               "sigma_L_Tbb"
00555 #define SIGMA_L_TSM_LUT_NAME               "sigma_L_Tsm"
00556 #define SIGMA_L_TCAV_LUT_NAME              "sigma_L_Tcav"
00557 #define SIGMA_B1_BAND21_LUT_NAME           "sigma_b1_B21"
00558 #define PCX_UI_FACTOR_LUT_NAME             "pcx_ui_factor"
00559 
00560 /*---------------------------------------------
00561     QA Lookup Table information
00562 ----------------------------------------------*/
00563 
00564 #define QA_SERIAL_NUMBER_LUT_NAME          "QA serial number"
00565 #define PLATFORM_SHORT_NAME_LUT_NAME       "ASSOCIATEDPLATFORMSHORTNAME"
00566 #define PACKAGE_ACCEPT_DATE_LUT_NAME       "ALGORITHMPACKAGEACCEPTANCEDATE"
00567 #define PACKAGE_MATURITY_CODE_LUT_NAME     "ALGORITHMPACKAGEMATURITYCODE"
00568 #define DET_QUAL_FLAG_VALS_LUT_NAME        "Detector Quality Flag Values"
00569 #define DET_QUAL_FLAG2_VALS_LUT_NAME       "Detector Quality Flag2 Values"
00570 #define MOON_OFFSET_LIMITS_LUT_NAME        "Moon Offset Limits"
00571 #define MISSION_PHASE_LUT_NAME             "mission phase"
00572 #define CONTROL_OPTIONS_LUT_NAME           "Control options"
00573 #define BASE_VARI_VISUAL_FPA_LUT_NAME      "visual FPA base variance"
00574 #define BASE_VARI_NIR_FPA_LUT_NAME         "NIR FPA base variance"
00575 #define BB_TEMP_VARIANCE_LUT_NAME          "T_BB_Variance"
00576 #define BB_AVG_TEMP_VAR_LUT_NAME           "BB Average Temperature Variance"
00577 #define LWIR_FPA_TEMP_VAR_LUT_NAME         "LWIR FPA Temperature Variance"
00578 #define MWIR_FPA_TEMP_VAR_LUT_NAME         "MWIR FPA Temperature Variance"
00579 #define MIR_SIDE_1_TEMP_VAR_LUT_NAME       "MirrorSide 1 Temperature Variance"
00580 #define MIR_SIDE_2_TEMP_VAR_LUT_NAME       "MirrorSide 2 Temperature Variance"
00581 #define MIR_AVG_TEMP_VAR_LUT_NAME          "Mirror Average Temperature Variance"
00582 #define INST_TEMP_VAR_LUT_NAME             "Instrument Temperature Variance"
00583 #define CAVITY_TEMP_VAR_LUT_NAME           "Cavity Temperature Variance"
00584 #define EMISS_NEdL_LUT_NAME                "NEdL"
00585 #define CALIB_A1_LUT_NAME                  "a1"
00586 #define ROLL_THRESHOLD_LUT_NAME            "Spacecraft_Roll_Threshold_Angle"
00587 #define PITCH_THRESHOLD_LUT_NAME           "Spacecraft_Pitch_Threshold_Angle"
00588 #define YAW_THRESHOLD_LUT_NAME             "Spacecraft_Yaw_Threshold_Angle"
00589 
00590 /*-----------------------------------------------------------------------
00591                          LUT Structures
00592 ------------------------------------------------------------------------*/
00593 
00594 /* 
00595  * SWIR Correction Lookup Table Structure
00596  */
00597 
00598 typedef struct 
00599 {
00600   int16   SWIR_correction_switch;
00601   int16   SWIR_corr_sending_band;
00602   int16   SWIR_corr_sending_detector[DETECTORS_PER_1KM_BAND];
00603   float32 X_OOB_0[NUM_SWIR_BANDS]
00604                  [MAX_DETECTORS_PER_SWIR_BAND]
00605                  [MAX_NUM_SWIR_SUBSAMPLES]
00606                  [NUM_MIRROR_SIDES];
00607   
00608   float32 X_OOB_1[NUM_SWIR_BANDS]
00609                  [MAX_DETECTORS_PER_SWIR_BAND]
00610                  [MAX_NUM_SWIR_SUBSAMPLES]
00611                  [NUM_MIRROR_SIDES];
00612   
00613   float32 X_OOB_2[NUM_SWIR_BANDS]
00614                  [MAX_DETECTORS_PER_SWIR_BAND]
00615                  [MAX_NUM_SWIR_SUBSAMPLES]
00616                  [NUM_MIRROR_SIDES];
00617                  
00618 } SWIR_correction_tables_t;
00619 
00620 /*
00621  * Reflective Lookup Table Structure
00622  */
00623 
00624 typedef struct 
00625 {
00626   char    Serial_Number[MAX_SERIAL_NUMBER_BUFFER];
00627   char    PGE_Version  [MAX_PGE_VERSION_BUFFER];
00628   char    MCST_Version [MAX_MCST_VERSION_BUFFER];
00629 
00630   int16   DN_obc_avg_first_frame_to_use;
00631 
00632   int16   DN_obc_avg_number_of_frames_to_use;
00633 
00634   float32 K_inst[NUM_REFLECTIVE_BANDS]
00635                 [MAX_DETECTORS_PER_BAND]
00636                 [MAX_SAMPLES_PER_BAND]
00637                 [NUM_MIRROR_SIDES];
00638 
00639   float32 K_FPA[NUM_REFLECTIVE_BANDS]
00640                [MAX_DETECTORS_PER_BAND]
00641                [MAX_SAMPLES_PER_BAND]
00642                [NUM_MIRROR_SIDES];
00643 
00644   float32 m0[NUM_REFLECTIVE_BANDS]
00645             [MAX_DETECTORS_PER_BAND]
00646             [MAX_SAMPLES_PER_BAND]
00647             [NUM_MIRROR_SIDES];
00648 
00649   float32 m1[NUM_REFLECTIVE_BANDS]
00650             [MAX_DETECTORS_PER_BAND]
00651             [MAX_SAMPLES_PER_BAND]
00652             [NUM_MIRROR_SIDES];
00653  
00654   float32 dn_star_Max[NUM_REFLECTIVE_BANDS];
00655 
00656   float32 dn_star_Min[NUM_REFLECTIVE_BANDS];
00657 
00658   float32 T_inst_ref;
00659 
00660   float32 T_FPA_ref[NUM_FOCAL_PLANES];
00661 
00662   float32 RVS_RefSB[NUM_REFLECTIVE_BANDS]
00663                    [MAX_DETECTORS_PER_BAND]
00664                    [NUM_MIRROR_SIDES]
00665                    [NUM_RSB_RVS_COEFFS];
00666 
00667   /* obsolete due to RSB uncertainty algorithm update, 2/23/2011, Xu Geng */
00668   /*
00669   float32 Sigma_RVS_RSB[NUM_REFLECTIVE_BANDS]
00670                        [NUM_MIRROR_SIDES];
00671 
00672   float32 Sigma_m1[NUM_REFLECTIVE_BANDS]
00673                   [MAX_DETECTORS_PER_BAND]
00674                   [MAX_SAMPLES_PER_BAND]
00675                   [NUM_MIRROR_SIDES];
00676 
00677   float32 Sigma_K_inst[NUM_REFLECTIVE_BANDS]
00678                       [MAX_DETECTORS_PER_BAND]
00679                       [MAX_SAMPLES_PER_BAND]
00680                       [NUM_MIRROR_SIDES];
00681 
00682   float32 Sigma_T_inst;
00683 
00684   float32 Sigma_PV_Resid_Elec[NUM_REFLECTIVE_BANDS]
00685                              [MAX_DETECTORS_PER_BAND]
00686                              [MAX_SAMPLES_PER_BAND];
00687 
00688   float32 Sigma_R_Star_Lin_Resid_Ucoeff[NUM_REFLECTIVE_BANDS]
00689                                        [MAX_DETECTORS_PER_BAND]
00690                                        [MAX_SAMPLES_PER_BAND]
00691                                        [NUM_MIRROR_SIDES]
00692                                        [NUM_4TH_ORDER_COEFFS];
00693 
00694   float32 RSB_NEdL[NUM_REFLECTIVE_BANDS]
00695                   [MAX_DETECTORS_PER_BAND]
00696                   [MAX_SAMPLES_PER_BAND]
00697                   [NUM_MIRROR_SIDES];
00698 
00699   float32 Sigma_RSB_ADC[NUM_REFLECTIVE_BANDS]
00700                        [MAX_DETECTORS_PER_BAND];
00701   */
00702 
00703   float32 RSB_specified_uncertainty[NUM_REFLECTIVE_BANDS];
00704 
00705   float32 RSB_UI_scaling_factor[NUM_REFLECTIVE_BANDS];
00706 
00707   SWIR_correction_tables_t SWIR_correction_tables; /* All SWIR LUTs */
00708   float32 E_sun_over_pi[NUM_REFLECTIVE_DETECTORS];
00709   int16   RSB_SV_DN_moon_include_frames;
00710 
00711   float64 dn_sat_ev[NUM_REFLECTIVE_BANDS]
00712                    [MAX_DETECTORS_PER_BAND]
00713                    [MAX_SAMPLES_PER_BAND]
00714                    [NUM_MIRROR_SIDES];
00715 
00716   float32 B26_B5_Corr[DETECTORS_PER_1KM_BAND];
00717   int16   B26_B5_Corr_Switch;
00718   int16   B26_B5_Frame_Offset[DETECTORS_PER_1KM_BAND]; 
00719 
00720   /* new luts tables due to RSB uncertainty algorithm update 2/22/2011, Xu Geng */
00721   float32 u1[NUM_REFLECTIVE_DETECTORS];
00722   float32 u2_samples[NUM_REFLECTIVE_DETECTORS]
00723                     [NUM_MIRROR_SIDES]
00724                     [NUM_U2_FRAME];
00725   float32 u3[NUM_REFLECTIVE_DETECTORS]
00726             [NUM_MIRROR_SIDES];
00727   float32 u4_coeffs[NUM_REFLECTIVE_BANDS]
00728                    [MAX_DETECTORS_PER_BAND]
00729                    [MAX_SAMPLES_PER_BAND]
00730                    [NUM_MIRROR_SIDES]
00731                    [NUM_2ND_ORDER_COEFFS];
00732   int16   u2_frames[NUM_U2_FRAME];
00733   float32 swir_ui_factor[NUM_SWIR_BANDS];
00734 
00735   } refl_tables_t;
00736 
00737 
00738 /*
00739  * Emissive Lookup Table Structure
00740  * NOTE: PC_XT values in the lookup table are in percent.
00741  */
00742 
00743 typedef struct 
00744 {
00745   char     Serial_Number   [MAX_SERIAL_NUMBER_BUFFER];
00746   char     PGE_Version     [MAX_PGE_VERSION_BUFFER];
00747   char     MCST_Version    [MAX_MCST_VERSION_BUFFER];
00748   float32  epsilon_bb      [NUM_EMISSIVE_DETECTORS];
00749   float32  epsilon_cav     [NUM_EMISSIVE_DETECTORS];
00750   float32  delta_T_bb_beta [NUM_EMISSIVE_DETECTORS];
00751   float32  delta_T_bb_delta[NUM_EMISSIVE_DETECTORS];
00752   float32  PC_XT           [NUM_PC_XT_BANDS]
00753                            [DETECTORS_PER_1KM_BAND]
00754                            [NUM_PC_XT_PARAMETERS];
00755   float32  RSR             [NUM_EMISSIVE_DETECTORS]
00756                            [MAX_NUM_RSR_vs_LAMBDA];
00757   float32  wavelength      [NUM_EMISSIVE_DETECTORS]
00758                            [MAX_NUM_RSR_vs_LAMBDA];
00759   float32  A0              [NUM_a0_vs_T_inst_COEFF]
00760                            [NUM_MIRROR_SIDES]
00761                            [NUM_EMISSIVE_DETECTORS];
00762   float32  A2              [NUM_a2_vs_T_inst_COEFF]
00763                            [NUM_MIRROR_SIDES]
00764                            [NUM_EMISSIVE_DETECTORS];
00765  
00766   int16    NUM_RSR_vs_Lambda[NUM_EMISSIVE_DETECTORS]; 
00767   float32  CW               [NUM_EMISSIVE_BANDS];
00768 
00769   /* obsolete due to TEB uncertainty algorithm update, 3/22/2011, Xu Geng */
00770   /*
00771   float32  Ucoeff      [NUM_EMISSIVE_DETECTORS]
00772                        [NUM_UI_PARAMETERS]
00773                        [NUM_UI_POLYNOMIAL_COEFF]
00774                        [NUM_FI_POLYNOMIAL_COEFF];
00775   float32  Sigma_TEB_PV_resid_elec[NUM_EMISSIVE_DETECTORS];
00776   float32  Sigma_TEB_ADC[NUM_EMISSIVE_DETECTORS];
00777   float32  Ucoeff_Calibr_resid[NUM_EMISSIVE_DETECTORS]
00778                               [NUM_4TH_ORDER_COEFFS];
00779   float32 Band_21_Uncert_Lsat;
00780   */
00781   int16 SV_DN_first_frame_to_use;
00782   int16 SV_DN_number_of_frames_to_use;
00783   int16 SV_DN_moon_include_frames;
00784   int16 BB_DN_first_frame_to_use;
00785   int16 BB_DN_number_of_frames_to_use;
00786   int16 num_overlap_scans_b1;
00787   int8  PCX_correction_switch;
00788   int32   T_ins_function_flag[NUM_T_INS_THERMISTORS];
00789   float32 T_ins_default;
00790   float32 T_ins_offset[NUM_T_INS_THERMISTORS];
00791   int32   T_cav_function_flag[NUM_T_CAV_THERMISTORS];
00792   int32   T_mir_function_flag[NUM_T_MIR_THERMISTORS];
00793   float32 T_cav_default;
00794   float32 T_mir_default;
00795   float32 BB_Weight[NUM_BB_THERMISTORS];
00796 
00797   float32 RVS_TEB[NUM_EMISSIVE_BANDS]
00798                  [DETECTORS_PER_1KM_BAND]
00799                  [NUM_MIRROR_SIDES]
00800                  [NUM_2ND_ORDER_COEFFS];
00801   int16   RVS_BB_SV_Frame_No[2]; 
00802   
00803   float32 Band_21_b1[DETECTORS_PER_1KM_BAND][NUM_MIRROR_SIDES];
00804   float32 L_Max[NUM_EMISSIVE_BANDS];
00805   float32 L_Min[NUM_EMISSIVE_BANDS];
00806   float32 TEB_specified_uncertainty[NUM_EMISSIVE_BANDS];
00807   float32 TEB_UI_scaling_factor[NUM_EMISSIVE_BANDS];
00808   int8    BB_T_sat_switch_aqua;
00809   float32 BB_T_sat_aqua[NUM_AQUA_BB_SAT_BANDS];
00810   float32 BB_T_sat_default_b1_baseline_aqua[NUM_AQUA_BB_SAT_BANDS]
00811                                   [DETECTORS_PER_1KM_BAND]
00812                                   [NUM_MIRROR_SIDES];
00813   float32 BB_T_sat_default_b1_c1_aqua[NUM_AQUA_BB_SAT_BANDS]
00814                                   [DETECTORS_PER_1KM_BAND]
00815                                   [NUM_MIRROR_SIDES];
00816   float32 BB_T_sat_default_b1_Tlwir_baseline_aqua;
00817 
00818   /* new luts tables due to TEB uncertainty algorithm update 3/22/2011, Xu Geng */
00819   float32 sigma_a0[NUM_a0_vs_T_inst_COEFF]
00820                   [NUM_MIRROR_SIDES]
00821                   [NUM_EMISSIVE_DETECTORS];
00822   float32 sigma_a2[NUM_a2_vs_T_inst_COEFF]
00823                   [NUM_MIRROR_SIDES]
00824                   [NUM_EMISSIVE_DETECTORS];
00825   float32 sigma_RVS_EV[NUM_EMISSIVE_BANDS]
00826                       [DETECTORS_PER_1KM_BAND]
00827                       [NUM_MIRROR_SIDES]
00828                       [NUM_2ND_ORDER_COEFFS];
00829   float32 sigma_epsilon_BB[NUM_EMISSIVE_BANDS];
00830   float32 sigma_epsilon_CAV[NUM_EMISSIVE_BANDS];
00831   float32 sigma_L_lambda[NUM_EMISSIVE_BANDS]
00832                         [NUM_1ST_ORDER_COEFFS];
00833   float32 sigma_L_Tbb[NUM_EMISSIVE_BANDS];
00834   float32 sigma_L_Tsm[NUM_EMISSIVE_BANDS];
00835   float32 sigma_L_Tcav[NUM_EMISSIVE_BANDS];
00836   float32 sigma_b1_B21[DETECTORS_PER_1KM_BAND][NUM_MIRROR_SIDES];
00837   float32 pcx_ui_factor[NUM_PC_XT_BANDS];
00838 
00839 } emiss_tables_t;
00840 
00841 /*
00842  * common QA tables 
00843  */
00844 
00845 /*
00846  * Control options within L1B:
00847  * 1) Split scans -- control whether or not to treat as missing if a split
00848  *    scan is detected.  There are only two values, ON or OFF.
00849  * 2) Bad scan quality -- control whether or not to treat as missing if
00850  *    an invalid value of Scan quality array is detected.
00851  *    There are only two values, ON or OFF.
00852  */
00853 
00854 typedef enum {
00855   SPLIT_SCAN_CONTROL,
00856   BAD_SCAN_QUALITY_CONTROL,
00857   NUM_CONTROL_OPTIONS
00858 } control_options_defs_t;
00859 
00860 typedef struct 
00861 {
00862   char    Serial_Number[MAX_SERIAL_NUMBER_BUFFER];
00863   char    PGE_Version[MAX_PGE_VERSION_BUFFER];
00864   char    MCST_Version[MAX_MCST_VERSION_BUFFER];
00865   char    AssociatedPlatformShortname
00866             [MAX_ASSOCIATEDPLATFORMSHORTNAME_BUFFER];
00867   char    AlgorithmPackageAcceptanceDate
00868             [MAX_ALGORITHMPACKAGEACCEPTANCEDATE_BUFFER];     
00869   char    AlgorithmPackageMaturityCode
00870             [MAX_ALGORITHMPACKAGEMATURITYCODE_BUFFER];
00871   int8    dead_detector[NUM_DETECTORS];
00872   int8    noisy_detector[NUM_DETECTORS];
00873   int8    dead_subframe[NUM_HIGH_RESOLUTION_SUBFRAMES];
00874   int8    noisy_subframe[NUM_HIGH_RESOLUTION_SUBFRAMES];
00875   uint8   Detector_Quality_Flag_Values[NUM_DETECTORS]
00876                                       [NUM_BITS_IN_UINT8];
00877   uint8   Detector_Quality_Flag[NUM_DETECTORS];
00878   uint8   Detector_Quality_Flag2_Values[NUM_HIGH_RESOLUTION_DETECTORS]
00879                                        [NUM_BITS_IN_UINT8];
00880   uint8   Detector_Quality_Flag2[NUM_HIGH_RESOLUTION_DETECTORS];
00881   float32 moon_offset_limits[NUM_BANDS]
00882                             [NUM_MOON_OFFSET_LIMITS];
00883   char    mission_phase[MAX_MISSION_PHASE_BUFFER];
00884   uint8   control_options[NUM_CONTROL_OPTIONS];
00885   float32 roll_threshold_angle;
00886   float32 pitch_threshold_angle;
00887   float32 yaw_threshold_angle;
00888 } common_QA_tables_t;
00889 
00890 /*
00891  * refl QA tables 
00892  */
00893 
00894 typedef struct 
00895 {
00896   float32  var_visual_FPA;
00897   float32  var_NIR_FPA;
00898 } refl_QA_tables_t;
00899 
00900 /*
00901  * emiss QA tables 
00902  */
00903 
00904 typedef struct 
00905 {
00906   float32 var_T_bb[NUM_BB_THERMISTORS];
00907   float32 var_T_bb_avg;
00908   float32 var_T_lwir;
00909   float32 var_T_mwir;
00910   float32 var_T_mir1;
00911   float32 var_T_mir2;
00912   float32 var_T_mir_avg;
00913   float32 var_T_ins;
00914   float32 var_T_cav;
00915   float32 NEdL[NUM_EMISSIVE_DETECTORS];
00916   float32 a1  [NUM_EMISSIVE_DETECTORS];
00917 } emiss_QA_tables_t;
00918 
00919 /*
00920  * QA Lookup table structure
00921  */
00922 
00923 typedef struct 
00924 {
00925   common_QA_tables_t common_QA_tables;
00926   refl_QA_tables_t   refl_QA_tables;
00927   emiss_QA_tables_t  emiss_QA_tables;
00928 } QA_tables_t;
00929 
00930 /*
00931  * L1B lookup tables structure
00932  */
00933 
00934 typedef struct 
00935 {
00936   refl_tables_t  refl;
00937   emiss_tables_t emiss;
00938   QA_tables_t    QA;
00939 } lookup_tables_t;
00940 
00941 /*--------------------------------------------------------
00942               Function Prototypes 
00943 ---------------------------------------------------------*/
00944 
00945 PGSt_SMF_status Read_Lookup_Tables     
00946                       (L1A_granule_t          *L1A_Gran,
00947                        lookup_tables_t        *tables,
00948                        Run_Time_Parameters_t  *runtime_params);
00949 
00950 PGSt_SMF_status Read_Refl_Tables       
00951                       (L1A_granule_t          *,
00952                        refl_tables_t          *);
00953 
00954 PGSt_SMF_status Read_QA_Tables
00955                       (L1A_granule_t          *,
00956                        QA_tables_t            *);
00957 
00958 PGSt_SMF_status Read_Emiss_Tables
00959                       (L1A_granule_t          *,
00960                        emiss_tables_t         *);
00961 
00962 PGSt_SMF_status Read_L1B_SDS_LUT
00963                       (int32                  sd_id,
00964                        char                   *name,
00965                        int32                  data_type,
00966                        int32                  rank,
00967                        int32                  *dims,
00968                        float64                data_collection_TAI_time,
00969                        void                   *data);
00970 
00971 int32 TDLUT_GetAlgorithm
00972                       (int32                  sd_id,
00973                        char                   *name);
00974 
00975 PGSt_SMF_status TDLUT_ReadStepFunction
00976                       (int32                  sd_id,
00977                        char                   *name,
00978                        int32                  data_type,
00979                        int32                  rank,
00980                        int32                  *dims,
00981                        float64                data_collection_TAI_time,
00982                        void                   *data);
00983 
00984 PGSt_SMF_status TDLUT_ReadPiecewiseLinearFunction
00985                       (int32                  sd_id,
00986                        char                   *name,
00987                        int32                  data_type,
00988                        int32                  rank,
00989                        int32                  *dims,
00990                        float64                data_collection_TAI_time,
00991                        void                   *data);
00992 
00993 PGSt_SMF_status Expand_BDSM_LUT
00994                       (void                   *data,
00995                        void                   **data_new,
00996                        int32                  data_type,
00997                        int32                  lead_dim,
00998                        int32                  *n_bytes);
00999 
01000 int32 BDSM_index      (char                   *ascii_file);
01001 
01002 #endif
01003 
01004