TECA
The Toolkit for Extreme Climate Analysis
teca_table_remove_rows.h
1 #ifndef teca_table_remove_rows_h
2 #define teca_table_remove_rows_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 
11 TECA_SHARED_OBJECT_FORWARD_DECL(teca_table_remove_rows)
12 
13 /** @brief
14  * An algorithm that removes rows from a table where
15  * a given expression evaluates to true.
16  *
17  * @details
18  * The expression parser supports the following operations:
19  * +,-,*,/,%,<.<=,>,>=,==,!=,&&,||.!,?
20  *
21  * Grouping in the expression is denoted in the usual
22  * way: ()
23  *
24  * Constants in the expression are expanded to full length
25  * arrays and can be typed. The supported types are:
26  * d,f,L,l,i,s,c
27  * Corresponding to double,float, long long, long, int,
28  * short and char respectively. Integer types can be
29  * unsigned by including u after the code.
30  */
32 {
33 public:
34  TECA_ALGORITHM_STATIC_NEW(teca_table_remove_rows)
35  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_table_remove_rows)
36  TECA_ALGORITHM_CLASS_NAME(teca_table_remove_rows)
38 
39  // report/initialize to/from Boost program options
40  // objects.
41  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
42  TECA_SET_ALGORITHM_PROPERTIES()
43 
44  /** @name mask_expression
45  * set the expression to use to determine which rows are removed. rows are
46  * removed where the expression evaluates true.
47  */
48  ///@{
49  /// Set the mask expression
50  void set_mask_expression(const std::string &expr);
51 
52  /// Get the mask expression
53  std::string get_mask_expression()
54  { return this->mask_expression; }
55  ///@}
56 
57  /** @name remove_dependent_variables
58  * when set columns used in the calculation are removed from the output.
59  * default off.
60  */
61  ///@{
62  TECA_ALGORITHM_PROPERTY(int, remove_dependent_variables)
63  ///@}
64 
65 
66 protected:
68 
69 private:
70  const_p_teca_dataset execute(unsigned int port,
71  const std::vector<const_p_teca_dataset> &input_data,
72  const teca_metadata &request) override;
73 
74 private:
75  std::string mask_expression;
76  std::string postfix_expression;
77  std::set<std::string> dependent_variables;
78  int remove_dependent_variables;
79 };
80 
81 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:18
teca_shared_object.h
teca_table_remove_rows
An algorithm that removes rows from a table where a given expression evaluates to true.
Definition: teca_table_remove_rows.h:31
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237