TECA
The Toolkit for Extreme Climate Analysis
teca_vertical_reduction.h
1 #ifndef teca_vertical_reduction_h
2 #define teca_vertical_reduction_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 #include "teca_array_attributes.h"
8 
9 #include <string>
10 #include <vector>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_vertical_reduction)
13 
14 /// The base class for vertical reducitons.
15 /**
16  * implements common operations associated with computing a vertical
17  * reduction where a 3D dataset is transformed into a 2D dataset
18  * by a reduction along the 3rd spatial dimension.
19 */
21 {
22 public:
23  TECA_ALGORITHM_STATIC_NEW(teca_vertical_reduction)
24  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_vertical_reduction)
25  TECA_ALGORITHM_CLASS_NAME(teca_vertical_reduction)
27 
28  // report/initialize to/from Boost program options
29  // objects.
30  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
31  TECA_SET_ALGORITHM_PROPERTIES()
32 
33  /** @name dependent_variable
34  * set/get the list of variables that are needed to produce the derived
35  * quantity
36  */
37  ///@{
38  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, dependent_variable)
39  ///@}
40 
41  /** @name derived_variable
42  * set/get the name of the variable that is produced
43  */
44  ///@{
45  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, derived_variable)
46  ///@}
47 
48  /** @name derived_variable_attribute
49  * Set the attributes of the variable that is produced.
50  */
51  ///@{
52  TECA_ALGORITHM_VECTOR_PROPERTY(teca_array_attributes, derived_variable_attribute)
53  ///@}
54 
55 protected:
57 
58  teca_metadata get_output_metadata(
59  unsigned int port,
60  const std::vector<teca_metadata> &input_md) override;
61 
62  std::vector<teca_metadata> get_upstream_request(
63  unsigned int port,
64  const std::vector<teca_metadata> &input_md,
65  const teca_metadata &request) override;
66 
67  const_p_teca_dataset execute(
68  unsigned int port,
69  const std::vector<const_p_teca_dataset> &input_data,
70  const teca_metadata &request) override;
71 
72 private:
73  std::vector<std::string> dependent_variables;
74  std::vector<std::string> derived_variables;
75  std::vector<teca_array_attributes> derived_variable_attributes;
76 };
77 
78 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:18
teca_array_attributes
A convenience container for conventional array attributes necessary and/or useful when producing NetC...
Definition: teca_array_attributes.h:28
teca_shared_object.h
teca_vertical_reduction
The base class for vertical reducitons.
Definition: teca_vertical_reduction.h:20
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237