OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
VcstGeoDataStructs.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: VcstGeoDataStructs.h
4  *
5  * DESCRIPTION: contains structure definitions used in the ProSdrViirs
6  * geolocation routines. This file differs from GEO_parameters in that
7  * it defines input and output structures utilized by the I portion of the
8  * IPO.
9  *
10  *
11  **************************************************************************/
12 
13 #ifndef VcstGeoDataStructs_H
14 #define VcstGeoDataStructs_H
15 
16 #include <vector>
17 #include <VcstGeoParameters.h>
19 
20 /* Local definitions */
21 
22 typedef struct ViirsGeoEncoderType {
23  /* total number of good impulse data */
26 
27  /* validation flags for telescope and mirror data (each scan) */
30 
31  /* telescope and mirror impulse encoder for the scans in a granule */
34 
35  /* telescope and mirror impulse time for scans in a granule */
38 
39  /*DR4767 non-nominal ham encoder start*/
41 
43 
44 
45 // Nadir values on a per scan basis.
46 
47 typedef struct ViirsGeoNadirType {
51 
52 typedef struct ViirsMoonArrays {
55 
56 typedef struct ViirsGeoProcType {
58 
60 
61  double matTempCorr[3][3]; // Temperature correction matrix
62 
63  double DNB_aft_const;
64 
65  double u_aft[MAX_DETECTORS][3];
66 
67  double n_normal_side_1[3]; // Normal vector to HAM side 1
68  double n_normal_side_2[3]; // Normal vector to HAM side 2
69 
70  //wwang J1 code change
71  //Holds EV nadir frame #, #of agg zones, and # of pixels per agg zone
72  //derived from geoParams LUT.
73  int evNadirFrame; //nadir frame number
74  int numAggZones; //number of agg zones
75  int numPixelsPerAggZone[NUM_DNB_ZONES]; //number of samples per agg zone
76 
77  // Structure to hold Nadir latitude and longitude values for each scan.
79 
80  // Contains decoded Telescope and Ham encoder times and values.
82 
83  // Pointer to the Polarstereographic Data Set.
88 
89  // terrain_correction flag
90  int TC;
91 
92  // State holder for the DEBUG message throttle. Protect against
93  // flooding the logs with DEBUG messages during a maneuver.
95 
96  /*store Scan Control Electronics side, DR4759*/
97  signed char SCE_side[VIIRS_SCANS];
98 
100 
101 typedef struct {
102  unsigned char scan_mode[VIIRS_SCANS]; /* each scan day-night */
103  unsigned char mode; /* granule mode night-day-mixed */
104  unsigned char pad[3]; /* 3 Byte fill to fit to a 32 bit boundry */
106 
107 
108 // A structure to contain the geolocation output parameters from
109 // the geolocatePixel() method.
110 // NOTE: The GEO field height is not in the Geo Pixel structure because
111 // it is set from the Terrain Info in the storeGranule() method for IMG data
112 // and copied directly into the DMS buffer in calcModFromImg() for MOD data.
113 
114 typedef struct ViirsGeoPixelType {
115  double lat;
116  double lon;
117  double satazm;
118  double satzen;
119  double sunazm;
120  double sunzen;
121  double moonazm;
122  double moonzen;
123  double moonPhase;
124  double moonFrac;
125  double range;
126  unsigned char qFlag;
128 
129 // A structure to contain the Full Sized geolocation output arrays from
130 // the various VIIRS geolocation methods. This structure is sized such
131 // that it can contain the largest output arrays and be reused within
132 // the VIIRS Geolocation routines.
133 // NOTE: The GEO field height is not in the Full Geo structure because
134 // it is set from the Terrain Info in the storeGranule() method for IMG data
135 // and copied directly into the DMS buffer in calcModFromImg() for MOD data.
136 
137 typedef struct ViirsGeoFullType {
149  unsigned char qFlags[I_DETECTORS][I_VIIRS_COLS];
150  //Add pixel phase and fraction.
154 
155 typedef struct {
156  long long scanStartTime[VIIRS_SCANS];
157  long long scanMidTime[VIIRS_SCANS];
160  float sunzen[M_DETECTORS][M_VIIRS_COLS];
161  float sunazm[M_DETECTORS][M_VIIRS_COLS];
162  float satzen[M_DETECTORS][M_VIIRS_COLS];
163  float satazm[M_DETECTORS][M_VIIRS_COLS];
164  float height[M_DETECTORS][M_VIIRS_COLS];
166  float scPosition[VIIRS_SCANS][VEC_SIZE];
167  float scVelocity[VIIRS_SCANS][VEC_SIZE];
168  float scAttitude[VIIRS_SCANS][VEC_RPY_SIZE];
169  float scPositionStart[VIIRS_SCANS][VEC_SIZE];
170  float scVelocityStart[VIIRS_SCANS][VEC_SIZE];
171  float scAttitudeStart[VIIRS_SCANS][VEC_RPY_SIZE];
172  float scPositionEnd[VIIRS_SCANS][VEC_SIZE];
173  float scVelocityEnd[VIIRS_SCANS][VEC_SIZE];
174  float scAttitudeEnd[VIIRS_SCANS][VEC_RPY_SIZE];
175  float scSunZen[VIIRS_SCANS];
176  float scSunAzm[VIIRS_SCANS];
178  int act_scans; /* SDR structure may be less than full */
179  unsigned char scanQuality[VIIRS_SCANS];
180  unsigned char scanQuality2[VIIRS_SCANS];
181  unsigned char pixelQuality[M_DETECTORS][M_VIIRS_COLS];
182  unsigned char landwater[M_DETECTORS][M_VIIRS_COLS];
184 
185 typedef struct {
186  long long scanStartTime[VIIRS_SCANS];
187  long long scanMidTime[VIIRS_SCANS];
190  float sunzen[M_DETECTORS][M_A_VIIRS_COLS];
191  float sunazm[M_DETECTORS][M_A_VIIRS_COLS];
192  float satzen[M_DETECTORS][M_A_VIIRS_COLS];
193  float satazm[M_DETECTORS][M_A_VIIRS_COLS];
194  float height[M_DETECTORS][M_A_VIIRS_COLS];
196  float scPosition[VIIRS_SCANS][VEC_SIZE];
197  float scVelocity[VIIRS_SCANS][VEC_SIZE];
198  float scAttitude[VIIRS_SCANS][VEC_RPY_SIZE];
199  float scPositionStart[VIIRS_SCANS][VEC_SIZE];
200  float scVelocityStart[VIIRS_SCANS][VEC_SIZE];
201  float scAttitudeStart[VIIRS_SCANS][VEC_RPY_SIZE];
202  float scPositionEnd[VIIRS_SCANS][VEC_SIZE];
203  float scVelocityEnd[VIIRS_SCANS][VEC_SIZE];
204  float scAttitudeEnd[VIIRS_SCANS][VEC_RPY_SIZE];
205  float scSunZen[VIIRS_SCANS];
206  float scSunAzm[VIIRS_SCANS];
208  int act_scans; /* SDR structure may be less than full */
209  unsigned char scanQuality[VIIRS_SCANS];
210  unsigned char scanQuality2[VIIRS_SCANS];
211  unsigned char pixelQuality[M_DETECTORS][M_A_VIIRS_COLS];
212  unsigned char landwater[M_DETECTORS][M_A_VIIRS_COLS];
214 
215 typedef struct {
216  long long scanStartTime[VIIRS_SCANS];
217  long long scanMidTime[VIIRS_SCANS];
226  float moonzen[DNB_DETECTORS][DNB_VIIRS_COLS];
227  float moonazm[DNB_DETECTORS][DNB_VIIRS_COLS];
229  float height_tc[DNB_DETECTORS][DNB_VIIRS_COLS];
231  float scPosition[VIIRS_SCANS][VEC_SIZE];
232  float scVelocity[VIIRS_SCANS][VEC_SIZE];
233  float scAttitude[VIIRS_SCANS][VEC_RPY_SIZE];
234  float scPositionStart[VIIRS_SCANS][VEC_SIZE];
235  float scVelocityStart[VIIRS_SCANS][VEC_SIZE];
236  float scAttitudeStart[VIIRS_SCANS][VEC_RPY_SIZE];
237  float scPositionEnd[VIIRS_SCANS][VEC_SIZE];
238  float scVelocityEnd[VIIRS_SCANS][VEC_SIZE];
239  float scAttitudeEnd[VIIRS_SCANS][VEC_RPY_SIZE];
240  float scSunZen[VIIRS_SCANS];
241  float scSunAzm[VIIRS_SCANS];
242  //Add pixel phase and fraction.
243  float moonPhase[DNB_DETECTORS][DNB_VIIRS_COLS];
244  float moonFrac[DNB_DETECTORS][DNB_VIIRS_COLS];
246  int act_scans; /* SDR structure may be less than full */
247  unsigned char scanQuality[VIIRS_SCANS];
248  unsigned char scanQuality2[VIIRS_SCANS];
249  unsigned char pixelQuality[DNB_DETECTORS][DNB_VIIRS_COLS];
250  unsigned char pixelQuality_tc[DNB_DETECTORS][DNB_VIIRS_COLS];
251  unsigned char landwater[DNB_DETECTORS][DNB_VIIRS_COLS];
253 
254 typedef struct {
255  long long scanStartTime[VIIRS_SCANS];
256  long long scanMidTime[VIIRS_SCANS];
259  float sunzen[I_DETECTORS][I_VIIRS_COLS];
260  float sunazm[I_DETECTORS][I_VIIRS_COLS];
261  float satzen[I_DETECTORS][I_VIIRS_COLS];
262  float satazm[I_DETECTORS][I_VIIRS_COLS];
263  float height[I_DETECTORS][I_VIIRS_COLS];
265  float scPosition[VIIRS_SCANS][VEC_SIZE];
266  float scVelocity[VIIRS_SCANS][VEC_SIZE];
267  float scAttitude[VIIRS_SCANS][VEC_RPY_SIZE];
268  float scPositionStart[VIIRS_SCANS][VEC_SIZE];
269  float scVelocityStart[VIIRS_SCANS][VEC_SIZE];
270  float scAttitudeStart[VIIRS_SCANS][VEC_RPY_SIZE];
271  float scPositionEnd[VIIRS_SCANS][VEC_SIZE];
272  float scVelocityEnd[VIIRS_SCANS][VEC_SIZE];
273  float scAttitudeEnd[VIIRS_SCANS][VEC_RPY_SIZE];
274  float scSunZen[VIIRS_SCANS];
275  float scSunAzm[VIIRS_SCANS];
277  int act_scans; /* SDR structure may be less than full */
278  unsigned char scanQuality[VIIRS_SCANS];
279  unsigned char scanQuality2[VIIRS_SCANS];
280  unsigned char pixelQuality[I_DETECTORS][I_VIIRS_COLS];
281  unsigned char landwater[I_DETECTORS][I_VIIRS_COLS];
283 
284 /***************************************************************************
285 NOTE: These structures provide a grid row and column for
286 every pixel in the granule. The MDS used for the granule is also
287 copied here. These structures make granulating the Ancillary Data
288 a very fast process. All granule grids are polar stereographic.
289  **********************/
290 
291 
292 typedef struct {
293  double grow[M_DETECTORS][M_VIIRS_COLS];
294  double gcol[M_DETECTORS][M_VIIRS_COLS];
295  double ctr_grow[VIIRS_SCANS][MOD_VIIRSI_NRCTNGL];
296  double ctr_gcol[VIIRS_SCANS][MOD_VIIRSI_NRCTNGL];
297  mds_type gmds;
299  int act_scans; /* SDR structure may be less than full */
301 
302 typedef struct {
305  double ctr_grow[VIIRS_SCANS][DNB_VIIRSI_NRCTNGL];
306  double ctr_gcol[VIIRS_SCANS][DNB_VIIRSI_NRCTNGL];
309  int act_scans; /* SDR structure may be less than full */
311 
312 typedef struct {
313  double grow[I_DETECTORS][I_VIIRS_COLS];
314  double gcol[I_DETECTORS][I_VIIRS_COLS];
315  double ctr_grow[VIIRS_SCANS][IMG_VIIRSI_NRCTNGL];
316  double ctr_gcol[VIIRS_SCANS][IMG_VIIRSI_NRCTNGL];
319  int act_scans; /* SDR structure may be less than full */
321 
322 // A structure to contain the pointers to the DMS output buffers.
323 
324 typedef struct ViirsGeoOutputType {
327  // viirs_SDR_MOD_Unagg_Fgeoloc_type* mod_unagg;
336 
337 // Interpolation rectangle information. Contains row and column information
338 // for the interpolation data. Interpolation rectangle numbers for a scan
339 // are pushed onto the badRec vector if a point cannot be geolocated.
340 
341 typedef struct {
342  std::vector<int> badRec[VIIRS_SCANS];
344  int bgnRow;
345  int midRow;
346  int endRow;
351 
352 
353 #endif
354 
ViirsGeoEncoderType telHamEncData
signed char SCE_side[VIIRS_SCANS]
Definition: mds.h:95
viirs_SDR_IMG_Fgeoloc_type * img
ViirsGeoNadirType nadir_values
viirs_SDR_DNB_growcol_type * dnb_grid
viirs_SDR_MOD_Fgeoloc_type * mod_tc
const int M_A_VIIRS_COLS
VcstPolarStereographicDataSet * psds
viirs_SDR_MOD_Fgeoloc_type * mod
double lon[I_DETECTORS][I_VIIRS_COLS]
double t_sync[MAX_SCAN_NUMBER]
double grow[I_DETECTORS][I_VIIRS_COLS]
double moonPhase[I_DETECTORS][I_VIIRS_COLS]
const int MOD_VIIRSI_NRCTNGL
double moonFrac[I_DETECTORS][I_VIIRS_COLS]
double satazm[I_DETECTORS][I_VIIRS_COLS]
double moonazm[I_DETECTORS][I_VIIRS_COLS]
VcstPolarStereographicDataSet * psds_i
double matTempCorr[3][3]
double range[I_DETECTORS][I_VIIRS_COLS]
const int MAX_IMPULSE_NUMBER_TEL
int numPixelsPerAggZone[NUM_DNB_ZONES]
const int DNB_DETECTORS
double HAM_impulse_enc[MAX_SCAN_NUMBER][MAX_IMPULSE_NUMBER_HAM]
double u_aft[MAX_DETECTORS][3]
double tel_impulse_time[MAX_SCAN_NUMBER][MAX_IMPULSE_NUMBER_TEL]
double HAM_impulse_time[MAX_SCAN_NUMBER][MAX_IMPULSE_NUMBER_HAM]
float * lat
int num_impulse_HAM[MAX_SCAN_NUMBER]
const int DNB_VIIRSI_NRCTNGL
const int MAX_SCAN_SAMPLE
const int M_VIIRS_COLS
const int MAX_IMPULSE_NUMBER_HAM
double gcol[I_DETECTORS][I_VIIRS_COLS]
const int I_VIIRS_COLS
const int MAX_DETECTORS
viirs_SDR_IMG_growcol_type * img_grid
VcstPolarStereographicDataSet * psds_m
int num_impulse_tel[MAX_SCAN_NUMBER]
const int NUM_DNB_ZONES
const int IMG_VIIRSI_NRCTNGL
const int VEC_SIZE
double tel_impulse_enc[MAX_SCAN_NUMBER][MAX_IMPULSE_NUMBER_TEL]
double moonzen[I_DETECTORS][I_VIIRS_COLS]
double lat[I_DETECTORS][I_VIIRS_COLS]
viirs_SDR_MOD_growcol_type * mod_tc_grid
double lon[MAX_SCAN_NUMBER]
const int M_DETECTORS
const int DNB_VIIRS_COLS
viirs_SDR_DNB_Fgeoloc_type * dnb
VcstPolarStereographicDataSet * psds_d
double satzen[I_DETECTORS][I_VIIRS_COLS]
const int I_DETECTORS
viirs_SDR_MOD_growcol_type * mod_grid
const int VEC_RPY_SIZE
const int MAX_SCAN_NUMBER
double lat[MAX_SCAN_NUMBER]
double sunzen[I_DETECTORS][I_VIIRS_COLS]
unsigned char qFlags[I_DETECTORS][I_VIIRS_COLS]
double moon_vectors[VIIRS_SCANS][VEC_SIZE]
const int VIIRS_SCANS
Definition: VcstCmnConsts.h:58
double sunazm[I_DETECTORS][I_VIIRS_COLS]
float * lon
int HAM_impulse_flag[MAX_SCAN_NUMBER]
double sample_time[MAX_SCAN_NUMBER][MAX_SCAN_SAMPLE]
int tel_impulse_flag[MAX_SCAN_NUMBER]
signed char ham_start_not_nominal[VIIRS_SCANS]
const int VIIRSI_MAX_NRCTNGL
viirs_SDR_IMG_Fgeoloc_type * img_tc