TECA
The Toolkit for Extreme Climate Analysis
teca_rename_variables.h
1 #ifndef teca_rename_variables_h
2 #define teca_rename_variables_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_rename_variables)
12 
13 /// An algorithm that renames variables.
15 {
16 public:
17  TECA_ALGORITHM_STATIC_NEW(teca_rename_variables)
18  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_rename_variables)
19  TECA_ALGORITHM_CLASS_NAME(teca_rename_variables)
21 
22  // report/initialize to/from Boost program options
23  // objects.
24  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
25  TECA_SET_ALGORITHM_PROPERTIES()
26 
27  /** @name original_variable_names
28  * Set the list of variables to rename. For each variable to rename a new
29  * name must be specified at the same index in the new_variable_names
30  * list. The two lists must be the same length.
31  */
32  ///@{
33  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, original_variable_name)
34  ///@}
35 
36  /** @name new_variable_names
37  * Set the names of the renamed variables. The new names are applied to the
38  * list of variables to rename in the same order and the two lists must be
39  * the same length.
40  */
41  ///@{
42  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, new_variable_name)
43  ///@}
44 
45 protected:
47 
48 private:
49  teca_metadata get_output_metadata(
50  unsigned int port,
51  const std::vector<teca_metadata> &input_md) override;
52 
53  std::vector<teca_metadata> get_upstream_request(
54  unsigned int port,
55  const std::vector<teca_metadata> &input_md,
56  const teca_metadata &request) override;
57 
58  const_p_teca_dataset execute(
59  unsigned int port,
60  const std::vector<const_p_teca_dataset> &input_data,
61  const teca_metadata &request) override;
62 
63 private:
64  std::vector<std::string> original_variable_names;
65  std::vector<std::string> new_variable_names;
66 };
67 
68 #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_rename_variables
An algorithm that renames variables.
Definition: teca_rename_variables.h:14
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237