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