OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_output.h
Go to the documentation of this file.
1 #ifndef GEO_OUTPUT_H
2 #define GEO_OUTPUT_H
3 #include "GEO_parameters.h"
4 #include "GEO_main_func.h"
5 #include "smfio.h"
6 #include "hdfi.h"
7 #include "PGS_PC.h"
8 #include "mapi.h"
9 
10 /*
11 !C-INC*************************************************************************
12 
13 !Description: the prototypes for the output functions in the Level-1A
14  geolocation software
15 
16 !Input Parameters: N/A
17 
18 !Output Parameters: N/A
19 
20 !Revision History:
21  * $Log: GEO_output.h,v $
22  * Revision 6.6 2011/02/18 21:58:48 kuyper
23  * In order to resolve feature-request Bug 3446, changed interfaces to pass
24  * landsea mask around directly, rather than through swath_elem, and added
25  * waterpresent array.
26  * Corrected declarations of parameters that point at input data.
27  *
28  * Revision 6.5 2010/06/18 20:09:13 kuyper
29  * Changed GEO_locate_one_scan(), GEO_write_scan_metadata(), GEO_write_granule_metadata(), GEO_write_geospecific_metadata(), to return a
30  * status code.
31  * Corrected parameters that were pointers to array by removing their leading
32  * 'const' qualifiers.
33  * Helped resolve Bug 2470 by removing the relevant structure from all places
34  * where it was used.
35  * Helped resolve Bug 2472 by adding rpy and frame_quality parameters to GEO_write_one_scan() and GEO_write_scan_metadata().
36  *
37  * Revision 6.4 2009/05/27 14:30:29 xgeng
38  * Removed sc_ev_frame_state and changed frame_time's data type
39  * for GEO_write_one_scan.
40  *
41  * Revision 6.3 2009/04/28 19:56:37 kuyper
42  * Corrected two minor typos.
43  *
44  * Revision 6.2 2009/04/17 17:15:02 kuyper
45  * Removed arrays in polar coordinates from swath_elem struct, as well as gflags
46  * and hires_offsets.
47  * Changed interfaces of GEO_landsea_mask() and GEO_write_scan_data() to allow
48  * removal of those arrays.
49  *
50  * Revision 6.1 2009/03/23 19:44:15 kuyper
51  * Changed MAX_DETECTORS and MAX_SCAN_SAMPLE to DETECTORS_1KM and MAX_FRAMES.
52  * Changed "sample" to "frame".
53  * Changed pixel_flags to frame_flags.
54  * Added hires_offsets member to swath_elem_struct.
55  * Changed return type and argument list for GEO_write_one_scan().
56  * CHanged return type for GEO_create_swath() and GEO_derived_products().
57  *
58  * James Kuyper Jr. James.R.Kuyper@nasa.gov
59  *
60  * Revision 5.4 2008/09/21 18:51:33 kuyper
61  * Added sc_tag parameter to GEO_write_input_metadata().
62  *
63  * Revision 5.3 2004/10/08 19:33:13 vlin
64  * GEO_write_granule_metadata and GEO_update_L1A_metadata updated
65  *
66  * Revision 5.2 2004/08/31 19:48:33 vlin
67  * Functions GEO_write_scan_metadata, GEO_write_geospecific_metadata,
68  * GEO_update_L1A_metadata, GEO_write_one_scan, and
69  * GEO_locate_one_scan updated.
70  *
71  * Revision 5.1 2004/08/17 16:45:46 vlin
72  * GEO_initialize_product() updated.
73  *
74  * Revision 4.6 2004/08/16 21:13:39 vlin
75  * GEO_DOUBLE_FILLVALUE updated
76  *
77  * Revision 4.5 2004/04/09 22:10:26 kuyper
78  * Added FILL_INT8.
79  *
80  * Revision 4.4 2003/08/20 14:49:51 kuyper
81  * Reinstated redundant num_detectors parameter for GEO_initialize_product();
82  * the interface is frozen for now.
83  *
84  * Revision 4.3 2003/08/12 21:46:08 kuyper
85  * Added entry for GEO_write_input_metadata().
86  *
87  * Revision 4.2 2003/08/12 14:58:07 vlin
88  * function GEO_derived_products() updated.
89  *
90  * Revision 4.1 2002/12/14 18:51:11 kuyper
91  * Changed GEO_initialize_product, GEO_derived_products,
92  * GEO_update_l1a_metadata, and GEO_write_ECS_metadata to return status codes.
93  * Changed argument lists for GEO_initialize_product and GEO_derived_products.
94 
95 !Team-unique Header:
96 
97  This software is developed by the MODIS Science Data Support
98  Team for the National Aeronautics and Space Administration,
99  Goddard Space Flight Center, under contract NAS5-32373.
100 
101 
102 !END***************************************************************************
103 */
104 
105 /* Macro definitions */
106 #define GEO_DOUBLE_FILLVALUE 9.9692099683868690e+36
107 /* If char is unsigned, FILL_BYTE has the wrong value. */
108 #define FILL_INT8 ((int8)-127)
109 
110 /* Structure definitions */
111 typedef struct
112 {
115  uint8 lat_qaflag;
116  uint8 lon_qaflag;
123  uint8 land_seamask[DETECTORS_1KM*MAX_FRAMES];
124  /* EOS Land/Sea mask format */
127 
128 typedef struct {
129  char header[80];
130  float64 polar_motion[3];
132 
133 /* function prototype */
134 
135 PGSt_SMF_status GEO_initialize_product( /* Initialize file for HDF output */
136  int const /* number_of_scans */,
137  fill_values_struct const * /* fill_values */,
138  MODFILE * const /* geo_file */,
139  int32 const /* swfid */,
140  GEO_param_struct const * /* GEO_param */
141  );
142 
143 PGSt_SMF_status GEO_derived_products(
144  /* Compute derived geolocation parameters */
145  int const,
146  int const,
147  double[][MAX_FRAMES][3],
148  double[][3],
149  unsigned char[][MAX_FRAMES],
150  double[][MAX_FRAMES][3],
151  char[28],
152  PGSt_double[],
153  double[][MAX_FRAMES][2],
154  double[][MAX_FRAMES][3]
155 );
156 
157 PGSt_SMF_status GEO_get_utcpole_metadata( /* Fill in utcpole_metadata */
158  const ECS_metadata_struct *ECS_metadata,
159  utcpole_metadata_struct *utcpole_metadata
160  );
161 
162 PGSt_SMF_status GEO_get_version_metadata( /* Loading most of version_metadata*/
163  version_metadata_struct *version_metadata
164  );
165 
166 PGSt_SMF_status GEO_landsea_mask(
167  int /* num_samples */,
168  int /* num_detectors */,
169  double /* terrain_sample_position*/[][MAX_PADDED][3],
170  uint8 /* sample_flags */[][MAX_PADDED],
171  uint8 * /*land_seamask_qaflag*/,
172  uint8 /* sample_landsea */[][MAX_PADDED]
173 );
174 
175 PGSt_SMF_status GEO_locate_one_scan(
176  /* Perform geolocation for one scan */
177  GEO_param_struct const * const geo_params,
178  l1a_data_struct * const l1a_data,
179  int const scan_number,
180  qa_metadata_struct * const qa_metadata,
181  GEO_bcoord_struct * const bounding_coords,
182  MODFILE * const geo_file
183 );
184 
185 PGSt_SMF_status GEO_update_L1A_metadata(
186  MODFILE * const l1a_file,
187  GEO_GRing_struct * const GRing_points,
188  EPH_metadata_struct * const EPH_metadata,
189  GEO_bcoord_struct * const bounding_coords
190  );
191 
192 PGSt_SMF_status GEO_write_ECS_metadata(
193  MODFILE * const geo_file,
194  ECS_metadata_struct * const ECS_metadata,
195  EPH_metadata_struct * const EPH_metadata,
196  GEO_bcoord_struct * const bounding_coords,
197  GEO_GRing_struct * const GRing_points,
198  pointer_metadata_struct * const pointer_metadata,
199  qa_metadata_struct * const qa_metadata,
200  char * const sci_state,
201  char * const sci_abnorm
202  );
203 
204 PGSt_SMF_status GEO_write_one_scan(
205  /* Write data to product for one scan */
206  PGSt_double const /* frame_time */[],
207  int const /* scan_number */,
208  l1a_data_struct const * const /* l1a_data */,
209  GEO_param_struct const * const /* geo_params */,
210  double /* frame_to_sensor */[][MAX_FRAMES][3],
211  double /* frame_solar_angles */[][MAX_FRAMES][2],
212  double /* terrain_frame_position */[][MAX_FRAMES][3],
213  uint8 /* frame_flags */[][MAX_FRAMES],
214  int8 /* hires_offsets */
216  PGSt_double const /* rpy */[],
217  uint32 /* frame_quality */[][MAX_FRAMES],
218  uint8 /* frame_landsea */[][MAX_FRAMES],
219  uint8 /* frame_waterpresent */[][MAX_FRAMES],
220  uint8 /* land_seamask_qaflag */,
221  MODFILE * const /* geo_file */
222 );
223 
224 PGSt_SMF_status GEO_write_scan_data( /* Write geolocation scan data */
225  MODFILE * const /* geo_file */,
226  int const /* scan_number */,
227  swath_elem_struct const * /* swath_elem */,
228  GEO_param_struct const * /* GEO_param */,
229  double /* terrain_frame_position */[][MAX_FRAMES][3],
230  double /* frame_to_sensor */[][MAX_FRAMES][3],
231  double /* frame_solar_angles */[][MAX_FRAMES][2],
232  uint8 /* frame_flags */[][MAX_FRAMES],
233  uint8 /* frame_landsea */[][MAX_FRAMES],
234  uint8 /* frame_waterpresent */[][MAX_FRAMES],
235  int8 /* hires_offsets */
237 );
238 
239 PGSt_SMF_status GEO_write_scan_metadata( /* Write geolocation scan metadata */
240  int const scan_number,
241  l1a_data_struct const * const l1a_data,
242  celestial_bodies_struct const * const cb_vectors,
243  MODFILE * const geo_file,
244  PGSt_double const rpy[],
245  uint32 frame_quality[][MAX_FRAMES]
246 );
247 
248 PGSt_SMF_status GEO_write_granule_metadata(
249  /* Write geolocation granule metadata */
250  MODFILE * const geo_file,
251  MODFILE * const l1a_file,
252  GEO_param_struct const * const geo_parameter,
253  GEO_bcoord_struct const * const bounding_coords,
254  int const version,
255  l1a_data_struct * const l1a_data,
256  qa_metadata_struct * const qa_metadata
257 );
258 
259 int GEO_write_parameters( /* Write geolocation parameters */
260  MODFILE * const /* geo_file */,
261  GEO_param_struct const * /* parameter */
262  );
263 
264 PGSt_SMF_status GEO_write_geospecific_metadata(
265  MODFILE * const geo_file,
266  l1a_metadata_struct const * const granule_metadata,
267  int const number_of_scans,
268  GEO_param_struct const * const geo_parameter,
269  qa_metadata_struct const * const qa_metadata,
270  utcpole_metadata_struct const * const utcpole_metadata
271 );
272 
273 
275  MODFILE * const geo_file,
276  int const l1a_version,
277  PGSt_integer const param_version,
278  pointer_metadata_struct * const pointer_metadata,
279  PGSt_tag sc_tag
280  );
281 
283  double terrain_frame_position[DETECTORS_1KM][MAX_FRAMES][3],
284  uint8 frame_flags[DETECTORS_1KM][MAX_FRAMES],
285  int const num_detectors,
286  int const num_frames,
287  GEO_bcoord_struct * const bounding_coords
288 );
289 
290 PGSt_SMF_status GEO_create_swath(
291  int const number_of_scans,
292  int const num_detectors,
293  int32 const swfid
294 );
295 
296 #endif
297 
PGSt_SMF_status GEO_write_scan_data(MODFILE *const, int const, swath_elem_struct const *, GEO_param_struct const *, double[][MAX_FRAMES][3], double[][MAX_FRAMES][3], double[][MAX_FRAMES][2], uint8[][MAX_FRAMES], uint8[][MAX_FRAMES], uint8[][MAX_FRAMES], int8[3][DETECTORS_QKM][SAMPLES_QKM])
PGSt_SMF_status GEO_write_ECS_metadata(MODFILE *const geo_file, ECS_metadata_struct *const ECS_metadata, EPH_metadata_struct *const EPH_metadata, GEO_bcoord_struct *const bounding_coords, GEO_GRing_struct *const GRing_points, pointer_metadata_struct *const pointer_metadata, qa_metadata_struct *const qa_metadata, char *const sci_state, char *const sci_abnorm)
#define MAX_FRAMES
Definition: GEO_geo.h:79
uint8 sensorzenith_qaflag
Definition: GEO_output.h:119
int16_t * l1a_data
Definition: l1a_seawifs.c:84
int GEO_write_parameters(MODFILE *const, GEO_param_struct const *)
uint8 land_seamask_qaflag
Definition: GEO_output.h:125
#define MAX_PADDED
Definition: GEO_geo.h:84
PGSt_SMF_status GEO_update_L1A_metadata(MODFILE *const l1a_file, GEO_GRing_struct *const GRing_points, EPH_metadata_struct *const EPH_metadata, GEO_bcoord_struct *const bounding_coords)
uint8 solarzenith_qaflag
Definition: GEO_output.h:121
PGSt_SMF_status GEO_locate_one_scan(GEO_param_struct const *const geo_params, l1a_data_struct *const l1a_data, int const scan_number, qa_metadata_struct *const qa_metadata, GEO_bcoord_struct *const bounding_coords, MODFILE *const geo_file)
PGSt_SMF_status GEO_write_geospecific_metadata(MODFILE *const geo_file, l1a_metadata_struct const *const granule_metadata, int const number_of_scans, GEO_param_struct const *const geo_parameter, qa_metadata_struct const *const qa_metadata, utcpole_metadata_struct const *const utcpole_metadata)
PGSt_SMF_status GEO_write_scan_metadata(int const scan_number, l1a_data_struct const *const l1a_data, celestial_bodies_struct const *const cb_vectors, MODFILE *const geo_file, PGSt_double const rpy[], uint32 frame_quality[][MAX_FRAMES])
int GEO_get_bounding_coords(double terrain_frame_position[DETECTORS_1KM][MAX_FRAMES][3], uint8 frame_flags[DETECTORS_1KM][MAX_FRAMES], int const num_detectors, int const num_frames, GEO_bcoord_struct *const bounding_coords)
PGSt_SMF_status GEO_create_swath(int const number_of_scans, int const num_detectors, int32 const swfid)
PGSt_SMF_status GEO_derived_products(int const, int const, double[][MAX_FRAMES][3], double[][3], unsigned char[][MAX_FRAMES], double[][MAX_FRAMES][3], char[28], PGSt_double[], double[][MAX_FRAMES][2], double[][MAX_FRAMES][3])
#define DETECTORS_1KM
Definition: GEO_geo.h:85
PGSt_SMF_status GEO_initialize_product(int const, fill_values_struct const *, MODFILE *const, int32 const, GEO_param_struct const *)
PGSt_SMF_status GEO_write_granule_metadata(MODFILE *const geo_file, MODFILE *const l1a_file, GEO_param_struct const *const geo_parameter, GEO_bcoord_struct const *const bounding_coords, int const version, l1a_data_struct *const l1a_data, qa_metadata_struct *const qa_metadata)
PGSt_SMF_status GEO_get_utcpole_metadata(const ECS_metadata_struct *ECS_metadata, utcpole_metadata_struct *utcpole_metadata)
PGSt_SMF_status GEO_write_one_scan(PGSt_double const [], int const, l1a_data_struct const *const, GEO_param_struct const *const, double[][MAX_FRAMES][3], double[][MAX_FRAMES][2], double[][MAX_FRAMES][3], uint8[][MAX_FRAMES], int8[][DETECTORS_QKM][SAMPLES_QKM], PGSt_double const [], uint32[][MAX_FRAMES], uint8[][MAX_FRAMES], uint8[][MAX_FRAMES], uint8, MODFILE *const)
int GEO_write_input_metadata(MODFILE *const geo_file, int const l1a_version, PGSt_integer const param_version, pointer_metadata_struct *const pointer_metadata, PGSt_tag sc_tag)
uint8 sensorazimuth_qaflag
Definition: GEO_output.h:118
#define SAMPLES_QKM
Definition: GEO_geo.h:83
#define DETECTORS_QKM
Definition: GEO_geo.h:87
uint8 solarazimuth_qaflag
Definition: GEO_output.h:120
PGSt_SMF_status GEO_landsea_mask(int, int, double[][MAX_PADDED][3], uint8[][MAX_PADDED], uint8 *, uint8[][MAX_PADDED])
version
Definition: setup.py:15
PGSt_SMF_status GEO_get_version_metadata(version_metadata_struct *version_metadata)