TECA
teca_mask.h
1 #ifndef teca_mask_h
2 #define teca_mask_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_mask)
12 
13 
18 class teca_mask : public teca_algorithm
19 {
20 public:
21  TECA_ALGORITHM_STATIC_NEW(teca_mask)
22  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_mask)
23  TECA_ALGORITHM_CLASS_NAME(teca_mask)
24  ~teca_mask();
25 
26  // set the names of the arrays to apply the mask to
27  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, mask_variable)
28 
29  // Set the range identifying values to mask. Values inside
30  // this range are masked. The defaults are (-infinity, infinity].
31  TECA_ALGORITHM_PROPERTY(double, low_threshold_value)
32  TECA_ALGORITHM_PROPERTY(double, high_threshold_value)
33 
34  // Set the value used to replace input values that
35  // are inside the specified range.
36  TECA_ALGORITHM_PROPERTY(double, mask_value)
37 
38 protected:
39  teca_mask();
40 
41  std::vector<std::string> get_mask_variables(
42  const teca_metadata &request);
43 
44 private:
45  std::vector<teca_metadata> get_upstream_request(
46  unsigned int port,
47  const std::vector<teca_metadata> &input_md,
48  const teca_metadata &request) override;
49 
50  const_p_teca_dataset execute(
51  unsigned int port,
52  const std::vector<const_p_teca_dataset> &input_data,
53  const teca_metadata &request) override;
54 
55 private:
56  std::vector<std::string> mask_variables;
57  double low_threshold_value;
58  double high_threshold_value;
59  double mask_value;
60 };
61 
62 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_mask
an algorithm that masks a range of values
Definition: teca_mask.h:19
teca_algorithm
Definition: teca_algorithm.h:25