OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
GEO_abs_limit_check.c
Go to the documentation of this file.
1 /* file: GEO_abs_limit_check.c */
2 
3 #include "GEO_geo.h"
4 #include "GEO_validation.h"
5 
7  double data_samples[],
8  int const number_of_samples,
9  double data_limits[2],
10  int sample_flags[]
11  )
12 {
13 /*
14 !C*****************************************************************************
15 !Description:
16  Routine in Input group of the Level-1A geolocation
17  software to validate a set of data samples against
18  absolute limits. Flags set to BAD_DATA for all samples
19  not within limits.
20 
21 !Input Parameters:
22  double data_samples[] - array of input data samples
23  int number_of_samples - number of samples to check
24  double data_limits[2] - lower and upper limits
25 
26 !Output Parameters:
27  int sample_flags[] - array of validation flags
28 
29 Return parameter:
30  int err_stat - error status
31 
32 Global variables:
33  None
34 
35 Call functions:
36  None
37 
38 !Revision History:
39 $Log: GEO_abs_limit_check.c,v $
40 Revision 1.6 1997/07/21 16:24:34 kuyper
41 Baselined Version 1
42 
43  * Revision 1.6 1997/03/26 17:33:13 fhliang
44  * Initial revision of SDST delivery of GEO_abs_limit_check.c.
45  *
46 Revision 1.5 1996/07/29 14:45:51 kuyper
47 Used BAD_DATA for flags, rather than FAIL (same value).
48 
49  * Revision 1.4 1996/07/24 20:53:10 kuyper
50  * Declared number_of_samples const.
51  *
52 Revision 1.3 1996/07/23 22:21:52 kuyper
53 Inserted required '!' in comments.
54 
55 Revision 1.2 1996/07/18 15:28:46 kuyper
56 Added self-checking include file.
57 
58  6/14/95
59  Frederick S. Patt (patt@modis-xl.gsfc.nasa.gov)
60  Finished coding.
61 
62 !Team-unique Header:
63  This software is developed by the MODIS Science Data Support
64  Team for the National Aeronautics and Space Administration,
65  Goddard Space Flight Center, under contract NAS5-32373.
66 
67 !END*************************************************************************
68 */
69 
70  /* Local variable declarations */
71 
72  int num_valid = 0; /* number of valid data samples found */
73  int i = 0; /* loop index */
74 
75  /* Begin program logic */
76  /* Loop through samples */
77  for (i = 0; i < number_of_samples; i++) {
78 
79  /* Check samples against limits */
80  if ((data_samples[i] < data_limits[0]) ||
81  (data_samples[i] > data_limits[1])) {
82 
83  sample_flags[i] = BAD_DATA;
84  }
85  else {
86  num_valid += 1;
87  }
88  }
89 
90  /* If no valid samples, return FAIL */
91  if (num_valid == 0)
92  return FAIL;
93 
94  return SUCCESS;
95 }
int GEO_abs_limit_check(double data_samples[], int const number_of_samples, double data_limits[2], int sample_flags[])
#define SUCCESS
Definition: ObpgReadGrid.h:15
#define FAIL
Definition: ObpgReadGrid.h:18
const int BAD_DATA
int i
Definition: decode_rs.h:71