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