NASA Logo
Ocean Color Science Software

ocssw V2022
l0stream.hpp
Go to the documentation of this file.
1 
9 #ifndef _L0STREAM_OCI_
10 #define _L0STREAM_OCI_
11 
12 #include <genutils.h>
13 #include <iostream>
14 #include <fstream>
15 
16 class L0Stream {
17  public:
18  typedef struct L0File {
19  std::fstream *fileStream; // Open L0 stream
20  bool hasHeader; // `true` if `fileStream` has an OCI header, `false` otherwise
21  size_t fileSize; // Number of bytes in `fileStream`
22  size_t currPos; // Current position of read head in `fileStream`
23  size_t bytesLeft; // Amount of bytes still in this stream
24  } L0File;
25 
26  L0Stream(std::vector<std::string> &l0FileNames);
27  ~L0Stream();
28 
34  void read(char *buffer, size_t num);
35 
42  void seekg(std::streamoff num, std::ios_base::seekdir dir);
43 
48  bool fail();
49 
54  bool eof();
55 
60  int tellg();
61 
62  static void strip_oci_header(std::fstream &fileStream);
63 
70  bool hasHeader(std::fstream &fileStream);
71 
78  size_t getFileSize(std::fstream &fileStream);
79 
85  size_t getBytesLeft();
86 
92 
93  private:
94  std::vector<L0File *> l0Files;
95  size_t idxCurrStream;
96 };
97 
98 #endif // _L0STREAM_OCI_
int tellg()
Obtain the position of the read/write head from the beginning of the current filestream.
Definition: l0stream.cpp:146
size_t getFileSize(std::fstream &fileStream)
Obtain the size in bytes of fileStream. This method does not guarantee that the read/write head retur...
Definition: l0stream.cpp:71
std::fstream * fileStream
Definition: l0stream.hpp:19
size_t bytesLeft
Definition: l0stream.hpp:23
void seekg(std::streamoff num, std::ios_base::seekdir dir)
Move the read/write head a number of bytes in a particular direction, switching streams as necessary.
Definition: l0stream.cpp:115
bool fail()
Indicate if the fstream::badbit or fstream::failbit is set.
Definition: l0stream.cpp:132
A class to simulate a single stream object over multiple OCI L0 files.
Definition: l0stream.hpp:16
~L0Stream()
Definition: l0stream.cpp:36
size_t getBytesLeft()
Obtain the number of bytes between the read/write head and the end of the current stream.
Definition: l0stream.cpp:79
@ string
void read(char *buffer, size_t num)
Read from the current stream, switching streams as necessary.
Definition: l0stream.cpp:83
instead the metadata field ProcessingEnvinronment is filled in from the output of a call to the POSIX compliant function uname from within the L1B code A small bug in L1B_Tables an incorrect comparison of RVS coefficients for TEBs to RVS coefficients for RSBs was being made This was replaced with a comparison between TEB coefficients This error never resulted in an incorrect RVS correction but did lead to recalculating the coefficients for each detector in a thermal band even if the coefficients were the same for all detectors To reduce to overall size of the reflective LUT HDF fill values were eliminated from all LUTs previously dimensioned where and where NUM_TIMES is the number of time dependent table pieces In Preprocess a small error where the trailing dropped scan counter was incremented when the leading dropped scan counter should have been was fixed This counter is internal only and is not yet used for any chiefly to casting of were added to make it LINUX compatible Output of code run on LINUX machines displays differences of at most scaled sector incalculable values of the Emissive calibration factor and incalculable values of SV or BB averages was moved outside the loop over frames in Emissive_Cal c since none of these quantities are frame dependent Initialization of b1 and XMS values in Preprocess c routine Process_OBCENG_Emiss was moved inside the detector loops The code was altered so that if up to five scans are dropped between the leading middle or middle trailing the leading or trailing granule will still be used in emissive calibration to form a cross granule average QA bits and are set for a gap between the leading middle and middle trailing granules respectively This may in rare instances lead to a change in emissive calibration coefficients for scans at the beginning or end of a granule A small bug in the Band correction algorithm was corrected an uncertainty value was being checked against an upper bound whereas the proper quantity to be checked was the corresponding which is the product of the Band radiance times the ratio of the Band to Band scaling factors times the LUT correction value for that detector In addition a new LUT which allows for a frame offset with regard to the Band radiance was added A LUT which switches the correction off or on was also added Changes which do not affect scientific output of the the pixel is flagged with the newly created flag and the number of pixels for which this occurs is counted in the QA_common table The array of b1s in Preprocess c was being initialized to outside the loop over which meant that if b1 could not be the value of b1 from the previous band for that scan detector combination was used The initialization was moved inside the band loop Minor code changes were made to eliminate compiler warnings when the code is compiled in bit mode Temperature equations were upgraded to be MODIS AQUA or MODIS TERRA specific and temperature conversion coefficients for AQUA were MOD_PR02 will not cease execution if the value of this parameter is not but will print a message
Definition: HISTORY.txt:644
static void strip_oci_header(std::fstream &fileStream)
Definition: l0stream.cpp:49
L0Stream(std::vector< std::string > &l0FileNames)
Definition: l0stream.cpp:21
bool hasHeader(std::fstream &fileStream)
Strips the PACE OCI header off of fileStream if it exists, and returns whether it does so or not.
Definition: l0stream.cpp:66
bool eof()
Indicate if fstream::eof is true.
Definition: l0stream.cpp:139
void exit_unhappy(std::string message)
For use when the program has reached a bad state.
Definition: l0stream.cpp:44