TECA
The Toolkit for Extreme Climate Analysis
teca_shape_file_mask.h
1 #ifndef teca_shape_file_mask_h
2 #define teca_shape_file_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_shape_file_mask)
12 
13 /// Generates a valid value mask defined by regions in the given ESRI shape file
14 /** This algorithm is a source and has no inputs. A
15  */
17 {
18 public:
19  TECA_ALGORITHM_STATIC_NEW(teca_shape_file_mask)
20  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_shape_file_mask)
21  TECA_ALGORITHM_CLASS_NAME(teca_shape_file_mask)
23 
24  // report/initialize to/from Boost program options
25  // objects.
26  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
27  TECA_SET_ALGORITHM_PROPERTIES()
28 
29  /** @name shape_file
30  * Set the path to the shape file. This file is read by MPI rank 0 and
31  * distributed to the others in parallel runs
32  */
33  ///@{
34  TECA_ALGORITHM_PROPERTY(std::string, shape_file)
35  ///@}
36 
37  /** @name mask_variables
38  * set the names of the variables to store the generated mask in
39  * each variable will contain a reference to the mask
40  */
41  ///@{
42  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, mask_variable)
43  ///@}
44 
45 
46 protected:
48 
49  /// overriden so that cached data is cleared
50  void set_modified() override;
51 
52  /// generate attributes for the output arrays
53  teca_metadata get_mask_array_attributes(unsigned long size);
54 
55 private:
56  teca_metadata get_output_metadata(
57  unsigned int port,
58  const std::vector<teca_metadata> &input_md) override;
59 
60  std::vector<teca_metadata> get_upstream_request(
61  unsigned int port,
62  const std::vector<teca_metadata> &input_md,
63  const teca_metadata &request) override;
64 
65  const_p_teca_dataset execute(
66  unsigned int port,
67  const std::vector<const_p_teca_dataset> &input_data,
68  const teca_metadata &request) override;
69 
70 private:
71  std::string shape_file;
72  std::vector<std::string> mask_variables;
73 
74  struct internals_t;
75  internals_t *internals;
76 };
77 
78 #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_algorithm
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:237
teca_shape_file_mask
Generates a valid value mask defined by regions in the given ESRI shape file.
Definition: teca_shape_file_mask.h:16