ocssw V2020
VcstGeoParameters.h
Go to the documentation of this file.
1 /**************************************************************************
2  *
3  * NAME: VcstGeoParameters
4  *
5  * DESCRIPTION: Contains variables and structures used by the ProSdrViirs
6  * geolocation routines.
7  *
8  *
9  **************************************************************************/
10 /* file: VcstGeoParameters.h */
11 
12 #ifndef GEO_PARAMETERS_H
13 #define GEO_PARAMETERS_H
14 
15 #include <VcstCmnConsts.h>
16 #include <VcstCalLutStructures.h>
17 
18 #define DM_BADADDRESS ((void *) -1L)
19 
20 const int EV_FRAMES_375M = 6400;
21 const int EV_FRAMES_750M_UNAGG = 6304;
22 const int EV_FRAMES_750M = 3200;
23 const int EV_FRAMES_DNB = 4064;
24 
25 const int M_DETECTORS = 16;
26 const int I_DETECTORS = 32;
27 //const int NUM_DETECTORS_DNB = 16;
28 const int DNB_DETECTORS = 16;
29 
30 const int I_VIIRS_COLS = 6400;
32 const int M_VIIRS_COLS = 3200;
34 const int M_A_VIIRS_COLS = 5024;
35 const int DNB_VIIRS_COLS = 4064;
37 
38 // VIIRS Moderate dual gain number of Columns
39 const int M_D_VIIRS_COLS = 6304;
40 
41 //const int VEC_SIZE = 3;
42 const int VEC_RPY_SIZE = 3;
43 
44 const int NUM_BITS_PER_BYTE = 8;
45 //const int NUM_DETECTORS = 432;
46 //const int NUM_BANDS = 22;
47 
48 //const int NUM_THERMISTORS = 26;
50 const int MAX_BAND_NUMBER_PLUS_ONE = 37;
51 //const int NUM_ELECTRONICS_SIDE = 2;
52 const int MAX_THERMISTOR_ID_LEN = 40;
53 const int NUM_AGG_ZONES = 5;
54 //const int NUM_MOON_OFFSET_LIMITS = 4;
55 
56 const int MAX_BAND_NUMBER = 22;
58 const int MAX_DETECTORS = 32;
59 const int MAX_POLY_DEGREE = 4;
60 const int CHEBY_ORDER = 4;
61 
62 /* telescope encoder impulses/Earth view */
63 const int MAX_IMPULSE_NUMBER_TEL = 1290;
64 const int ENCODER_LENGTH_TEL = 1290;
65 
66 /* mirror encoder impulses/Earth view */
67 const int MAX_IMPULSE_NUMBER_HAM = 1290;
68 const int ENCODER_LENGTH_HAM = 1290;
69 
70 const int SECTOR_LENGTH = 32; /* no. of view sector def, words/scan */
71 const int ANCIL_LENGTH = 64; /* no. of S/C ancillary data words/scan */
72 
73 /* used for flags to indicate data quality */
74 const int GOOD_DATA = 0;
75 const int BAD_DATA = -1;
76 const int SERVO_CNTRL_BAD_DATA = -2;
77 const int DEGRADED_DATA = 2;
78 
79 const int GEO_FAIL = -1; /* GEO_FAIL represents a default index if no index
80  of the next unflagged value is found */
81 
82 const int mirr_lower_limit = 0;
83 const int mirr_upper_limit = 1;
84 
85 const int tel_lower_limit = 0;
86 const int tel_upper_limit = 1;
87 
88 // const double MAX_ANGLE = PIO2;
89 
90 // Desciption of interpolation rectangles
91 const int MOD_VIIRSI_NRCTNGL = 400;
92 const int MOD_VIIRSI_TWIDTH = 8;
93 const int MOD_MIDDLE_ROW = 7;
94 
95 const int DNB_VIIRSI_NRCTNGL = 508;
96 const int DNB_VIIRSI_TWIDTH = 8;
97 const int DNB_MIDDLE_ROW = 7;
98 
99 const int IMG_VIIRSI_NRCTNGL = 400;
100 const int IMG_VIIRSI_TWIDTH = 16;
101 const int IMG_MIDDLE_ROW = 15;
102 
104 
105 /************************************************************************
106  * Constants for the VIIRS resolution aggregation zones at the SDR level
107  **********************************************************************/
108 const int NumModImgAggZones = 5; // 5 zones because zone 3,4 are the same
109 
110 const int ViirsModPixPerZone[NumModImgAggZones] ={640, 368, 1184, 368, 640};
111 
112 const int ViirsImgPixPerZone[NumModImgAggZones] ={1280, 736, 2368, 736, 1280};
113 
114 // For DNB the array begins at the edge of scan and ends at nadir. The
115 // last number is the 2 nadir zones combined
116 const int NumDnbAggZones = 63; // 63 zones because zones 32,33 are the same
117 const int ViirsDnbPixPerZone[NumDnbAggZones] ={80, 16, 64, 64, 64, 32, 24, 72, 40, 56, 40, 48, 32, 48, 32, 72,
118  72, 72, 80, 56, 80, 64, 64, 64, 64, 64, 72, 80, 72, 88, 72, 368,
119  72, 88, 72, 80, 72, 64, 64, 64, 64, 64, 80, 56, 80, 72, 72,
120  72, 32, 48, 32, 48, 40, 56, 40, 72, 24, 32, 64, 64, 64, 16, 80};
121 
122 
123 // enumerated indexes for the temperature correction values
124 
126  ROLL_IDX = 0, // roll index
127  PITCH_IDX, // pitch index
128  YAW_IDX // yaw index
129 };
130 
132  FILL_POINT = 0, // fill a single point
133  FILL_DETECTOR_ARRAY, // fill all the detectors for a frame
134  FILL_SCAN_ARRAY // fill values for an entire scan level array
135 };
136 
137 const int MAX_SCAN_SAMPLE = 6400;
138 const int NUM_DNB_ZONES = 64;
139 
141 const int VECTOR_SIZE = 3; /* thermal correction vector */
142 
143 /* flag conditions */
144 const unsigned char INVALID_INPUT_DATA = 128;
145 const unsigned char NO_ELLIPSE_INTERSECT = 64;
146 const unsigned char BAD_TERRAIN = 32;
147 const unsigned char INVALID_SENSOR_ANGLES = 8;
148 
149 
150 const double MIN_TERRAIN_HEIGHT = -450.0; /* units in meters */
151 const double MAX_TERRAIN_HEIGHT = 9600.0; /* units in meters */
152 
153 const int ORDER_CHEBY = 4;
154 
156  LAT_IDX = 0,
159 };
160 
168 };
169 
170 
171 const unsigned short MAX_UINT16_VAL = 65535;
172 
177 };
178 
179 /* Constants for temperature correction LUT */
180 const int MAX_TEMPERATURE_BRKTS = 11; /*this is a guess */
181 const int MAX_TEMPERATURE_COEFS = 22; /*this is a guess */
182 const int MAX_TEMPERATURE_IND_VARS = 22; /*this is a guess */
183 const int IDXARRAY_SIZE = 9; /* set to match input file */
184 
185 /* constants used for interpolating moderate unaggregated from aggregated */
186 const double ONE = 1.0, TWO = 2.0, THREE = 3.0, FOUR = 4.0;
187 const double HALF = ONE / TWO;
188 const double THIRD = ONE / THREE;
189 const double TWOTHIRDS = TWO / THREE;
190 const double FOURTHIRDS = THIRD + ONE;
191 const double FIVETHIRDS = TWOTHIRDS + ONE;
192 const double FOURTH = ONE / FOUR;
193 const double THREEFOURTHS = THREE / FOUR;
194 const double FIVEFOURTHS = FOURTH + ONE;
195 const double SEVENFOURTHS = THREEFOURTHS + ONE;
196 
197 const int NUM_UNAGG_PRODUCTS = 8; // number of products interpolated
198 
199 // indices into arrays holding the interpolated products
200 
210 };
211 
213  LOWEREND = 0,
216 };
217 
218 // Start of aggregation zones (Moderate aggregated)
219 const int START_AGG_ZONE1 = 0;
220 const int START_AGG_ZONE2 = 640;
221 const int START_AGG_ZONE3 = 1008;
222 const int START_AGG_ZONE4 = 1600;
223 const int START_AGG_ZONE5 = 2192;
224 const int START_AGG_ZONE6 = 2560;
225 
226 // End of aggregation zones (Moderate aggregated)
232 const int END_AGG_ZONE6 = 3200;
233 
234 // Start of aggregation zones (Moderate unaggregated)
235 const int START_UNAGG_ZONE2 = 0;
236 const int START_UNAGG_ZONE3 = 736;
237 const int START_UNAGG_ZONE5 = 4288;
238 
239 // End of aggregation zones (Moderate unaggregated)
242 const int END_UNAGG_ZONE5 = 5023;
243 
244 typedef struct {
245  int band_number; // band no. to geolocate (0=ideal band)
246  char pad0[4];
248  double t_reset; // time to reset sample at beginning of frame
249 
250  unsigned short N_samp[MAX_BAND_NUMBER_PLUS_ONE];
251  char pad1[6];
253  double det_space_track[MAX_BAND_NUMBER_PLUS_ONE];
254  double det_space_scan[MAX_BAND_NUMBER_PLUS_ONE];
255  double DNB_space_track[32];
256  double DNB_space_scan[32];
257  double det_position[MAX_BAND_NUMBER_PLUS_ONE][2];
258 
259  // band center position
260  double band_position[MAX_BAND_NUMBER_PLUS_ONE];
261 
264  double scan_length;
265  int agg_zone_bounds[NUM_AGG_ZONES];
266  int DNB_aggregation[32][2];
267  int DNB_ag_zone_bounds[64][3];
268  char implicit_pad1[4];
271  double scan_ang_offsets[2];
273 
274 typedef struct {
275  double enc_scale; // Scale to convert from 14-bit to 16-bit
276  double mirr_abs_limit[MAX_LIMIT_CHECK]; // mirror encoder time absolute limits
277  double mirr_del_limit; // mirror encoder time delta limits
278  double tel_abs_limit[MAX_LIMIT_CHECK]; // telescope encoder time absolute limits
279  double tel_del_limit; // telescope encoder time delta limits
280  int sample_impulse_mirr; // encoder sample period in impulses
281  int sample_impulse_tel; // encoder sample period in impulses
282  int A_bit_adj[2]; // Encoder adjust [even SOS/odd SOS]
283  int B_HAM_adj[2]; // HAM enc adjust [side A/side B]
284  double t_encoder; // encoder time scale factor
286 
287 typedef struct {
288  double mirr_side1_range[2]; // mirror side 1 angle range (radians)
289  double alpha;
290  double beta;
291  double gammaa;
293 
294 typedef struct {
295  double position_abs_limit[2]; // orbit position absolute limits
296  double position_mag_limit[2]; // orbit position magnitude limits
297  double velocity_abs_limit[2]; // orbit velocity absolute limits
298  double velocity_mag_limit[2]; // orbit velocity magnitude limits
299  double ang_mom_limit[2]; // angular momentum magnitude limits
300  double ang_mom_z_limit[2]; // angular momentum Z component
301  double orbit_consistency; // orbit pos./vel. consistency limit
303 
304 typedef struct {
305  double attitude_abs_limit[2]; // attitude angle absolute limits
307 
308 typedef struct {
309  double T_inst2sc[3][3]; // instrument to spacecraft
310  double T_mirr2inst[3][3]; // mirror to instrument frame
311  double T_aft2inst[3][3]; // aft optics to instrument frame
312  double T_inst2SD[3][3]; // instrument to solar diffuse
313  double T_tel2inst[3][3]; // telescope to instrument
315 
316 typedef struct {
317  // Number of thermistors currently used in thermal correction.
319 
320  // Identifier for each thermistor.
321  unsigned char thermistor_id[MAX_THERMISTOR_ID_LEN][NUM_THERMISTORS];
322 
323  // Coefficient array for determination of instrument
324  // temperature from thermistor readings.
325  char implicit_pad1[4];
326  double thermistor_coeffs[NUM_THERMISTORS][6];
328 
329 // Filename,VcstGeoParameters
330 // Type,GEO_param_struct
331 
332 typedef struct {
333  unsigned char revision[10];
334  char pad1[6];
340 
341  double Mag[3][3];
342  double basis_in[3][3];
343  double basis_out[3][3];
344 
345 
346  // polynomial coefficients for HAM encoder-to-angle conversion
347  double poly_coef_mirr[MAX_POLY_DEGREE_PLUS_ONE];
348 
349  // polynomial coefficients for telescope encoder-to-angle conversion
351 
352  double tel_ref;
353  double min_cos_view; // minimum cos(SensorZenAngle)
354  // for near limb test
355 
357 
358  int num_detectors; // no. of band_number detectors
359 
360  // degree of polynomial used to calculate tel and mirr pos
362 
363  unsigned short N_frame; // no. frames per scan
364 
365  char pad2[2];
366 
367 
369 
370 
371 #endif
const double MAX_TERRAIN_HEIGHT
@ FILL_SCAN_ARRAY
const int END_AGG_ZONE5
const int IMG_VIIRSI_TWIDTH
unsigned short N_frame
InterpArrayIndexType
const int M_D_VIIRS_COLS
double position_mag_limit[2]
const double ONE
const int END_UNAGG_ZONE2
const int M_A_VIIRS_COLS
@ SOL_ZEN_IDX
const double HALF
const int IMG_MIDDLE_ROW
const int NumDnbAggZones
const int SERVO_CNTRL_BAD_DATA
const int MAX_TEMPERATURE_COEFS
const int MOD_VIIRSI_NRCTNGL
const double SEVENFOURTHS
double velocity_abs_limit[2]
const int EV_FRAMES_750M
const int DEGRADED_DATA
double T_mirr2inst[3][3]
const int NUM_ELECTRONICS_SIDE
const int M_VIIRS_ROWS
const int NUM_BITS_PER_BYTE
const int START_AGG_ZONE2
@ UPPEREND
internal_coord_trans_struct coord_trans
const int START_UNAGG_ZONE3
const int tel_lower_limit
const unsigned char NO_ELLIPSE_INTERSECT
const double TWO
@ FILL_DETECTOR_ARRAY
const int MAX_IMPULSE_NUMBER_TEL
const double THIRD
const int DNB_DETECTORS
@ FILL_POINT
const int MAX_POLY_DEGREE_PLUS_ONE
@ SOL_AZM_IDX
const int END_UNAGG_ZONE5
const double FOURTHIRDS
double ang_mom_limit[2]
@ PITCH_IDX
const int DNB_VIIRSI_NRCTNGL
const int BAD_DATA
const int MAX_SCAN_SAMPLE
const int MAX_POLY_DEGREE
@ HT_IDX
double position_abs_limit[2]
const int START_AGG_ZONE1
@ azimuth_index
LocationType
@ I_SATA_IDX
const unsigned char BAD_TERRAIN
const int M_VIIRS_COLS
const int I_VIIRS_ROWS
@ I_LAT_IDX
const int EV_FRAMES_375M
const int NUM_AGG_ZONES
const int END_AGG_ZONE1
const double THREE
@ SAT_ZEN_IDX
#define Number_of_Scans
const double MIN_TERRAIN_HEIGHT
const int VECTOR_SIZE
const int START_AGG_ZONE4
const int MAX_IMPULSE_NUMBER_HAM
const int EV_FRAMES_750M_UNAGG
const int CHEBY_ORDER
const int NUM_TEMPERATURE_INPUTS
@ I_SATZ_IDX
@ YAW_IDX
const int I_VIIRS_COLS
const int END_AGG_ZONE6
const int SECTOR_LENGTH
const int EV_FRAMES_DNB
@ LOWEREND
const int MOD_VIIRSI_TWIDTH
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in per delivery and then split off a new MYD_PR03 pcf file for Aqua Added AssociatedPlatformInstrumentSensor to the inventory metadata in MOD01 mcf and MOD03 mcf Created new versions named MYD01 mcf and MYD03 where AssociatedPlatformShortName is rather than Terra The program itself has been changed to read the Satellite Instrument validate it against the input L1A and LUT and to use it determine the correct files to retrieve the ephemeris and attitude data from Changed to produce a LocalGranuleID starting with MYD03 if run on Aqua data Added the Scan Type file attribute to the Geolocation copied from the L1A and attitude_angels to radians rather than degrees The accumulation of Cumulated gflags was moved from GEO_validate_earth_location c to GEO_locate_one_scan to ensure that all gflag bits get accumulated Changed GEO_write_ECS_metadata to write PGEVERSION as Changed GEO_locate_one_granule c to make a failure to find an orbit number in the staged ephemeris files be non fatal Updated GEO_parameters dat to reflect latest estimate of T_inst2sc
Definition: HISTORY.txt:472
const int END_AGG_ZONE4
double ang_mom_z_limit[2]
const double FOURTH
const int ORDER_CHEBY
const int ViirsImgPixPerZone[NumModImgAggZones]
const int MAX_THERMISTOR_ID_LEN
@ SAT_AZM_IDX
const int MAX_DETECTORS
@ MAX_LIMIT_CHECK
const int START_UNAGG_ZONE5
const int NUM_DNB_ZONES
@ LUN_AZM_IDX
focal_plane_geometry_struct geometry_params
const double FIVETHIRDS
const int MOD_MIDDLE_ROW
const int mirr_upper_limit
const int DNB_VIIRSI_TWIDTH
GeoFillActionType
const int NUM_THERMISTORS
const int IMG_VIIRSI_NRCTNGL
const unsigned char INVALID_SENSOR_ANGLES
const int ViirsDnbPixPerZone[NumDnbAggZones]
double velocity_mag_limit[2]
const double FOUR
double attitude_abs_limit[2]
const int GOOD_DATA
const int ViirsModPixPerZone[NumModImgAggZones]
@ ROLL_IDX
DirectionDistanceType
const int GEO_FAIL
const double FIVEFOURTHS
@ I_SOLZ_IDX
double T_tel2inst[3][3]
const int NUM_UNAGG_PRODUCTS
constexpr float focal_length
const int M_DETECTORS
const int MAX_TEMPERATURE_BRKTS
const int DNB_VIIRS_COLS
@ I_SOLA_IDX
const int START_AGG_ZONE6
const int I_DETECTORS
@ range_index
@ LON_IDX
thermistor_parameter_struct thermistor_params
const int START_AGG_ZONE3
const int NumModImgAggZones
const int END_AGG_ZONE3
AttitudeType
mirror_model_struct mirror_model
const int VEC_RPY_SIZE
@ LAT_IDX
const int MAX_TEMPERATURE_IND_VARS
const int MAX_SCAN_NUMBER
mirror_preparation_struct mirror_prep_params
const int START_UNAGG_ZONE2
DirectionType
const int END_AGG_ZONE2
const int MAX_BAND_NUMBER_PLUS_ONE
const int ANCIL_LENGTH
const int tel_upper_limit
ViirsGeoLimitCheck
@ z_angle_index
const int DNB_VIIRS_ROWS
const int DNB_MIDDLE_ROW
const int ENCODER_LENGTH_HAM
const int MAX_BAND_NUMBER
const unsigned char INVALID_INPUT_DATA
double mirr_side1_range[2]
const double TWOTHIRDS
@ LUN_ZEN_IDX
@ I_HT_IDX
@ I_LON_IDX
const int END_UNAGG_ZONE4
const int mirr_lower_limit
const int IDXARRAY_SIZE
const int ENCODER_LENGTH_TEL
@ I_RANGE_IDX
const double THREEFOURTHS
const int VIIRSI_MAX_NRCTNGL
const unsigned short MAX_UINT16_VAL
const int START_AGG_ZONE5