NASA Logo
Ocean Color Science Software

ocssw V2022
sst_adt.hpp
Go to the documentation of this file.
1 #ifndef SST_ADT_HPP
2 #define SST_ADT_HPP
3 
4 #include "boost/date_time/posix_time/posix_time.hpp"
5 #include "boost/date_time/gregorian/gregorian.hpp"
6 #include <boost/algorithm/string.hpp>
7 #include <boost/unordered_map.hpp>
8 #include <algorithm>
9 #include <fstream>
10 #include <cstdlib>
11 #include <rapidjson/document.h>
12 #include <rapidjson/istreamwrapper.h>
13 #include <rapidjson/writer.h>
14 #include <rapidjson/stringbuffer.h>
15 #include <rapidjson/ostreamwrapper.h>
16 #include <boost/variant.hpp>
17 #include <string>
18 #include <utility>
19 #include <vector>
20 #include <iostream>
21 #include <unordered_set>
22 #include <chrono>
23 #include <unordered_map>
24 #include <memory>
25 #include <set>
34 namespace adt {
35 
36  struct TestParameters {
38  float min_var, max_var;
39  bool not_use_mask = true;
41  int16_t flag;
42  };
43  struct VarsAtPixel {
44  std::unordered_map<std::string, float> vars;
45  std::unordered_map<std::string, bool> masks;
46  size_t i_p;
47  size_t i_scan;
48  };
49 
57  struct Treenode {
58  std::vector<std::pair<Treenode *, bool>> children;
59 
60  void (*traverse_ptr)(float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *);
61 
63 
64  void traverse(float *inp_treesum, int16_t *inp_flags_sst, const VarsAtPixel &vars) {
65  traverse_ptr(inp_treesum, inp_flags_sst, set_parameters, vars, this);
66  }
67  };
68 
69  void deallocate_tree(Treenode *root);
70 
71  typedef void (*Traverse)(float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *);
72 
73  void tree_traversal(float *inp_treesum, int16_t *inp_flags_sst, const VarsAtPixel &vars, Treenode *node);
74 
75  // resetting the tree to default. By default, of all the children are traversable.
77 
78  void readTreeTest(const rapidjson::Value &member);
79 
86  void build_sub_tree(const rapidjson::Value &member, Treenode *node, std::set<std::string> &tests_name);
87 
94  void build_tree(const std::string &config_path, Treenode *decision_tree, std::set<std::string> &tests_name);
95 
103  void print_error_message_for_adt(const std::string &file_path, const std::string &key_word,
104  const std::string &message = "Undefined keyword");
105 }
106 #endif
void(* Traverse)(float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *)
Definition: sst_adt.hpp:71
data_t root[NROOTS]
Definition: decode_rs.h:78
void build_sub_tree(const rapidjson::Value &member, Treenode *node, std::set< std::string > &tests_name)
Recursively building the tree *.
Definition: sst_adt.cpp:114
namespace to contains the ADT data structures and functions *
Definition: sst_adt.cpp:3
std::unordered_map< std::string, float > vars
Definition: sst_adt.hpp:44
void(* traverse_ptr)(float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *)
Definition: sst_adt.hpp:60
@ string
std::string test_name
Definition: sst_adt.hpp:37
void tree_traversal(float *inp_treesum, int16_t *inp_flags_sst, const VarsAtPixel &vars, Treenode *node)
Definition: sst_adt.cpp:81
void print_error_message_for_adt(const std::string &file_path, const std::string &key_word, const std::string &message)
Prints error message for unrecognized keywords in the ADT config file.
Definition: sst_adt.cpp:249
void build_tree(const std::string &config_path, Treenode *decision_tree, std::set< std::string > &tests_name)
Building the from a json file *.
Definition: sst_adt.cpp:198
void traverse(float *inp_treesum, int16_t *inp_flags_sst, const VarsAtPixel &vars)
Definition: sst_adt.hpp:64
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
void deallocate_tree(Treenode *root)
Definition: sst_adt.cpp:72
float treesum_increment
Definition: sst_adt.hpp:40
The decision tree.
Definition: sst_adt.hpp:57
void readTreeTest(const rapidjson::Value &member)
Definition: sst_adt.cpp:101
TestParameters set_parameters
Definition: sst_adt.hpp:62
std::unordered_map< std::string, bool > masks
Definition: sst_adt.hpp:45
std::vector< std::pair< Treenode *, bool > > children
Definition: sst_adt.hpp:58