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 #include "l0stream.hpp"
7 
8 #define PKTSIZE 2048 // changed from 3200 to 2048, 3/10/2022, LH
9 
10 typedef struct {
11  short dtype;
12  short iagg;
13  short lines;
14 } itab;
15 
16 #define SWAP_2(x) ((((x) & 0xff) << 8) | ((unsigned short)(x) >> 8))
17 
18 #define SWAP_4(x) \
19  ((((x) << 24) & 0xFF000000) | (((x) << 8) & 0x00FF0000) | (((x) >> 8) & 0x0000FF00) | \
20  (((x) >> 24) & 0x000000FF))
21 
22 int get_band_dims(uint8_t *apacket, uint16_t &ncp, uint16_t &nbb, uint16_t &nrb, uint16_t &nsp, uint16_t &ndc,
23  uint16_t &nds, uint16_t *btaps, uint16_t *rtaps, itab *itable);
24 
25 int get_anc_packet_time(uint8_t *apacket, int32_t &iyear, int32_t &iday, double &stime);
26 
27 int read_oci_scan_packets(L0Stream *tfileStream, uint8_t *apacket, uint8_t (*pbuffer)[PKTSIZE],
28  uint32_t &npkts, int32_t &spnum, int32_t &ancind, std::vector<int32_t> &tlmind,
29  uint8_t &seqerr, int32_t &endfile, bool isSPW);
30 
31 int anc_compare(uint8_t *apacket0, uint8_t *apacket);
32 
33 int read_packet(L0Stream *tfileStream, uint8_t *packet, uint32_t &len, uint32_t &apid, int32_t &endfile,
34  bool isSPW);
35 
36 int get_swir_mode(uint8_t (*pbuffer)[PKTSIZE], uint32_t npkts, uint16_t &smode);
short lines
Definition: common.h:13
int read_oci_scan_packets(L0Stream *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, bool isSPW)
int get_anc_packet_time(uint8_t *apacket, int32_t &iyear, int32_t &iday, double &stime)
Definition: common.cpp:104
short dtype
Definition: common.h:11
A class to simulate a single stream object over multiple OCI L0 files.
Definition: l0stream.hpp:16
int read_packet(L0Stream *tfileStream, uint8_t *packet, uint32_t &len, uint32_t &apid, int32_t &endfile, bool isSPW)
Definition: common.cpp:342
int get_swir_mode(uint8_t(*pbuffer)[PKTSIZE], uint32_t npkts, uint16_t &smode)
Definition: common.cpp:379
int anc_compare(uint8_t *apacket0, uint8_t *apacket)
Definition: common.cpp:287
Definition: common.h:10
short iagg
Definition: common.h:12
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:21
#define PKTSIZE
Definition: common.h:8