NASA Logo
Ocean Color Science Software

ocssw V2022
adt Namespace Reference

Classes

struct  TestParameters
 
struct  Treenode
 
struct  VarsAtPixel
 

Typedefs

typedef void(* Traverse) (float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *)
 

Functions

void deallocate_tree (Treenode *root)
 
void tree_traversal (float *inp_treesum, int16_t *inp_flags_sst, const VarsAtPixel &vars, Treenode *node)
 
void tree_traversal (Treenode *node)
 
void readTreeTest (const rapidjson::Value &member)
 
void build_sub_tree (const rapidjson::Value &member, Treenode *node, std::set< std::string > &tests_name)
 
void build_tree (const std::string &config_path, Treenode *decision_tree, std::set< std::string > &tests_name)
 
void print_error_message_for_adt (const std::string &file_path, const std::string &key_word, const std::string &message="Undefined keyword")
 

Variables

std::string config_adt_path
 
const std::unordered_set< std::stringnon_test_keywords
 
std::map< std::string, Traversetraversal_functions
 
auto set_node_parameters
 

Detailed Description

namespace to contains the ADT data structures and functions *

Parameters
TestParameters- contains the test name, the max and min threshold, treesum increment (positive or negative). Also optional boolean var and flag, would be needed for AVHRR implementation
VarsAtPixel- value of the quantity to be "thresholded"
Treenode- ADT structure
build_sub_tree- building a subtree from rapid json object
build_tree- building a tree from a json config file

Typedef Documentation

◆ Traverse

typedef void(* Traverse) (float *, int16_t *, const TestParameters &, const VarsAtPixel &, Treenode *)

Definition at line 71 of file sst_adt.hpp.

Function Documentation

◆ build_sub_tree()

void build_sub_tree ( const rapidjson::Value &  member,
Treenode node,
std::set< std::string > &  tests_name 
)

Recursively building the tree *.

Parameters
member- rapid json subtree
node- Treenode
tests_name- store test names found in the tree

Definition at line 114 of file sst_adt.cpp.

◆ build_tree()

void build_tree ( const std::string config_path,
Treenode decision_tree,
std::set< std::string > &  tests_name 
)

Building the from a json file *.

Parameters
config_path- path to config file
decision_tree- Treenode object which is being build
tests_name- test names recorded and later to be parsed

Definition at line 198 of file sst_adt.cpp.

◆ deallocate_tree()

void deallocate_tree ( Treenode root)

Definition at line 72 of file sst_adt.cpp.

◆ print_error_message_for_adt()

void print_error_message_for_adt ( const std::string file_path,
const std::string key_word,
const std::string message = "Undefined keyword" 
)

Prints error message for unrecognized keywords in the ADT config file.

Parameters
file_path- the file path *
key_word- key word
message- message to print

Definition at line 249 of file sst_adt.cpp.

◆ readTreeTest()

void readTreeTest ( const rapidjson::Value &  member)

Definition at line 101 of file sst_adt.cpp.

◆ tree_traversal() [1/2]

void tree_traversal ( float *  inp_treesum,
int16_t *  inp_flags_sst,
const VarsAtPixel vars,
Treenode node 
)

Definition at line 81 of file sst_adt.cpp.

◆ tree_traversal() [2/2]

void tree_traversal ( Treenode node)

Definition at line 92 of file sst_adt.cpp.

Variable Documentation

◆ config_adt_path

std::string config_adt_path

Definition at line 4 of file sst_adt.cpp.

◆ non_test_keywords

const std::unordered_set<std::string> non_test_keywords
Initial value:
= {"true", "false", "thresholds", "addTreesum", "setFlags",
"decision_tree"}

Definition at line 5 of file sst_adt.cpp.

◆ set_node_parameters

auto set_node_parameters
Initial value:
= [](Treenode *node, const std::string &test_name,
const std::map<std::string, boost::variant<int16_t, float, bool>> &ranges) {
auto params = &node->set_parameters;
if (ranges.count("threshold_max") > 0)
params->max_var = boost::get<float>(ranges.at("threshold_max"));
if (ranges.count("threshold_min") > 0)
params->min_var = boost::get<float>(ranges.at("threshold_min"));
if (ranges.count("addTreesum"))
params->treesum_increment = boost::get<float>(ranges.at("addTreesum"));
if (ranges.count("setFlags"))
params->flag = boost::get<int16_t>(ranges.at("setFlags"));
if (ranges.count("incl"))
params->not_use_mask = !boost::get<bool>(ranges.at("incl"));
params->test_name = test_name;
}

Definition at line 56 of file sst_adt.cpp.

◆ traversal_functions

std::map<std::string, Traverse> traversal_functions

possible traversal functions.

Definition at line 10 of file sst_adt.cpp.

@ string