OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
common.h
Go to the documentation of this file.
1 #include <stdint.h>
2 #include <fstream>
3 #include <timeutils.h>
4 #include <netcdf>
5 #include <vector>
6 
7 #define PKTSIZE 2048 // changed from 3200, 3/10/2022, LH
8 
9 typedef struct {
10  short dtype;
11  short iagg;
12  short lines;
13 } itab;
14 
15 
16 #define SWAP_2(x) ( (((x) & 0xff) << 8) | ((unsigned short)(x) >> 8) )
17 
18 #define SWAP_4(x) ( (((x) << 24) & 0xFF000000) | \
19  (((x) << 8) & 0x00FF0000) | \
20  (((x) >> 8) & 0x0000FF00) | \
21  (((x) >> 24) & 0x000000FF) )
22 
23 int get_band_dims( uint8_t *apacket, uint16_t &ncp, uint16_t &nbb,
24  uint16_t &nrb,
25  uint16_t &nsp, uint16_t &ndc, uint16_t &nds,
26  uint16_t *btaps, uint16_t *rtaps, itab *itable);
27 
28 int get_anc_packet_time( uint8_t *apacket, int32_t &iyear, int32_t &iday,
29  double &stime);
30 
31 int read_oci_scan_packets( std::fstream *tfileStream, uint8_t *apacket,
32  uint8_t (*pbuffer)[PKTSIZE],
33  uint32_t &npkts, int32_t &spnum,
34  int32_t &ancind, std::vector<int32_t> &tlmind,
35  uint8_t &seqerr, int32_t &endfile);
36 
37 int anc_compare( uint8_t *apacket0, uint8_t *apacket);
38 
39 int read_packet( std::fstream *tfileStream, uint8_t *packet,
40  uint32_t &len, uint32_t &apid, int32_t &endfile);
41 
42 int get_swir_mode( uint8_t (*pbuffer)[PKTSIZE],
43  uint32_t npkts, uint16_t &smode);
44 
short lines
Definition: common.h:12
int get_anc_packet_time(uint8_t *apacket, int32_t &iyear, int32_t &iday, double &stime)
Definition: common.cpp:97
short dtype
Definition: common.h:10
int get_swir_mode(uint8_t(*pbuffer)[PKTSIZE], uint32_t npkts, uint16_t &smode)
Definition: common.cpp:370
int read_packet(std::fstream *tfileStream, uint8_t *packet, uint32_t &len, uint32_t &apid, int32_t &endfile)
int anc_compare(uint8_t *apacket0, uint8_t *apacket)
Definition: common.cpp:285
int read_oci_scan_packets(std::fstream *tfileStream, uint8_t *apacket, uint8_t(*pbuffer)[PKTSIZE], uint32_t &npkts, int32_t &spnum, int32_t &ancind, std::vector< int32_t > &tlmind, uint8_t &seqerr, int32_t &endfile)
Definition: common.h:9
short iagg
Definition: common.h:11
int get_band_dims(uint8_t *apacket, uint16_t &ncp, uint16_t &nbb, uint16_t &nrb, uint16_t &nsp, uint16_t &ndc, uint16_t &nds, uint16_t *btaps, uint16_t *rtaps, itab *itable)
Definition: common.cpp:17
#define PKTSIZE
Definition: common.h:7