OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
Preprocess.h
Go to the documentation of this file.
1 #ifndef PREPROCESS_H
2 #define PREPROCESS_H
3 
4 #include "L1B_Tables.h" /* contained variable definitions used here */
5 
6 /*
7 !C-INC**********************************************************************
8 !Description: Header file Preprocess.h to be included in files
9  where the preprocess routines and data structures
10  are used.
11 !Revision History:
12  $Log: Preprocess.h,v $
13  Revision 1.12 2011-07-28 15:31:47-04 xgeng
14  Added FPA index to retrieve LWIR FPA temperature
15 
16  Revision 1.10 2011-04-07 14:40:41-04 xgeng
17  1. RSB &TEB uncertainty algorithm update; 2. The quadratic RSB RVS changed to 4th order.
18 
19  Revision 1.9 2006-10-27 11:01:35-04 ltan
20  Changed for ANSI-C compliance. Correction for the generation of code change log.
21 
22  Revision 02.20 June 28, 2002 Razor Issue #161
23  Moved NUM_*_SUBSAMP definitions to Granule.h
24  Gwyn Fireman, SAIC-GSO <Gwyn.Fireman@gsfc.nasa.gov>
25 
26  Revision 02.18, March 25, 2001 Razor Issue #178
27  Removed ADC Correction passed parameters
28  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov)
29 
30  Revision 02.16 March 11, 2002 Razor Issue #174
31  Added L1B_Gran to Preprocess.c call
32  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
33 
34  Revision 02.15, Dec. 7, 2000, Razor issue 146
35  Removed DN_sat_prime arrays.
36  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
37 
38  Revision 02.14 August 23, 1999
39  Removed DELTA_bb and dn_bb from Preprocess_Emiss_t.
40  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
41 
42  Revision 02.13 May 7, 1999
43  Moved DN_to_DN_star to Reflective_Cal, because it is not used in Preporcess
44  anymore
45  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
46 
47  Revision 02.12 Feb 17, 1999
48  Moved external function DN_to_DN_star into this module from Reflective_Cal to
49  avoid circular include dependencies.
50  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
51 
52  Revision 02.11 Oct, 1998
53  Added the prototype for Get_Leading_Gran_Temperatures(), Get_Middle_Gran_Temperatures(),
54  Get_Trailing_and_Average_Temperatures(), Calculate_PP_Planck_Mir(), Get_Emissive_Bands_ADC_Board(),
55  Get_Leading_Gran_Emiss_Coeff(), Get_Middle_Gran_Emiss_Coeff(), Get_Trailing_Gran_Emiss_Coeff(),
56  Get_All_Emiss_Coeff()
57  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
58 
59  Revision 02.10 June 2 , 1998
60  Modified the prototype for Preprocess_L1A_Data(), Write_L1B_OBCEng()
61  ADDed the Calculate_SD_DN_star prototype.
62  Zhenying Gu (zgu@ltpmail.gsfc.nasa.gov)
63 
64  Revision 02.10 Apr. 14, 1998
65  Removed all old unused v2.0 prototype interfaces (e.g. cleanup.., malloc.. )
66  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
67 
68  Revision 02.10 Apr. 7, 1998
69  Added MirrorSide to the Overlap_OBCEng_t
70  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
71 
72  Revision 02.10 Apr. 7, 1998
73  Added the Get_Temps_From_Eng_Data() prototype.
74  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
75 
76  Revision 02.10 Mar. 1998
77  Rewrite the L1B TEB algorithm using DN vs L
78  Split the Preprocess_Data_t into Preprocess_Refl_t and Preprocess_Emiss_t
79  Add the QA_Emiss_t to handle the new TEB QA data
80  Rewrite the Temperatures_t to include more temperatures and lwir(mwir)_adc
81  Add macro VAR_Calculation(..)
82  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
83 
84  Revision 01.10 Aug. 1997
85  Inlined DN_to_Voltage().
86  Added Temperatures_t and the interface prototypes.
87  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
88 
89  Revision 01.00 Jan. 1997
90  Initial development
91  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
92 
93 !References and Credits:
94  This software is developed by the MODIS Characterization Support
95  Team (MCST)for the National Aeronautics and Space Administration,
96  Goddard Space Flight Center, under contract NAS5-32373.
97 
98  HDF portions developed at the National Center for Supercomputing
99  Applications at the University of Illinois at Urbana-Champaign.
100 
101 !Design Notes:
102 
103 !END***********************************************************************
104 */
105 
106 /* If moon vector is bad value (0, 0, 0), set moon_in_SV_KOB to be -1 */
107 #define MOON_INSIDE_SV_KOB 1
108 #define MOON_OUTSIDE_SV_KOB 0
109 #define UNDETERMINED_MOON_IN_SV_KOB -1
110 typedef enum {
111  FP_VIS, /*index for VIS focal plane*/
112  FP_NIR, /*index for NIR focal plane*/
113  FP_SMIR, /*index for SMIR/MWIR focal plane*/
114  FP_LWIR /*index for LWIR focal plane*/
115 }FP_Index_t;
116 
117 typedef struct {
121  float32 DN_obc_1km_night_avg[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
125  float32 DN_obc_1km_night_var[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
126  uint32 DN_obc_250m_outlier_mask[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP][2];
127  uint32 DN_obc_500m_outlier_mask[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP][2];
128  uint32 DN_obc_1km_day_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP][2];
129  uint32 DN_obc_1km_night_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP][2];
130 }DN_OBC_Avg_t;
131 
132 typedef struct {
133  float32 var_T_ins; /* holds variance of T_ins over the granule */
135 
136 typedef struct {
137 
138  float32 Planck_mir[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
146  float32 dn_bb_sdev[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
150  /* Temperatures running averaged XGranule
151  */
152  float32 T_fp [NUM_FOCAL_PLANES][MAX_NUM_SCANS];
153  float32 T_bb [MAX_NUM_SCANS];
154  float32 T_mir [MAX_NUM_SCANS];
155  float32 T_ins [MAX_NUM_SCANS];
156 
157 
158  /* Temperatures averaged over a granule, used in metadata
159  */
160  float32 T_bb_gran;
161  float32 T_mir_gran;
162  float32 T_fp1;
163  float32 T_fp2;
164  float32 T_fp3;
165  float32 T_fp4;
166 
167  /* Focal_Plane_Set_Point_State
168  */
169  int8 fp_set_point_state[MAX_NUM_SCANS];
170 
172 
173 typedef struct {
178 
179 /*
180  * Preprocess_L1A_Data -- called from main().
181  */
182 
183 PGSt_SMF_status Preprocess_L1A_Data (lookup_tables_t *tables,
184  L1A_granule_t *L1A_Gran,
185  L1B_granule_t *L1B_Gran,
186  QA_Data_t *QA,
187  Preprocess_Data_t *PP);
188 
189 
190 #endif
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
an array had not been initialized Several spelling and grammar corrections were which is read from the appropriate MCF the above metadata values were hard coded A problem calculating the average background DN for SWIR bands when the moon is in the space view port was corrected The new algorithm used to calculate the average background DN for all reflective bands when the moon is in the space view port is now the same as the algorithm employed by the thermal bands For non SWIR changes in the averages are typically less than Also for non SWIR the black body DNs remain a backup in case the SV DNs are not available For SWIR the changes in computed averages were larger because the old which used the black body suffered from contamination by the micron leak As a consequence of the if SV DNs are not available for the SWIR the EV pixels will not be the granule time is used to identify the appropriate tables within the set given for one LUT the first two or last two tables respectively will be used for the interpolation If there is only one LUT in the set of tables
Definition: HISTORY.txt:695
PGSt_SMF_status Preprocess_L1A_Data(lookup_tables_t *tables, L1A_granule_t *L1A_Gran, L1B_granule_t *L1B_Gran, QA_Data_t *QA, Preprocess_Data_t *PP)
Definition: Preprocess.c:899
@ FP_NIR
Definition: Preprocess.h:112
#define MAX_1KM_TRACK_DIM
Definition: Granule.h:456
#define NUM_500M_SUBSAMP
Definition: Granule.h:442
#define NUM_500M_BANDS
Definition: Granule.h:431
@ FP_VIS
Definition: Preprocess.h:111
Preprocess_Emiss_t PP_Emiss
Definition: Preprocess.h:176
#define MAX_250M_TRACK_DIM
Definition: Granule.h:454
#define NUM_EMISSIVE_DETECTORS
Definition: Granule.h:428
Preprocess_Refl_t PP_Refl
Definition: Preprocess.h:175
@ FP_SMIR
Definition: Preprocess.h:113
#define NUM_1KM_SUBSAMP
Definition: Granule.h:441
#define NUM_250M_SUBSAMP
Definition: Granule.h:443
@ FP_LWIR
Definition: Preprocess.h:114
instead the metadata field ProcessingEnvinronment is filled in from the output of a call to the POSIX compliant function uname from within the L1B code A small bug in L1B_Tables an incorrect comparison of RVS coefficients for TEBs to RVS coefficients for RSBs was being made This was replaced with a comparison between TEB coefficients This error never resulted in an incorrect RVS correction but did lead to recalculating the coefficients for each detector in a thermal band even if the coefficients were the same for all detectors To reduce to overall size of the reflective LUT HDF fill values were eliminated from all LUTs previously dimensioned where and where NUM_TIMES is the number of time dependent table pieces In Preprocess a small error where the trailing dropped scan counter was incremented when the leading dropped scan counter should have been was fixed This counter is internal only and is not yet used for any chiefly to casting of were added to make it LINUX compatible Output of code run on LINUX machines displays differences of at most scaled sector incalculable values of the Emissive calibration factor b1
Definition: HISTORY.txt:576
#define MAX_NUM_SCANS
Definition: Granule.h:422
FP_Index_t
Definition: Preprocess.h:110
#define NUM_1000M_NIGHT_BANDS
Definition: Granule.h:437
DN_OBC_Avg_t DN_OBC_Avg
Definition: Preprocess.h:174
#define NUM_250M_BANDS
Definition: Granule.h:430
const int NUM_FOCAL_PLANES
#define NUM_1000M_DAY_BANDS
Definition: Granule.h:436
#define MAX_500M_TRACK_DIM
Definition: Granule.h:455