TECA
The Toolkit for Extreme Climate Analysis
teca_mask.h
Go to the documentation of this file.
1 #ifndef teca_mask_h
2 #define teca_mask_h
3 
4 /// @file
5 
6 #include "teca_shared_object.h"
7 #include "teca_algorithm.h"
8 #include "teca_metadata.h"
9 
10 #include <string>
11 #include <vector>
12 
13 TECA_SHARED_OBJECT_FORWARD_DECL(teca_mask)
14 
15 /// an algorithm that masks a range of values
16 /** An algorithm to mask a range of values in an array. Values
17  * in the range are replaced with the mask value.
18 */
19 class teca_mask : public teca_algorithm
20 {
21 public:
22  TECA_ALGORITHM_STATIC_NEW(teca_mask)
23  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_mask)
24  TECA_ALGORITHM_CLASS_NAME(teca_mask)
25  ~teca_mask();
26 
27  // set the names of the arrays to apply the mask to
28  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, mask_variable)
29 
30  // Set the range identifying values to mask. Values inside
31  // this range are masked. The defaults are (-infinity, infinity].
32  TECA_ALGORITHM_PROPERTY(double, low_threshold_value)
33  TECA_ALGORITHM_PROPERTY(double, high_threshold_value)
34 
35  // Set the value used to replace input values that
36  // are inside the specified range.
37  TECA_ALGORITHM_PROPERTY(double, mask_value)
38 
39 protected:
40  teca_mask();
41 
42  std::vector<std::string> get_mask_variables(
43  const teca_metadata &request);
44 
45 private:
46  std::vector<teca_metadata> get_upstream_request(
47  unsigned int port,
48  const std::vector<teca_metadata> &input_md,
49  const teca_metadata &request) override;
50 
51  const_p_teca_dataset execute(
52  unsigned int port,
53  const std::vector<const_p_teca_dataset> &input_data,
54  const teca_metadata &request) override;
55 
56 private:
57  std::vector<std::string> mask_variables;
58  double low_threshold_value;
59  double high_threshold_value;
60  double mask_value;
61 };
62 
63 #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_mask
an algorithm that masks a range of values
Definition: teca_mask.h:19
teca_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237