OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
instlm.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <math.h>
3 #include "instlm.h"
4 #include "swl0_proto.h"
5 
6 /* -------------------------------------------------------------- */
7 /* valid_instlm() - returns 1 if scan contains valid instrument */
8 /* telemetry. */
9 /* */
10 /* INT16 mnftype - minor frame type (0=LAC, 15=GAC) */
11 /* INT16 mnfnume - minor frame number 1,2, or 3 */
12 /* INT16 scanNum - scan number in frame (LAC=0, GAC=0,1,..,4) */
13 
14 /* -------------------------------------------------------------- */
15 INT16 valid_instlm(INT16 mnftype, INT16 mnfnum, INT16 scanNum) {
16  if (mnftype != 15)
17  if (mnfnum != 2)
18  return (1);
19  else
20  return 0;
21 
22  else
23  return ( instlm_list[mnfnum - 1][scanNum]);
24 }
25 
26 
27 /* ----------------------------------------------------------------*/
28 /* getEngQual() - sets engineering quality flags based on analog */
29 /* instrument telemetry. Returns number of values */
30 /* that exceed red limits. */
31 
32 /* ----------------------------------------------------------------*/
34  INT16 i;
35  INT16 cnt = 0;
36  INT32 *qualp = (INT32 *) eng_qual;
37 
38  uint32_t mask = 1u << 31;
39 
40  *qualp = 0;
41 
42  for (i = 0; i < 32; i++) {
43 
44  if ((ins_ana[i] < instlm_limits[i][2]) ||
45  (ins_ana[i] > instlm_limits[i][3])) {
46 
47  *qualp |= mask;
48 
49  /*
50  printf("INSTLM limit exceeded for word %d (%f %f %f)\n",
51  i,instlm_limits[i][2],ins_ana[i],instlm_limits[i][3]);
52  */
53 
54  cnt++;
55  }
56 
57  mask = mask >> 1;
58  }
59 
60  if (endianess() == 1)
61  swapc_bytes((char *) qualp, 4, 1);
62 
63  return (cnt);
64 }
65 
66 
INT16 getEngQual(FLOAT32 ins_ana[], BYTE eng_qual[])
Definition: instlm.c:33
int32_t INT32
Definition: elements.h:6
int endianess(void)
determine endianess
Definition: endianess.c:10
int swapc_bytes(char *in, int nbyte, int ntime)
Definition: swapc_bytes.c:4
unsigned char BYTE
Definition: elements.h:4
short int INT16
Definition: elements.h:5
a context in which it is NOT documented to do so subscript which cannot be easily calculated when extracting TONS attitude data from the Terra L0 files Corrected several defects in extraction of entrained ephemeris and and as HDF file for both the L1A and Geolocation enabling retrieval of South Polar DEM data Resolved Bug by changing to opent the geolocation file only after a successful read of the L1A and also by checking for fatal errors from not restoring C5 and to report how many of those high resolution values were water in the new WaterPresent SDS Added valid_range attribute to Land SeaMask Changed to bilinearly interpolate the geoid_height to remove artifacts at one degree lines Made corrections to const qualification of pointers allowed by new version of M API library Removed casts that are no longer for same not the geoid Corrected off by one error in calculation of high resolution offsets Corrected parsing of maneuver list configuration parameter Corrected to set Height SDS to fill values when geolocation when for elevation and land water mask
Definition: HISTORY.txt:114
float FLOAT32
Definition: elements.h:7
data_t u
Definition: decode_rs.h:74
int i
Definition: decode_rs.h:71
INT16 valid_instlm(INT16 mnftype, INT16 mnfnum, INT16 scanNum)
Definition: instlm.c:15