OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
L1B_SetupP.h
Go to the documentation of this file.
1 #ifndef L1B_SETUPP_H
2 #define L1B_SETUPP_H
3 
4 /*
5 !C-INC***********************************************************************
6 !Description: Private header file containing macros, structure definitions
7  and external function declarations. Used only in L1B_Setup.c.
8 
9 !Revision History:
10  $Log: L1B_SetupP.h,v $
11  Revision 1.9 2006-10-27 11:50:36-04 ltan
12  Changed for ANSI-C compliance. Correction for the generation of code change log.
13 
14  Revision 01.11, October 24, 2003 Razor Issue #196 (formerly Issue #184)
15  Added parameter "tables" to "Scan_Meta_Cal" prototype.
16  Liqin Tan, SAIC GSO (ltan@saicmodis.com)
17 
18  Revision 01.10, March 26, 2003 Razor Issue #190
19  Added function prototype for Calculate_B26_B5_Correction and macro
20  BAND_26_REFL_INDEX for Band 26 crosstalk correction (Previously
21  added for MODIS/Terra processing; Razor Issue #182.)
22  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
23 
24  Revision 01.08, November 19, 2001 Razor Issue #169
25  Added argument skip_night_hi_res to the following modules' argument lists:
26  Copy_Geo_SDS
27  Open_W_L1B_Granule
28  Create_L1B_Swath
29  Open_L1B_EV_SDS
30  Set_Unit_Range_Fillvalue
31  Set_L1B_EV_SDS_Attrs
32  Create_Band_Subsetting_SDS
33  Set_UI_ConvertToPercent_Attrs
34  Alice Isaacman, SAIC GSO (Alice.R.Isaacman.1@gsfc.nasa.gov)
35 
36  Revision 01.07, Dec 8, 2000, Razor issue 143
37  Added argument to Init_L1B_ScaleOffset
38  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
39 
40  Revision 01.06, October 29, 2000
41  Moved Determine_Split_Scans and Get_Split_Scan_Indexes function
42  prototypes from from L1B.c (Razor issue 142).
43  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
44 
45  Revision 01.05 August 12, 1999
46  Changed the prototype of Init_L1B_ScaleOffset()
47  Zhenying Gu (zgu@mcst.gsfc.nasa.gov)
48 
49  Revision 01.04 Feb 22, 1999
50  Changed argument list of Copy_Geo_SDS, dropping the L1B_ScanMeta.
51  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
52 
53  Revision 01.03 Feb 16, 1999
54  Removed declarations of Write_Band_Subsetting_SDS and Write_Subsetting_SDS
55  since they were superceded by Set_L1B_EV_SDS_Attrs and
56  Create_Band_Subsetting_SDS (added declarations for those).
57  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
58 
59  Revision 01.02 Feb 10, 1999
60  Removed declaration of Write_L1B_ScanMeta since that has become and external
61  function called by main(). Changed argument list of Get_SDS_id to allow
62  setting of num_sds in the same function as the related array.
63  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
64 
65  Revision 01.01 Feb 8, 1999
66  Moved declaration of Scan_Meta_Cal into here since
67  this is local in scope to L1B_Setup.c
68  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
69 
70  Revision 01.00 Feb 2, 1999
71  Initial development
72  This was formed from declarations in L1B.c and GranuleP.h as part of the
73  process of separating L1B_Setup out into its own module.
74  Jim Rogers (rogers@mcst.gsfc.nasa.gov)
75 
76 !Team-unique Header:
77  This software is developed by the MODIS Characterization Support
78  Team (MCST)for the National Aeronautics and Space Administration,
79  Goddard Space Flight Center, under contract NAS5-32373.
80 
81 !References and Credits:
82  HDF portions developed at the National Center for Supercomputing
83  Applications at the University of Illinois at Urbana-Champaign.
84 
85 !Design Notes:
86 
87 !END********************************************************************
88 */
89 
90 /* Band index for Band 5 to Band 26 crosstalk correction. */
91 #define BAND_26_REFL_INDEX NUM_REFLECTIVE_BANDS - 1
92 
93  /* Geolocation parameters -- neal */
94 #define GEO_STRIDE 5
95 #define GEO_OFFSET 2
96 
97  /* Geolocation SDS ordering */
98 
99 typedef enum {
111 
112 
113  /* Geolocation SDS structure */
114 
115  /* NOTE: only the name, src_name and type are currently being used
116  * in the code.
117  */
118 
119 typedef struct {
120  char *name;
121  char *src_name;
122  int32 type;
123  char *units;
124  float32 valid_range[2]; /* not all are of type float32 */
125  float32 FillValue;
128  float32 scale_factor;
129  /* char *long_name; */
131 
132 
133  /*
134  * The following is used in Scan_Meta_Cal:
135  */
136 #define SOLAR_AZIMUTH_ZENITH_SCALE_FACTOR 0.01
137 
138  /*
139  * The following is used in Calculate_M1O1 and Calculate_M2O2:
140  */
141 #define SECONDS_IN_DAY 86400
142 
143  /*
144  * Function prototypes for those functions in L1B_Setup.c
145  */
146 
147  PGSt_SMF_status Open_L1A_EV_SDS
148  (L1A_granule_t *L1A_Gran,
149  L1A_Scan_t *L1A_Scan);
150 
151  PGSt_SMF_status Calculate_Earth_Sun_Distance
152  (L1A_granule_t *L1A_Gran,
153  float32 *Earth_Sun_Dist);
154 
155  PGSt_SMF_status Calculate_RSB_Cal_Coeff
157  float32 E_S_Dist,
158  RSB_Cal_Coeff_t *RSB_Cal_Coeff);
159 
160  PGSt_SMF_status Init_L1B_ScaleOffset
161  (L1B_ScaleOffset_t *SO,
162  RSB_Cal_Coeff_t *RSB_Cal_Coeff,
163  float32 E_S_Dist,
165 
166  PGSt_SMF_status Copy_Geo_SDS
167  (L1B_granule_t *L1B_Gran,
168  boolean skip_night_hi_res);
169 
170  PGSt_SMF_status Scan_Meta_Cal
172  L1A_granule_t *L1A_Gran,
173  L1B_granule_t *L1B_Gran,
174  L1B_Scan_Metadata_t *L1B_Scan_Meta,
175  QA_Data_t *QA);
176 
177  PGSt_SMF_status Open_W_L1B_Granule
179  L1B_granule_t *L1B_Gran,
180  L1B_Scan_t *L1B_Scan,
181  boolean skip_night_hi_res);
182 
183  PGSt_SMF_status Init_QA_Parameters
184  (L1A_granule_t *L1A_Gran,
185  L1B_granule_t *L1B_Gran,
186  QA_Data_t *QA);
187 
188  PGSt_SMF_status Create_L1B_Swath
189  (L1B_granule_t *L1B_Gran,
190  boolean skip_night_hi_res);
191 
192  PGSt_SMF_status Open_L1B_EV_SDS
193  (L1B_granule_t *L1B_Gran,
194  L1B_Scan_t *L1B_Scan,
195  boolean skip_night_hi_res);
196 
197  PGSt_SMF_status Get_SDS_id
198  (int32 f,
199  L1B_Scan_t *L1B_Scan,
200  int16 *num_sds,
201  int32 *sds_id);
202 
203  PGSt_SMF_status Set_SDS_Attributes
204  (int32 *sds_id,
205  char **BandNames,
206  float32 **scale,
207  float32 **offset,
208  char *rad_units,
209  char *refl_units,
210  char *counts_units,
211  int32 num_sds);
212 
213  PGSt_SMF_status Write_Swath_Band_Number
214  (int32 file_index,
215  L1B_granule_t *L1B_Gran);
216 
217  PGSt_SMF_status Set_Unit_Range_Fillvalue
218  (L1B_Scan_t *L1B_Scan,
219  boolean skip_night_hi_res);
220 
221  PGSt_SMF_status Set_L1B_EV_SDS_Attrs
223  L1B_granule_t *L1B_Gran,
224  L1B_Scan_t *L1B_Scan,
225  boolean skip_night_hi_res);
226 
227  PGSt_SMF_status Create_Band_Subsetting_SDS
228  (L1B_granule_t *L1B_Gran,
229  boolean skip_night_hi_res);
230 
231  PGSt_SMF_status Calculate_DCR_Change
232  (L1A_granule_t *L1A_Gran,
233  QA_Data_t *QA,
234  L1B_Scan_Metadata_t *L1B_Scan_Meta);
235 
236  PGSt_SMF_status Determine_Split_Scans
237  (L1A_granule_t *L1A_Gran,
238  boolean *split_scan);
239 
240  PGSt_SMF_status Get_Split_Scan_Indexes
241  (int32 S1,
242  int32 num_scans,
243  int16 mirror_side[],
244  int32 scan_quality
246  int32 *S_split_1,
247  int32 *S_split_2);
248 
249  PGSt_SMF_status Set_UI_ConvertToPercent_Attrs
251  L1B_Scan_t *L1B_Scan,
252  boolean skip_night_hi_res);
253 
254 
255  PGSt_SMF_status Calculate_B26_B5_Correction
256  (float32 *original_correction,
257  float32 *scaled_correction,
258  L1B_ScaleOffset_t *ScaleOffset);
259 
260 #endif
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
#define SCAN_QUALITY_ARRAY_NUM_ELEMENTS
Definition: Granule.h:488
PGSt_SMF_status Calculate_Earth_Sun_Distance(L1A_granule_t *L1A_Gran, float32 *Earth_Sun_Dist)
Definition: L1B_Setup.c:504
PGSt_SMF_status Set_L1B_EV_SDS_Attrs(lookup_tables_t *tables, L1B_granule_t *L1B_Gran, L1B_Scan_t *L1B_Scan, boolean skip_night_hi_res)
Definition: L1B_Setup.c:2055
@ INDEX_LATITUDE
Definition: L1B_SetupP.h:100
PGSt_SMF_status Calculate_DCR_Change(L1A_granule_t *L1A_Gran, QA_Data_t *QA, L1B_Scan_Metadata_t *L1B_Scan_Meta)
Definition: L1B_Setup.c:4339
PGSt_SMF_status Get_SDS_id(int32 f, L1B_Scan_t *L1B_Scan, int16 *num_sds, int32 *sds_id)
Definition: L1B_Setup.c:2787
PGSt_SMF_status Create_L1B_Swath(L1B_granule_t *L1B_Gran, boolean skip_night_hi_res)
Definition: L1B_Setup.c:1059
PGSt_SMF_status Open_L1A_EV_SDS(L1A_granule_t *L1A_Gran, L1A_Scan_t *L1A_Scan)
Definition: L1B_Setup.c:419
@ NUM_GEO_SDS
Definition: L1B_SetupP.h:109
@ INDEX_SENSORZENITH
Definition: L1B_SetupP.h:103
PGSt_SMF_status Open_L1B_EV_SDS(L1B_granule_t *L1B_Gran, L1B_Scan_t *L1B_Scan, boolean skip_night_hi_res)
Definition: L1B_Setup.c:1726
double precision function f(R1)
Definition: tmd.lp.f:1454
@ INDEX_SENSORAZIMUTH
Definition: L1B_SetupP.h:104
char * frame_numbers
Definition: L1B_SetupP.h:127
PGSt_SMF_status Determine_Split_Scans(L1A_granule_t *L1A_Gran, boolean *split_scan)
Definition: L1B_Setup.c:5361
PGSt_SMF_status Copy_Geo_SDS(L1B_granule_t *L1B_Gran, boolean skip_night_hi_res)
Definition: L1B_Setup.c:3243
geo_sds_index_t
Definition: L1B_SetupP.h:99
PGSt_SMF_status Get_Split_Scan_Indexes(int32 S1, int32 num_scans, int16 mirror_side[], int32 scan_quality[][SCAN_QUALITY_ARRAY_NUM_ELEMENTS], int32 *S_split_1, int32 *S_split_2)
Definition: L1B_Setup.c:5515
@ INDEX_SOLARAZIMUTH
Definition: L1B_SetupP.h:107
PGSt_SMF_status Set_UI_ConvertToPercent_Attrs(lookup_tables_t *tables, L1B_Scan_t *L1B_Scan, boolean skip_night_hi_res)
Definition: L1B_Setup.c:5666
@ INDEX_GFLAGS
Definition: L1B_SetupP.h:108
PGSt_SMF_status Open_W_L1B_Granule(lookup_tables_t *tables, L1B_granule_t *L1B_Gran, L1B_Scan_t *L1B_Scan, boolean skip_night_hi_res)
Definition: L1B_Setup.c:894
PGSt_SMF_status Init_L1B_ScaleOffset(L1B_ScaleOffset_t *SO, RSB_Cal_Coeff_t *RSB_Cal_Coeff, float32 E_S_Dist, lookup_tables_t *tables)
@ INDEX_LONGITUDE
Definition: L1B_SetupP.h:101
@ INDEX_RANGE
Definition: L1B_SetupP.h:105
@ INDEX_HEIGHT
Definition: L1B_SetupP.h:102
PGSt_SMF_status Set_SDS_Attributes(int32 *sds_id, char **BandNames, float32 **scale, float32 **offset, char *rad_units, char *refl_units, char *counts_units, int32 num_sds)
Definition: L1B_Setup.c:2871
@ INDEX_SOLARZENITH
Definition: L1B_SetupP.h:106
PGSt_SMF_status Create_Band_Subsetting_SDS(L1B_granule_t *L1B_Gran, boolean skip_night_hi_res)
Definition: L1B_Setup.c:3055
PGSt_SMF_status Scan_Meta_Cal(lookup_tables_t *tables, L1A_granule_t *L1A_Gran, L1B_granule_t *L1B_Gran, L1B_Scan_Metadata_t *L1B_Scan_Meta, QA_Data_t *QA)
Definition: L1B_Setup.c:3766
PGSt_SMF_status Write_Swath_Band_Number(int32 file_index, L1B_granule_t *L1B_Gran)
Definition: L1B_Setup.c:1581
l2prod offset
PGSt_SMF_status Calculate_B26_B5_Correction(float32 *original_correction, float32 *scaled_correction, L1B_ScaleOffset_t *ScaleOffset)
Definition: L1B_Setup.c:5829
PGSt_SMF_status Set_Unit_Range_Fillvalue(L1B_Scan_t *L1B_Scan, boolean skip_night_hi_res)
Definition: L1B_Setup.c:2439
float32 scale_factor
Definition: L1B_SetupP.h:128
PGSt_SMF_status Init_QA_Parameters(L1A_granule_t *L1A_Gran, L1B_granule_t *L1B_Gran, QA_Data_t *QA)
Definition: L1B_Setup.c:4617
PGSt_SMF_status Calculate_RSB_Cal_Coeff(lookup_tables_t *tables, float32 E_S_Dist, RSB_Cal_Coeff_t *RSB_Cal_Coeff)
Definition: L1B_Setup.c:615