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.17 2016-07-22 13:23:32-04 xgeng
14  Applied xtalk correction to Terra LWIR PV bands (27-30)
15 
16  Revision 1.16 2011-04-07 14:41:30-04 xgeng
17  1. RSB &TEB uncertainty algorithm update; 2. The quadratic RSB RVS changed to 4th order.
18 
19  Revision 1.15 2006-10-30 10:00:13-05 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.19 April 15, 2002 Razor Issue #182
27  Applicable to MODIS/TERRA (PFM) processing only.
28  Removed macro BAND_26_REFL_INDEX for Band 26 crosstalk correction
29  and moved to L1B_SetupP.h
30  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
31 
32  Revision 02.18, March 25, 2001 Razor Issue #178
33  Removed ADC Correction passed parameters
34  Alice Isaacman (Alice.R.Isaacman.1@gsfc.nasa.gov)
35 
36  Revision 02.17 March 20, 2002 Razor Issue #182
37  Applicable to MODIS/TERRA (PFM) processing only.
38  Added macro BAND_26_REFL_INDEX for Band 26 crosstalk correction
39  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
40 
41  Revision 02.16 March 11, 2002 Razor Issue #174
42  Added L1B_Gran to Preprocess.c call
43  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
44 
45  Revision 02.15, Dec. 7, 2000, Razor issue 146
46  Removed DN_sat_prime arrays.
47  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
48 
49  Revision 02.14 August 23, 1999
50  Removed DELTA_bb and dn_bb from Preprocess_Emiss_t.
51  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
52 
53  Revision 02.13 May 7, 1999
54  Moved DN_to_DN_star to Reflective_Cal, because it is not used in Preporcess
55  anymore
56  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
57 
58  Revision 02.12 Feb 17, 1999
59  Moved external function DN_to_DN_star into this module from Reflective_Cal to
60  avoid circular include dependencies.
61  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
62 
63  Revision 02.11 Oct, 1998
64  Added the prototype for Get_Leading_Gran_Temperatures(), Get_Middle_Gran_Temperatures(),
65  Get_Trailing_and_Average_Temperatures(), Calculate_PP_Planck_Mir(), Get_Emissive_Bands_ADC_Board(),
66  Get_Leading_Gran_Emiss_Coeff(), Get_Middle_Gran_Emiss_Coeff(), Get_Trailing_Gran_Emiss_Coeff(),
67  Get_All_Emiss_Coeff()
68  Zhenying Gu(zgu@mcst.gsfc.nasa.gov)
69 
70  Revision 02.10 June 2 , 1998
71  Modified the prototype for Preprocess_L1A_Data(), Write_L1B_OBCEng()
72  ADDed the Calculate_SD_DN_star prototype.
73  Zhenying Gu (zgu@ltpmail.gsfc.nasa.gov)
74 
75  Revision 02.10 Apr. 14, 1998
76  Removed all old unused v2.0 prototype interfaces (e.g. cleanup.., malloc.. )
77  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
78 
79  Revision 02.10 Apr. 7, 1998
80  Added MirrorSide to the Overlap_OBCEng_t
81  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
82 
83  Revision 02.10 Apr. 7, 1998
84  Added the Get_Temps_From_Eng_Data() prototype.
85  David Catozzi (cato@ltpmail.gsfc.nasa.gov)
86 
87  Revision 02.10 Mar. 1998
88  Rewrite the L1B TEB algorithm using DN vs L
89  Split the Preprocess_Data_t into Preprocess_Refl_t and Preprocess_Emiss_t
90  Add the QA_Emiss_t to handle the new TEB QA data
91  Rewrite the Temperatures_t to include more temperatures and lwir(mwir)_adc
92  Add macro VAR_Calculation(..)
93  Shi-Yue Qiu (syqiu@ltpmail.gsfc.nasa.gov)
94 
95  Revision 01.10 Aug. 1997
96  Inlined DN_to_Voltage().
97  Added Temperatures_t and the interface prototypes.
98  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
99 
100  Revision 01.00 Jan. 1997
101  Initial development
102  Zhidong Hao (hao@acrobat.gsfc.nasa.gov)
103 
104 !References and Credits:
105  This software is developed by the MODIS Characterization Support
106  Team (MCST)for the National Aeronautics and Space Administration,
107  Goddard Space Flight Center, under contract NAS5-32373.
108 
109  HDF portions developed at the National Center for Supercomputing
110  Applications at the University of Illinois at Urbana-Champaign.
111 
112 !Design Notes:
113 
114 !END***********************************************************************
115 */
116 
117 /* If moon vector is bad value (0, 0, 0), set moon_in_SV_KOB to be -1 */
118 #define MOON_INSIDE_SV_KOB 1
119 #define MOON_OUTSIDE_SV_KOB 0
120 #define UNDETERMINED_MOON_IN_SV_KOB -1
121 
122 typedef struct {
123  float32 DN_obc_250m_avg[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP];
124  float32 DN_obc_500m_avg[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP];
125  float32 DN_obc_1km_day_avg[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP];
126  float32 DN_obc_1km_night_avg[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
127  float32 DN_obc_250m_var[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP];
128  float32 DN_obc_500m_var[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP];
129  float32 DN_obc_1km_day_var[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP];
130  float32 DN_obc_1km_night_var[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP];
131  uint32 DN_obc_250m_outlier_mask[MAX_250M_TRACK_DIM][NUM_250M_BANDS][NUM_250M_SUBSAMP][2];
132  uint32 DN_obc_500m_outlier_mask[MAX_500M_TRACK_DIM][NUM_500M_BANDS][NUM_500M_SUBSAMP][2];
133  uint32 DN_obc_1km_day_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_DAY_BANDS][NUM_1KM_SUBSAMP][2];
134  uint32 DN_obc_1km_night_outlier_mask[MAX_1KM_TRACK_DIM][NUM_1000M_NIGHT_BANDS][NUM_1KM_SUBSAMP][2];
135 }DN_OBC_Avg_t;
136 
137 typedef struct {
138  float32 var_T_ins; /* holds variance of T_ins over the granule */
140 
141 typedef struct {
142 
143  float32 Planck_mir[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
145  float32 sigma_a0 [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
148  float32 sigma_a2 [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
149  float32 DN_sv [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
150  float32 dn_bb [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
151  float32 dn_bb_sdev[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
152  float32 L_bb [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
153  float32 L_cav [NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
154  float32 NEdL[NUM_EMISSIVE_DETECTORS][MAX_NUM_SCANS];
155  /* Temperatures running averaged XGranule
156  */
157  float32 T_fp [NUM_FOCAL_PLANES][MAX_NUM_SCANS];
158  float32 T_bb [MAX_NUM_SCANS];
159  float32 T_mir [MAX_NUM_SCANS];
160  float32 T_ins [MAX_NUM_SCANS];
161 
162 
163  /* Temperatures averaged over a granule, used in metadata
164  */
165  float32 T_bb_gran;
166  float32 T_mir_gran;
167  float32 T_fp1;
168  float32 T_fp2;
169  float32 T_fp3;
170  float32 T_fp4;
171 
172  /* Focal_Plane_Set_Point_State
173  */
174  int8 fp_set_point_state[MAX_NUM_SCANS];
175 
177 
178 typedef struct {
179  DN_OBC_Avg_t DN_OBC_Avg;
180  Preprocess_Refl_t PP_Refl;
181  Preprocess_Emiss_t PP_Emiss;
183 
184 /* Bands to apply the pvlw xtalk correction */
186 
187 /* The relative position to reference optical axis for Bands 27 to 30 on the LWIR FPA */
189 
190 /*
191  * Preprocess_L1A_Data -- called from main().
192  */
193 
194 PGSt_SMF_status Preprocess_L1A_Data (lookup_tables_t *tables,
195  L1A_granule_t *L1A_Gran,
196  L1B_granule_t *L1B_Gran,
197  QA_Data_t *QA,
198  Preprocess_Data_t *PP);
199 
200 
201 #endif
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
215 
integer, parameter int16
Definition: cubeio.f90:3
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
int16 PVLW_XT_BANDS_FRAME_REL_POS[NUM_PVLW_XT_BANDS]
Definition: Preprocess.c:29
#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
#define MAX_250M_TRACK_DIM
Definition: Granule.h:454
#define NUM_EMISSIVE_DETECTORS
Definition: Granule.h:428
int16 PVLW_XT_BANDS[NUM_PVLW_XT_BANDS]
Definition: Preprocess.c:26
#define NUM_PVLW_XT_BANDS
Definition: L1B_Tables.h:400
#define NUM_1KM_SUBSAMP
Definition: Granule.h:441
#define NUM_250M_SUBSAMP
Definition: Granule.h:443
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
#define NUM_1000M_NIGHT_BANDS
Definition: Granule.h:437
#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