OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_parameters.h
Go to the documentation of this file.
1 #ifndef GEO_PARAMETERS_H
2 #define GEO_PARAMETERS_H
3 #include "PGS_PC.h"
4 #include "GEO_geo.h"
5 #include "GEO_product.h"
6 #include "hdfi.h"
7 
8 /*
9 !C-INC**************************************************************************
10 !Description: The declaration of the global parameter variables for the
11  Level-1A geolocation software
12 
13 !Input Parameters: N/A
14 
15 !Output Parameters: N/A
16 
17 !Revision History:
18  * $Log: GEO_parameters.h,v $
19  * Revision 6.9 2011/02/14 21:28:31 kuyper
20  * Corrected to const-qualify *poly_coef.
21  *
22  * Revision 6.8 2010/07/01 19:38:43 kuyper
23  * Corrected definition of INPUTPOINTERS.
24  *
25  * Revision 6.7 2010/04/23 14:55:09 kuyper
26  * Converted new numbers controlling setting of quality flags into parameters
27  * retrieved from the parameter file.
28  *
29  * Revision 6.6 2010/04/08 18:01:21 kuyper
30  * Dropped orbit and attitude globals that are no longer needed.
31  * Helped resolve Bug 17 by adding field to fill_values_struct.
32  *
33  * Revision 6.5 2009/05/30 18:09:48 kuyper
34  * Corrected size of u_tel.
35  *
36  * Revision 6.4 2009/05/22 16:33:43 xgeng
37  * reinstated member qa_flag for frame_state_struct.
38  *
39  * Revision 6.3 2009/05/19 14:44:49 kuyper
40  * Reinstated T_mirr2inst, u_tel globals; cannot be dropped until after
41  * GEO_get_inst_mirr_normal() and GEO_get_view_vec() have been opened.
42  *
43  * Revision 6.2 2009/04/15 21:18:29 kuyper
44  * Removed member from frame_state_struct.
45  *
46  * Revision 6.1 2009/03/12 17:59:47 kuyper
47  * Changed MAX_DETECTORS to DETECTORS_QKM.
48  * Added hires_scale.
49  * Dropped globals no longer in use.
50  *
51  * Revision 5.4 2005/09/27 15:12:00 vlin
52  * Four fieldnames added to orbit_validation_params_struct
53  * vlin@saicmodis.com
54  *
55  * Revision 5.3 2004/08/30 21:15:23 kuyper
56  * Entered first non-dummy value for NUM_SOL_ELEV.
57  *
58  * Revision 5.2 2004/08/23 18:56:31 vlin
59  * fill_values_struct added, one member "fill_values" added to l1a_data_struct.
60  *
61  * Revision 5.1 2004/08/02 19:36:29 vlin
62  * NCSA acknowledgement removed from prologue,
63  * solar elevation correction matrix added.
64  *
65  * Revision 4.5 2003/08/22 22:18:52 kuyper
66  * Changed T_inst2SD to T_sc2SD.
67  *
68  * Revision 4.4 2003/08/05 21:12:19 kuyper
69  * Corrected location of processing metadata fields.
70  *
71  * Revision 4.3 2003/01/29 20:17:30 vlin
72  * Corrected declaration for encoder_gap
73  *
74  * Revision 4.2 2002/11/21 22:54:59 kuyper
75  * Added in packet_interval.
76  *
77  * Revision 4.1 2002/11/15 21:24:29 kuyper
78  * Added items needed to support temperture retrieval, expanded input pointers,
79  * and reprocessing and processingenvironment metadata.
80 
81 !Team-unique Header:
82 
83  This software is developed by the MODIS Science Data Support
84  Team for the National Aeronautics and Space Administration,
85  Goddard Space Flight Center, under contract NAS5-32373.
86 
87 !END****************************************************************************
88 */
89 
90 /* Identifying tag required on first line of geolocation parameter file. */
91 #define PARAM_TAG "MOD03_L1A_GEOLOCATION"
92 #define SCAN_TYPE_LEN 10
93 
94 /**********************************************************
95 Variables from the parameter file
96 **********************************************************/
97 
98 /* polynomial coefficients for mirror encoder-to-angle conversion */
99 extern double const * poly_coef;
100 extern int poly_degree;
101 
102 /* mirr errors alpha, beta, gamma */
103 extern double alpha;
104 extern double beta;
105 extern double gammaa;
106 
107 /* mirror side 1 angle range (radians) */
108 extern double mirr_side1_range[2];
109 
110 /* telescope to instrument frame transformation matrix */
111 extern double T_tel2inst[3][3];
112 
113 /* mirror to instrument frame transformation matrix */
114 extern double T_mirr2inst[3][3];
115 
116 /* viewing vector in telescope coord */
117 /* This is derived from instrument geometry parameters */
118 extern double u_tel[DETECTORS_QKM][3];
119 
120 /* scale factors for converting ancillary input data */
121 typedef struct{
122  double S_position; /* orbit position (1/8 meters/count) */
123  double S_velocity; /* orbit velocity (1/4096 meters/sec/count) */
124  double S_attitude; /* attitude angles (1 arcsec/count) */
125  double S_angvel; /* angular velocity (0.5 arcsec/sec/count) */
127 
128 /* location of data words in l1a data segments */
129 extern int sector_word[2]; /* Earth sector encoder word [side 1/side 2] */
130 extern int vernier_word[2]; /* Vernier count word [side 1/side 2] */
131 typedef struct{
132  int time_words[2]; /* ancillary time start word [current/prior] */
133  int orbit_words[2]; /* orbit data start word [current/prior] */
134  int attit_words[2]; /* attitude data start word [current/prior] */
136 
137 typedef struct{
141 
142 typedef struct {
143  uint8 num_impulse; /* number of good impulse data */
144  int impulse_flag; /* encoder data flag */
145  uint16 mirr_side; /* mirror side*/
146  double mirr_impulse_enc[MAX_IMPULSE_NUMBER]; /* mirror impulse encoder */
147  double mirr_impulse_time[MAX_IMPULSE_NUMBER]; /* times (TAI seconds) */
148  uint16 mirr_chan;
150 
151 typedef struct {
152  int32 L1A_scan_id;
153  int32 L1A_scan_quality[4]; /* Scan quality array */
154  float64 EV_start; /* Earth View scan start time (TAI seconds) */
155  int32 EV_frames; /* Earth View frames in each scan */
156  float64 SD_start; /* Solar Diffusor scan start times (TAI seconds) */
157  int32 SD_frames; /* Solar Diffusor frames in each scan */
158  float64 SV_start; /* Space View scan start times (TAI seconds) */
159  int32 SV_frames; /* Space View frames in each */
160  int8 SCI_ABNORM; /* spacecraft in unusual state
161  (i.e. maneuver) flag
162  0 = maneuver
163  1 = normal */
164  int8 SCI_STATE; /* instrument test mode flag
165  0 = MODIS test mode
166  1 = normal */
167  char8 Scan_type[SCAN_TYPE_LEN]; /*'Day', 'Night', or 'Other' */
169 
170 typedef struct{
171  float64 time; /* frame (mid-)sample time, TAI seconds */
172  float64 positionECR[3]; /* ECR postion, meters */
173  float64 velocityECR[3]; /* ECR velocity, meters/sec */
174  float64 eulerAngles[3]; /* attitude euler angles (roll, pitch, yaw) */
175  /* wrt the orbital reference frame (?), radians. */
176  float64 T_inst2ecr[3][3]; /* instrument to ecr coordinate transformation matrix. */
177  int qa_flag; /* kinematic state quality (FAIL, SUCCESS) */
179 
180 typedef struct {
182  float64 sun_unit_vector[3];
183  float64 SD_sun_zenith;
184  float64 SD_sun_azimuth;
185  float64 moon_unit_vector[3];
187 /* extern celestial_bodies_struct cb_vectors; */
188 
189 typedef struct {
202 
203 typedef struct {
204  char localversionid[17];
205  char pgeversion[11];
206  char processversion[11];
207  char productionhistory[32];
208  char processingenvironment[PGSd_PC_VALUE_LENGTH_MAX];
209  char reprocessingplanned[PGSd_PC_VALUE_LENGTH_MAX];
210  char reprocessingactual[PGSd_PC_VALUE_LENGTH_MAX];
212 
213 typedef struct {
214  char rangebeginningdate[11];
215  char rangebeginningtime[16];
216  char rangeendingdate[11];
217  char rangeendingtime[16];
218  char operationmode[8];
219  char localinputgranuleid[PGSd_PC_FILE_PATH_MAX];
220  char granulenumber[8];
221  char platformshortname[20];
224 
225 typedef struct {
226  PGSt_integer orbitnumber;
228  char equatorcrossingdate[11];
229  char equatorcrossingtime[16];
231 
232 typedef struct {
234  float64 EV_start_time;
235  float64 SD_start_time;
236  float64 SV_start_time;
237  float32 SD_sun_zenith;
238  float32 SD_sun_azimuth;
239  float32 moon_vector;
240  float32 sun_ref;
241  uint16 mirr_side;
242  uint16 raw_mir_enc;
243  float64 impulse_enc;
244  float64 impulse_time;
247  float64 EV_center_time;
248  float64 orb_pos;
249  float64 orb_vel;
250  float64 T_inst2ECR;
252  int32 EV_frames;
253  int32 SD_frames;
254  int32 SV_frames;
255  uint8 num_impulse;
256  char8 Scan_type[SCAN_TYPE_LEN];
258 
259 #define NUM_TEMPS 6
260 #define NUM_SOL_ELEV 36
261 
262 typedef struct {
268  float32 temperatures[NUM_TEMPS];
270  } l1a_data_struct;
271 /* extern l1a_data_struct l1a_data; */
272 
273 typedef struct {
274  int band_number; /* band number to geolocate (0 is ideal band) */
275  double t_reset; /* time to reset sample at beginning of frame */
276  double t_frame; /* sample frame time */
277  /* offset in IFOV units to get time of first sample for a band */
278  double F_offset[MAX_BAND_NUMBER+1];
279  /* number of samples per frame for each band */
280  uint16 N_samp[MAX_BAND_NUMBER+1];
281  float64 focal_length[MAX_BAND_NUMBER+1]; /* focal length */
282  /* detector position for each band */
283  float64 det_space[MAX_BAND_NUMBER+1];
284  float64 det_position[MAX_BAND_NUMBER+1][2];
285  float64 band_position[MAX_BAND_NUMBER+3]; /* band center position */
287 /* extern focal_plane_geometry_struct geometry_params; */
288 
289 typedef struct {
290  /* Number of sample periods from sector start to start of data collection */
291  double N_reset;
292  double mirr_abs_limit[2]; /* mirror encoder time absolute limits */
293  double mirr_del_limit; /* mirror encoder time delta limits */
294  int sample_impulse; /* encoder sample period in impulses */
295  int sector_word[2]; /* Earth sector encoder word [side 1/side 2] */
296  int vernier_word[2]; /* Vernier count word [side 1/side 2] */
297  double t_encoder; /* encoder time scale factor */
298  double t_vernier; /* vernier offset count time */
299  double encoder_gap[2]; /* Range affected by encoder_adjustment. */
300  double encoder_adjustment; /* Size of encoder correction. */
301  double packet_interval; /* Interval between ancillary packets.*/
303 /* extern mirror_preparation_struct mirror_prep_params; */
304 /* offsets into mirr_abs_limit */
306 
307 typedef struct {
308  double mirr_side1_range[2]; /* mirror side 1 angle range (radians) */
309  float64 alpha;
310  float64 beta;
311  float64 gammaa;
313 /* extern mirror_model_struct mirror_model; */
314 
315 typedef struct {
316  double position_abs_limit[2]; /* orbit position absolute limits */
317  double position_mag_limit[2]; /* orbit position magnitude limits */
318  double velocity_abs_limit[2]; /* orbit velocity absolute limits */
319  double velocity_mag_limit[2]; /* orbit velocity magnitude limits */
320  double ang_mom_limit[2]; /* angular momentum magnitude limits */
321  double ang_mom_z_limit[2]; /* angular momentum Z component */
322  /* orbit position/velocity consistency limit */
323  double orbit_consistency;
324  double descend_time_0[2];
325  /* the descend time corresponding to orbit number 0 */
326  double orbit_tolerance[2];
327  double period[2];
329  double eph_max_short_gap; /* Maximum length of a short gap */
331 /* extern orbit_validation_params_struct orbit_valid_params; */
332 
333 typedef struct {
334  double angvel_abs_limit[2]; /* angular velocity absolute limits */
335  double angvel_del_limit; /* angular velocity delta limits */
336  double attitude_abs_limit[2]; /* attitude angle absolute limits */
337  double attitude_del_limit; /* attitude angle delta limits */
338  double attit_consistency; /* angle/angular velocity consistency limit */
339  double att_max_short_gap; /* Maximum length of a short gap. */
340  short att_valid_range[2]; /* Limits for valid entrained attitude */
342 /* extern attitude_valid_struct attit_valid_params; */
343 
344 typedef struct {
345  float64 T_inst2sc[3][3]; /* instrument to spacecraft */
346  float64 T_mirr2inst[3][3]; /* mirror to instrument frame */
347  float64 T_tel2inst[3][3]; /* telescope to instrument frame */
348  float64 T_sc2SD[3][3]; /* spacecraft to solar diffuser */
349  int rpy_count; /* count of rows in rpy_inst2sc */
350  double (*rpy_inst2sc)[3]; /* Roll/Pitch/Yaw corrections for
351  * T_inst2sc */
352  double *rpy_times; /* The corresponding TAI times */
354 /* extern internal_coord_trans_struct coord_trans; */
355 
356 /*
357  * ELEC_SIDES has two possible values, which are defined below.
358  */
359 #define CHAN_A 0
360 #define CHAN_B 1
361 
362 #define NUM_TEMP_EQNS 7
363 #define TEMP_ORDER 6
364 
365 typedef struct {
366  char revision[32];
367  focal_plane_geometry_struct geometry_params;
368  mirror_preparation_struct mirror_prep_params;
369  mirror_model_struct mirror_model;
371  double max_non_gap;
372  /* Minimum interval between packets that is considered a gap. */
375  internal_coord_trans_struct coord_trans;
376  /* number of detectors for band_number */
377  int num_detectors;
378  /* telescope view vector in meters. */
379  double u_tel[DETECTORS_QKM][3];
380  /* maximum orbit/attitude extrapolation limit (seconds) */
381  double max_extrap;
382  /* polynomial coefficients for mirror encoder-to-angle conversion */
384  int poly_degree;
385  /* scale factors for scaling geolocation output values: */
386  double angle_scale; /* counts/radian */
387  double hires_scale; /* kilometers IFOV */
388  double range_scale; /* counts/meter */
389  float32 RMS_error; /* estimated geo RMS error (meters). */
390  char spacecraft_ID[8];
391 
392  float32 temp_range[NUM_TEMP_EQNS][2];
393  /* The valid output range of the temperature conversion functions.*/
394  float32 temp_coeff[NUM_TEMP_EQNS][TEMP_ORDER];
395  double sol_elev_cor[NUM_SOL_ELEV][3];
396  /* The polynomial coefficients of the temperature conversion
397  * functions.
398  */
400 
401 typedef struct {
402  char exclusionflag[2]; /* Flag indicating whether points
403  are on an inner (exclusion) G-ring.*/
404  int sequenceno[4]; /* Sequence numbers corresponding to
405  perimeter latitudes and longitudes. */
406  double latitude[4]; /* Latitudes of a series of points
407  representing the perimeter of the
408  granule spatial coverage. */
409  double longitude[4]; /* Longitudes of a series of points
410  representing the perimeter of the
411  granule spatial coverage. */
413 
414 #define INPUTPOINTERS (2 + 2*MAX_EA_FILES)
415 typedef struct {
416  char inputpointer[INPUTPOINTERS][PGSd_PC_UREF_LENGTH_MAX];
418 
419 typedef struct {
420  int no_of_pixels; /* total number of pixels in granule */
421  int missingdata; /* no. of pixels for which there are
422  insufficient data to perform geolocation */
423  int outofboundsdata;/* no. of pixels that have un-
424  geolocatable views */
425  int retval; /* FAIL/SUCCESS, depending upon whether a
426  fatal error was detected */
427  char rms_error[9]; /* string value of RMS geolocation error*/
428  uint32 cumulated_gflags[8]; /* Cumulated count of pixels for which the
429  corresponding bit of gflags was set.
430  LSB corresponds to first element.*/
431 
433 
434 #endif
435 
#define TEMP_ORDER
double orbit_consistency
integer, parameter int16
Definition: cubeio.f90:3
double position_mag_limit[2]
double beta
PGSt_integer orbitnumber
double * mirr_impulse_time[MAX_SCAN_NUMBER]
#define SCAN_TYPE_LEN
int vernier_word[2]
double velocity_abs_limit[2]
real(single), dimension(:,:), allocatable longitude
#define INPUTPOINTERS
#define NUM_TEMPS
int poly_degree
real(single), dimension(:,:), allocatable latitude
double T_tel2inst[3][3]
double ang_mom_limit[2]
const int MAX_POLY_DEGREE
double position_abs_limit[2]
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
double gammaa
double ang_mom_z_limit[2]
l1a_metadata_struct granule_metadata
frame_state_struct sc
fill_values_struct fill_values
double velocity_mag_limit[2]
ancil_scale_struct ancil_scale_factors
double attitude_abs_limit[2]
#define NUM_TEMP_EQNS
#define ELEC_SIDES
Definition: GEO_geo.h:108
PGSt_double equatorcrossinglongitude
@ lower_limit
integer, parameter double
constexpr float focal_length
double angvel_abs_limit[2]
ancil_word_struct ancil_words
orbit_validation_params_struct orbit_valid_params
const int MAX_SCAN_NUMBER
#define MAX_IMPULSE_NUMBER
Definition: GEO_geo.h:91
#define NUM_SOL_ELEV
double T_mirr2inst[3][3]
double alpha
Definition: color_dtdb.py:352
const int MAX_BAND_NUMBER
ancil_data_param_struct ancil_params
double mirr_side1_range[2]
MOD_PR01 Production producing one five minute granule of output data in each run It can be configured to produce as many as three five minute granules per run Each execution with one construction record and one date file for each dataset In normal these are created by which splits them out of the hour datasets For LANCE they are created by which merges all session MODIS L0 datasets overlapping the requested time period
Definition: MOD_PR01_pr.txt:15
#define DETECTORS_QKM
Definition: GEO_geo.h:87
int sector_word[2]
@ upper_limit
version_metadata_struct version_metadata
double * mirr_impulse_enc[MAX_SCAN_NUMBER]
ECS_metadata_struct ECS_metadata
attitude_valid_struct attit_valid_params
const double * poly_coef
double u_tel[DETECTORS_QKM][3]