TECA
teca_table_calendar.h
1 #ifndef teca_table_calendar_h
2 #define teca_table_calendar_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_calendar)
12 
13 
29 {
30 public:
31  TECA_ALGORITHM_STATIC_NEW(teca_table_calendar)
32  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_table_calendar)
33  TECA_ALGORITHM_CLASS_NAME(teca_table_calendar)
35 
36  // report/initialize to/from Boost program options
37  // objects.
38  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
39  TECA_SET_ALGORITHM_PROPERTIES()
40 
41  // set the name of the column to convert. If this is
42  // not set "time" is used.
43  TECA_ALGORITHM_PROPERTY(std::string, time_column)
44 
45  // set the CF-2 base date and units. If this is not
46  // set then the units are obtained from table metadata.
47  TECA_ALGORITHM_PROPERTY(std::string, units)
48 
49  // set the CF-2 calendar. if this is not set then
50  // the calendar is obtained from the table metadata.
51  TECA_ALGORITHM_PROPERTY(std::string, calendar)
52 
53  // set the names of the output columns. The defaults are
54  // "year", "month", "day", "hour", "minute", "second"
55  // setting any of these to the empty string "", will
56  // suppress their output.
57  TECA_ALGORITHM_PROPERTY(std::string, year_column)
58  TECA_ALGORITHM_PROPERTY(std::string, month_column)
59  TECA_ALGORITHM_PROPERTY(std::string, day_column)
60  TECA_ALGORITHM_PROPERTY(std::string, hour_column)
61  TECA_ALGORITHM_PROPERTY(std::string, minute_column)
62  TECA_ALGORITHM_PROPERTY(std::string, second_column)
63 
64  // set output prefix. the prefix (optional) is prepended
65  // to the column names.
66  TECA_ALGORITHM_PROPERTY(std::string, output_column_prefix)
67 
68 protected:
70 
71 private:
72  const_p_teca_dataset execute(
73  unsigned int port,
74  const std::vector<const_p_teca_dataset> &input_data,
75  const teca_metadata &request) override;
76 
77 private:
78  std::string units;
79  std::string calendar;
80  std::string time_column;
81  std::string year_column;
82  std::string month_column;
83  std::string day_column;
84  std::string hour_column;
85  std::string minute_column;
86  std::string second_column;
87  std::string output_column_prefix;
88 };
89 
90 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_algorithm
Definition: teca_algorithm.h:25
teca_table_calendar
Definition: teca_table_calendar.h:29