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  using teca_algorithm::get_output_metadata;
59 
60  teca_metadata get_output_metadata(
61  unsigned int port,
62  const std::vector<teca_metadata> &input_md) override;
63 
64  std::vector<teca_metadata> get_upstream_request(
65  unsigned int port,
66  const std::vector<teca_metadata> &input_md,
67  const teca_metadata &request) override;
68 
69  const_p_teca_dataset execute(
70  unsigned int port,
71  const std::vector<const_p_teca_dataset> &input_data,
72  const teca_metadata &request) override;
73 
74 private:
75  std::vector<std::string> dependent_variables;
76  std::vector<std::string> derived_variables;
77  std::vector<teca_array_attributes> derived_variable_attributes;
78 };
79 
80 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_array_attributes
A convenience container for conventional array attributes necessary and/or useful when producing NetC...
Definition: teca_array_attributes.h:29
teca_shared_object.h
teca_vertical_reduction
The base class for vertical reducitons.
Definition: teca_vertical_reduction.h:20
teca_error::TECA_EXPORT
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237