OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_validate_derived_products.c
Go to the documentation of this file.
1 
2 #include "PGS_MODIS_35251.h"
3 #include "smfio.h"
4 #include "GEO_global_arrays.h"
5 #include "GEO_validation.h"
6 
8  int const frame,
9  int const num_detectors,
10  double const range_scale,
11  double frame_to_sensor[][MAX_FRAMES][3],
12  uint8 frame_flags[][MAX_FRAMES]
13 )
14 /*
15 !C******************************************************************************
16 !Description:
17  subroutine in validation group of the Level-1A geolocation software to
18  validate the derived products. It checks only that the slant-range to
19  the observed frame is within the range capable of being stored in a
20  2-byte unsigned integer (for output) and sets the pixel flags
21  appropriately. This routine will only be called if the zenith angle and
22  azimuth angles for the sun and spacecraft from the frame location have
23  been successfully calculated using a standard arctangent function. The
24  checks for proper angle range would never fail, therefore, and have
25  been removed (as have the flags for these errors in the output product).
26 
27 !Input Parameters:
28  frame the frame number in the scan
29  num_detectors the number of detectors in the frame
30  range_scale factor (meters/count) for scaling pixel slant-range
31  measurements for output.
32  frame_to_sensor sensor aximuth, zenith and range for each pixel
33 
34 !Output Parameters:
35  frame_flags geolocation flag for each pixel
36 
37 Returns:
38  MODIS_E_BAD_INPUT_ARG If there are invalid input arguments,
39  PGS_S_SUCCESS Otherwise.
40 
41 Externally Defined:
42  DETECTORS_1KM "GEO_geo.h"
43  INVALID_SENSOR_ANGLES "GEO_geo.h"
44  MAX_FRAMES "GEO_geo.h"
45  MAX_UINT16_VAL "GEO_geo.h"
46  MODIS_E_BAD_INPUT_ARG "PGS_MODIS_35251.h"
47  PGS_S_SUCCESS "PGS_SMF.h"
48  range_index "GEO_global_arrays.h"
49 
50 Called by:
51  GEO_locate_one_scan "GEO_output.h"
52 
53 Routines Called:
54  modsmf "smfio.h"
55 
56 !Revision History:
57  $Log: GEO_validate_derived_products.c,v $
58  Revision 6.1 2009/05/28 22:48:14 kuyper
59  Changed macro names to MAX_FRAMES, DETECTORS_1KM.
60  Changed sample_number to frame, pixel_flags to frame_flags, and replaced
61  "sample" with "frame" in all other variable names.
62  Changed frame_to_sensor into an input pointer parameter, and frame_flags
63  into an output pointer parameter. Validate both pointers as non-null.
64  Changed to return status code.
65  Changed name of loop index for improved searchability.
66  Cleaned up prolog.
67 
68  James Kuyper Jr. James.R.Kuyper@nasa.gov
69 
70  Revision 2.2 1997/11/06 21:48:50 kuyper
71  Made implicit conversions explicit.
72 
73  * Revision 2.1 1997/10/21 18:16:22 kuyper
74  * Returned from ClearCase
75  *
76  Revision /main/GEO_V2_DEV/3
77  checked out 29-Sep-97.23:29:00 by Jeffrey Blanchette (jjb.user@modis-xl)
78  by view: jjb ("modispc:/cc/cc_view/jjb.vws")
79  "Corrected defects found in code walkthrough:
80  Added range_scale parameter.
81  Added check of input parameters."
82 
83  * Revision /main/GEO_V2_DEV/2 1997/09/15 Ding
84  * Removed extraneous code lines.
85  * ding@ltpmail.gsfc.nasa.gov
86 
87  * Revision 1.6.1.1 1997/07/21 22:20:17 kuyper
88  * Merged in out-of-sequence changes.
89  *
90  * Revision 1.6 1997/07/21 16:24:34 kuyper
91  * Baselined Version 1
92  *
93  *Parallel development:
94  * Revision 1.6 1997/04/21 22:38:48 fhliang
95  * commented unused argument (LL.10-12).
96  *
97  * Revision 1.5 1997/03/26 18:15:45 fhliang
98  * Initial revision of SDST delivery of GEO_validate_derived_products.c.
99  *
100  * Revision 1.5 1997/06/02 17:21:26 kuyper
101  * Merged seed files.
102  *
103  Revision 1.4 1996/08/06 19:20:57 kuyper
104  Removed #include "PGS_CONSTS.h"
105 
106  Revision 1.3 1996/07/24 21:42:03 kuyper
107  Standardized order of #include files.
108  Declared arguments const.
109  Inserted required '!'s in comments.
110  Removed ret_val.
111  Converted constants to double, to skip implied conversion.
112 
113  Revision 1.2 1996/07/18 21:17:12 kuyper
114  Included self-checking header file.
115  Replaced extern declarations with corresponding header files.
116  Added needed header file.
117  James Kuyper Jr. <kuyper@lptmail.gsfc.nasa.gov>
118 
119 
120  5/22/95
121  Frederick S. Patt (patt@modis-xl.gsfc.nasa.gov)
122  Finished coding.
123 
124  6/20/95
125  Frederick S. Patt (patt@modis-xl.gsfc.nasa.gov)
126  Clean up code and documentation.
127 
128  7/3/95
129  Tracey W. Holmes (holmes@modis-xl.gsfc.nasa.gov)
130  Added SDP error messages.
131 
132  9/11/95
133  Tracey W. Holmes (holmes@modis-xl.gsfc.nasa.gov)
134  Increased limit value.
135 
136  10/10/95
137  Tracey W. Holmes
138  Added DEBUG option.
139 
140 
141 !Team-unique Header:
142  This software is developed by the MODIS Science Data Support
143  Team for the National Aeronautics and Space Administration,
144  Goddard Space Flight Center, under contract NAS5-32373.
145 
146 !END*************************************************************************
147 */
148 {
149  int det = 0; /* loop index */
150  char msgbuf[PGS_SMF_MAX_MSGBUF_SIZE];
151 
152  if( num_detectors<0 || num_detectors> DETECTORS_1KM || frame<0 ||
153  frame>=MAX_FRAMES || frame_to_sensor==NULL || frame_flags==NULL)
154  {
155  sprintf(msgbuf, "num_detectors = %d, frame = %d, "
156  "frame_to_sensor = %p, frame_flags = %p",
157  num_detectors, frame, (void*)frame_to_sensor, (void*)frame_flags);
158  modsmf(MODIS_E_BAD_INPUT_ARG, msgbuf,
159  "GEO_validate_derived_products, GEO_validate_derived_products.c");
160  return MODIS_E_BAD_INPUT_ARG;
161  }
162 
163  for (det = 0; det < num_detectors; det++) /* Range checking */
164  {
165  if (frame_to_sensor[det][frame][range_index] < 1.0 ||
166  frame_to_sensor[det][frame][range_index] >
167  (double)MAX_UINT16_VAL*range_scale)
168  frame_flags[det][frame] |= INVALID_SENSOR_ANGLES;
169  }
170  return PGS_S_SUCCESS;
171 }
172 
#define NULL
Definition: decode_rs.h:63
#define MODIS_E_BAD_INPUT_ARG
#define MAX_FRAMES
Definition: GEO_geo.h:79
#define MAX_UINT16_VAL
Definition: GEO_geo.h:175
const unsigned char INVALID_SENSOR_ANGLES
PGSt_SMF_status GEO_validate_derived_products(int const frame, int const num_detectors, double const range_scale, double frame_to_sensor[][MAX_FRAMES][3], uint8 frame_flags[][MAX_FRAMES])
#define DETECTORS_1KM
Definition: GEO_geo.h:85
@ range_index