TECA
The Toolkit for Extreme Climate Analysis
teca_simple_moving_average.h
1 #ifndef teca_simple_moving_average_h
2 #define teca_simple_moving_average_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_simple_moving_average)
12 
13 /// an algorithm that averages data in time
14 /**
15 an algorithm that averages data in time. filter_width
16 controls the number of time steps to average over.
17 all arrays in the input data are processed.
18 */
20 {
21 public:
22  TECA_ALGORITHM_STATIC_NEW(teca_simple_moving_average)
23  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_simple_moving_average)
24  TECA_ALGORITHM_CLASS_NAME(teca_simple_moving_average)
26 
27  // report/initialize to/from Boost program options
28  // objects.
29  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
30  TECA_SET_ALGORITHM_PROPERTIES()
31 
32  /** @name filter_width
33  * set the number of steps to average. should be odd.
34  */
35  ///@{
36  TECA_ALGORITHM_PROPERTY(unsigned int, filter_width)
37  ///@}
38 
39 
40  /** @name filter_type
41  * select the filter stencil, default is backward
42  */
43  ///@{
44  enum {
45  backward,
46  centered,
47  forward
48  };
49  TECA_ALGORITHM_PROPERTY(int, filter_type)
50  ///@}
51 
52 protected:
54 
55 private:
56  std::vector<teca_metadata> get_upstream_request(
57  unsigned int port,
58  const std::vector<teca_metadata> &input_md,
59  const teca_metadata &request) override;
60 
61  const_p_teca_dataset execute(
62  unsigned int port,
63  const std::vector<const_p_teca_dataset> &input_data,
64  const teca_metadata &request) override;
65 
66 private:
67  unsigned int filter_width;
68  int filter_type;
69 };
70 
71 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_simple_moving_average
an algorithm that averages data in time
Definition: teca_simple_moving_average.h:19
teca_shared_object.h
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