OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_earth.h
Go to the documentation of this file.
1 /*
2 !C-INC*************************************************************************
3 !Description: the prototype of the modules which performs the earth location
4  for the Level-1A geolocation software
5 
6 !Input Parameters: N/A
7 
8 !Output Parameters: N/A
9 
10 !Revision History:
11 $Log: GEO_earth.h,v $
12 Revision 6.17 2013/06/18 19:56:01 jkuyper
13 Removed attitQuat from function interfaces.
14 
15 Revision 6.16 2013/05/23 18:40:08 jkuyper
16 Change l1a_data argument of GEO_earth_location() to be a pointer to
17  non-const, to allow initialization of mirr_impulse_enc.
18 
19 Revision 6.15 2011/02/14 21:15:14 kuyper
20 Changed GEO_aggregate to work on landsea mask, and to fill in waterpresent
21  array.
22 
23 Revision 6.14 2010/08/12 22:13:55 kuyper
24 changed GEO_initialize_DEM to return a status code.
25 
26 Revision 6.13 2010/05/27 20:38:34 kuyper
27 Corrected declaration for GEO_get_ephatt_inputs().
28 
29 Revision 6.12 2010/05/27 17:45:20 kuyper
30 Corrected dimensions of frame_quality parameter for GEO_aggregate().
31 
32 Revision 6.11 2010/05/27 15:20:07 kuyper
33 Changed input pointers for GEO_solar_and_lunar_vectors() into pointers to
34  const.
35 
36 Revision 6.10 2010/05/19 22:05:54 kuyper
37 Simplified interfaces by passing a GEO_parameters_struct, rather than it's
38  members.
39 
40 Revision 6.9 2010/04/09 20:31:24 kuyper
41 Removed obsolete argument from GEO_check_ea_headers().
42 
43 Revision 6.8 2010/04/02 21:30:23 kuyper
44 Dropped unused argument of GEO_aggregate().
45 Corrected several typos.
46 
47 Revision 6.7 2010/03/31 15:28:36 kuyper
48 Helped resolve Bug 1969 by adding rpy as an argument to two functions.
49 Helped resolve Bug 2471 by adding declaration for GEO_get_ephatt_inputs().
50 Helped resolve Bug 2472 by adding sample_quality, frame_quality, and
51  qualityFlags arguments to several functions.
52 Helped resolve Bug 2473 by adding scTagInfo and eulerAngelOrder arguments.
53 James Kuyper james.kuyper@sigmaspace.com
54 
55 Revision 6.6 2009/05/30 17:23:45 kuyper
56 Corrected parameter list for GEO_earth_location().
57 
58 Revision 6.5 2009/05/22 16:17:07 xgeng
59 Corrected prototype for GEO_solar_and_lunar_vectors.
60 
61 Revision 6.4 2009/04/28 19:59:51 kuyper
62 Corrected order of parameters for GEO_aggregate().
63 
64 Revision 6.3 2009/03/27 21:38:50 kuyper
65 Removed pointless leading dimensions of "array" parameters.
66 
67 Revision 6.2 2009/03/20 21:00:15 kuyper
68 Corrected prototype for GEO_solar_and_lunar_vectors.
69 
70 Revision 6.1 2009/03/13 14:23:45 kuyper
71 Replaced MAX_SCAN_SAMPLE with PADDED_SAMPLES.
72 Replaced MAX_DETECTORS with DETECTORS_QKM.
73 Changed parameter lists and return types for GEO_ellip_position(),
74  GEO_earth_location(), and GEO_terrain_correct().
75 Added GEO_aggregate() and GEO_hires().
76 
77 Revision 5.2 2005/03/16 21:37:03 kuyper
78 Changed header guard macro name to avoid reserved name space.
79 
80 Revision 5.1 2004/10/14 17:47:55 vlin
81 Function prototypes updated for collection 5.
82 
83 Revision 4.5 2003/08/26 21:26:50 kuyper
84 Changed offsets parameters to be pointers to const.
85 
86 Revision 4.4 2003/08/22 22:03:25 kuyper
87 Added T_sc2ecr arguments to two functions.
88 
89 Revision 4.3 2003/08/11 20:53:54 vlin
90 GEO_interp_ECR() added.
91 
92 Revision 4.2 2003/07/23 20:16:03 vlin
93 several functions updated.
94 
95 Revision 4.1 2003/03/13 21:40:34 kuyper
96 Updated two functions to take multiple time values.
97 Added GEO_check_ea_headers.
98 James Kuyper Jr. kuyper@saicmodis.com
99 
100 
101 !Team-unique Header:
102  This software is developed by the MODIS Science Data Support
103  Team for the National Aeronautics and Space Administration,
104  Goddard Space Flight Center, under contract NAS5-32373.
105 
106 !END***************************************************************************
107 */
108 
109 #ifndef GEO_EARTH_H
110 #define GEO_EARTH_H
111 #include "PGS_EPH.h"
112 #include "smfio.h"
113 #include "GEO_parameters.h"
114 #include "mapi.h"
115 #include "GEO_geo.h"
116 #include "GEO_global_arrays.h"
117 
118 #define EARTH_MODEL "WGS84"
119 #define BAD_GEOID -9999
120 /*********************************************************
121 function prototypes
122 *********************************************************/
123 
124 PGSt_SMF_status GEO_aggregate(
125  int32 /* EV_frames */,
126  uint16 /* N_samp */,
127  double /* hires_scale */,
128  unsigned char /* sample_flags */[][MAX_PADDED],
129  double /* ecr_sample_position */[][MAX_PADDED][3],
130  double /* ecr_sc_sample_position */[][3],
131  double /* terrain_sample_position */[][MAX_PADDED][3],
132  uint32 /* sample_quality */[][2],
133  uint8 /* sample_landsea */[][MAX_PADDED],
134  double /* ecr_frame_position */[][MAX_FRAMES][3],
135  double /* terrain_frame_position */[][MAX_FRAMES][3],
136  uint8 /* frame_flags */[][MAX_FRAMES],
137  double /* ecr_sc_frame_position */[][3],
138  int8 /* hires_offsets */[][DETECTORS_QKM][SAMPLES_QKM],
139  uint32 /* frame_quality */[][MAX_FRAMES],
140  uint8 /* frame_landsea */[][MAX_FRAMES],
141  uint8 /* frame_waterpresent */[][MAX_FRAMES]
142 );
143 
144 PGSt_SMF_status GEO_interp_ECR(
145  PGSt_double const base_time,
146  PGSt_integer const numValues,
147  const PGSt_double offsets[],
148  GEO_param_struct const *params,
149  char asciiUTC[],
150  sc_state_struct sc_state[],
151  double T_sc2ecr[][3][3],
152  double T_inst2ecr[][3][3],
153  double positionECR[][3],
154  double velocityECR[][3],
155  PGSt_double rpy[],
156  uint32 sample_quality[][2]
157 );
158 
159 PGSt_SMF_status GEO_interp_ephemeris_attitude(
160  PGSt_integer numValues,
161  char asciiUTC[],
162  PGSt_double target_time,
163  const PGSt_double offsets[],
164  GEO_param_struct const *params,
165  sc_state_struct sc_state[],
166  uint32 qualityFlags[][2],
167  PGSt_scTagInfo *scTagInfo
168 );
169 
170 void *GEO_DEMalloc(size_t);
171 
172 int GEO_close_DEM(void);
173 
174 PGSt_SMF_status GEO_ellip_position(
175  int const scan_number,
176  int const sample_number,
177  int const num_detectors,
178  double u_inst[][3],
179  double ecr_sc_sample_position[][3],
180  double ecr_sc_velocity[][3],
181  double T_inst2ecr[][3][3],
182  double ecr_sample_position[][MAX_PADDED][3],
183  double ellip_sample_position[][MAX_PADDED][3],
184  unsigned char sample_flags[][MAX_PADDED],
185  double sample_view_vec[][MAX_PADDED][3]
186 );
187 
188 PGSt_SMF_status GEO_terrain_correct(
189  int const sample_number,
190  int const num_detectors,
191  double sample_view_vec[][MAX_PADDED][3],
192  double ecr_sample_position[][MAX_PADDED][3],
193  double ellip_sample_position[][MAX_PADDED][3],
194  unsigned char sample_flags[][MAX_PADDED],
195  double terrain_sample_position[][MAX_PADDED][3]
196 );
197 
198 PGSt_SMF_status GEO_hires(
199  uint16 N_samp,
200  int padded_samples,
201  double hires_scale,
202  double terrain_sample_position[][MAX_PADDED][3],
203  double ecr_sample_position[][MAX_PADDED][3],
204  double ecr_frame_position[][MAX_FRAMES][3],
205  uint8 sample_flags[][MAX_PADDED],
206  uint8 frame_flags[][MAX_FRAMES],
207  int8 hires_offsets[][DETECTORS_QKM][SAMPLES_QKM]
208 );
209 
210 PGSt_SMF_status GEO_initialize_DEM(
211  void
212 );
213 
215  double const lat,
216  double const lon,
217  double * const h);
218 
219 int GEO_read_DEM(
220  double lat,
221  double lon,
222  int * const hgtmin,
223  int * const hgtmax);
224 
225 PGSt_SMF_status GEO_earth_location(
226  int const /* scan_number */,
227  int const /* sample_number */,
228  GEO_param_struct const * /* geo_params */,
229  double /* sample_time */,
230  l1a_data_struct * /* l1a_data */,
231  double /* ecr_sc_sample_position */ [][3],
232  double /* ecr_sc_velocity */ [][3],
233  double /* T_inst2ecr */ [][3][3],
234  unsigned char /* sample_flags */ [][MAX_PADDED],
235  double /* ecr_sample_position */ [][MAX_PADDED][3],
236  double /* terrain_sample_position */ [][MAX_PADDED][3]
237 );
238 
239 PGSt_SMF_status GEO_get_ephatt_inputs(
240  PGSt_PC_Logical file_logical,
241  PGSt_integer file_version,
242  char universal_references[][PGSd_UR_FIELD_SIZE]
243 );
244 
245 PGSt_SMF_status GEO_get_T_inst2ecr(
246  PGSt_integer numValues,
247  char asciiutc[],
248  const PGSt_double offsets[],
249  sc_state_struct const sc_state[],
250  double sol_elev_cor[][3],
251  PGSt_integer const eulerAngleOrder[],
252  double T_sc2ecr[][3][3],
253  double T_inst2ecr[][3][3],
254  double ecr_position[][3],
255  double ecr_velocity[][3],
256  PGSt_double rpy[]
257 );
258 
259 PGSt_SMF_status GEO_set_T_inst2sc(
260  const internal_coord_trans_struct * const,
261  const ECS_metadata_struct * const);
262 
263 PGSt_SMF_status GEO_solar_and_lunar_vectors(
264  PGSt_double const frame_time[],
265  frame_data_struct const * const frame_data,
266  GEO_param_struct const * const geo_params,
267  fill_values_struct const * const fill_values,
268  celestial_bodies_struct * const cb_vectors
269 );
270 
271 PGSt_SMF_status GEO_get_GRing_points(
272  GEO_GRing_struct * const GRing_points);
273 
274 int GEO_get_geoid(
275  double latitude,
276  double longitude);
277 
278 PGSt_double GEO_get_ancil_packet_time (
279  PGSt_double in_time);
280 
281 PGSt_SMF_status GEO_check_ea_headers (
282  PGSt_double in_time,
283  PGSt_scTagInfo *scTagInfo
284 );
285 #endif
PGSt_SMF_status GEO_set_T_inst2sc(const internal_coord_trans_struct *const, const ECS_metadata_struct *const)
PGSt_SMF_status GEO_get_ephatt_inputs(PGSt_PC_Logical file_logical, PGSt_integer file_version, char universal_references[][PGSd_UR_FIELD_SIZE])
PGSt_SMF_status GEO_get_T_inst2ecr(PGSt_integer numValues, char asciiutc[], const PGSt_double offsets[], sc_state_struct const sc_state[], double sol_elev_cor[][3], PGSt_integer const eulerAngleOrder[], double T_sc2ecr[][3][3], double T_inst2ecr[][3][3], double ecr_position[][3], double ecr_velocity[][3], PGSt_double rpy[])
real(single), dimension(:,:), allocatable longitude
#define MAX_FRAMES
Definition: GEO_geo.h:79
PGSt_SMF_status GEO_earth_location(int const, int const, GEO_param_struct const *, double, l1a_data_struct *, double[][3], double[][3], double[][3][3], unsigned char[][MAX_PADDED], double[][MAX_PADDED][3], double[][MAX_PADDED][3])
PGSt_SMF_status GEO_interp_ECR(PGSt_double const base_time, PGSt_integer const numValues, const PGSt_double offsets[], GEO_param_struct const *params, char asciiUTC[], sc_state_struct sc_state[], double T_sc2ecr[][3][3], double T_inst2ecr[][3][3], double positionECR[][3], double velocityECR[][3], PGSt_double rpy[], uint32 sample_quality[][2])
Definition: GEO_interp_ECR.c:4
real(single), dimension(:,:), allocatable latitude
#define MAX_PADDED
Definition: GEO_geo.h:84
float h[MODELMAX]
Definition: atrem_corl1.h:131
float * lat
PGSt_SMF_status GEO_initialize_DEM(void)
Definition: GEO_DEM.c:134
PGSt_SMF_status GEO_terrain_correct(int const sample_number, int const num_detectors, double sample_view_vec[][MAX_PADDED][3], double ecr_sample_position[][MAX_PADDED][3], double ellip_sample_position[][MAX_PADDED][3], unsigned char sample_flags[][MAX_PADDED], double terrain_sample_position[][MAX_PADDED][3])
void * GEO_DEMalloc(size_t)
Definition: GEO_DEM.c:321
int GEO_close_DEM(void)
Definition: GEO_DEM.c:1093
PGSt_SMF_status GEO_check_ea_headers(PGSt_double in_time, PGSt_scTagInfo *scTagInfo)
PGSt_SMF_status GEO_ellip_position(int const scan_number, int const sample_number, int const num_detectors, double u_inst[][3], double ecr_sc_sample_position[][3], double ecr_sc_velocity[][3], double T_inst2ecr[][3][3], double ecr_sample_position[][MAX_PADDED][3], double ellip_sample_position[][MAX_PADDED][3], unsigned char sample_flags[][MAX_PADDED], double sample_view_vec[][MAX_PADDED][3])
PGSt_SMF_status GEO_get_GRing_points(GEO_GRing_struct *const GRing_points)
int GEO_get_geoid(double latitude, double longitude)
Definition: GEO_get_geoid.c:10
PGSt_SMF_status GEO_interp_ephemeris_attitude(PGSt_integer numValues, char asciiUTC[], PGSt_double target_time, const PGSt_double offsets[], GEO_param_struct const *params, sc_state_struct sc_state[], uint32 qualityFlags[][2], PGSt_scTagInfo *scTagInfo)
PGSt_SMF_status GEO_solar_and_lunar_vectors(PGSt_double const frame_time[], frame_data_struct const *const frame_data, GEO_param_struct const *const geo_params, fill_values_struct const *const fill_values, celestial_bodies_struct *const cb_vectors)
float * lon
PGSt_SMF_status GEO_hires(uint16 N_samp, int padded_samples, double hires_scale, double terrain_sample_position[][MAX_PADDED][3], double ecr_sample_position[][MAX_PADDED][3], double ecr_frame_position[][MAX_FRAMES][3], uint8 sample_flags[][MAX_PADDED], uint8 frame_flags[][MAX_FRAMES], int8 hires_offsets[][DETECTORS_QKM][SAMPLES_QKM])
Definition: GEO_hires.c:205
#define SAMPLES_QKM
Definition: GEO_geo.h:83
PGSt_SMF_status GEO_aggregate(int32, uint16, double, unsigned char[][MAX_PADDED], double[][MAX_PADDED][3], double[][3], double[][MAX_PADDED][3], uint32[][2], uint8[][MAX_PADDED], double[][MAX_FRAMES][3], double[][MAX_FRAMES][3], uint8[][MAX_FRAMES], double[][3], int8[][DETECTORS_QKM][SAMPLES_QKM], uint32[][MAX_FRAMES], uint8[][MAX_FRAMES], uint8[][MAX_FRAMES])
int GEO_latlon2height(double const lat, double const lon, double *const h)
Definition: GEO_DEM.c:944
PGSt_double GEO_get_ancil_packet_time(PGSt_double in_time)
#define DETECTORS_QKM
Definition: GEO_geo.h:87
int GEO_read_DEM(double lat, double lon, int *const hgtmin, int *const hgtmax)
Definition: GEO_DEM.c:395