TECA
The Toolkit for Extreme Climate Analysis
teca_apply_tempest_remap.h
1 #ifndef teca_apply_tempest_remap_h
2 #define teca_apply_tempest_remap_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_apply_tempest_remap)
12 
13 /**
14  * @brief Moves data from one mesh to anotehr using remapping weights
15  * generated by TempestRemap
16  *
17  * @details The algorithm has 3 inputs:
18  *
19  * 1) the source mesh, src
20  * 2) the target mesh, tgt
21  * 3) the matrix of weights, S, row indices, ri, column indices ci
22  *
23  * @code{.py)
24  * for i in 0,len(S):
25  * tgt[row[i]] = tgt[ri[i]] + S[i] * src[ci[i]]
26  * @endcode
27  */
29 {
30 public:
31  TECA_ALGORITHM_STATIC_NEW(teca_apply_tempest_remap)
32  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_apply_tempest_remap)
33  TECA_ALGORITHM_CLASS_NAME(teca_apply_tempest_remap)
35 
36  // report/initialize to/from Boost program options
37  // objects.
38  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
39  TECA_SET_ALGORITHM_PROPERTIES()
40 
41  /** @name weights_variable
42  * Set the name of the variable containing the remap weights
43  */
44  ///@{
45  TECA_ALGORITHM_PROPERTY(std::string, weights_variable)
46  ///@}
47 
48  /** @name row_variable
49  * Set the name of the variable containing the row indices
50  */
51  ///@{
52  TECA_ALGORITHM_PROPERTY(std::string, row_variable)
53  ///@}
54 
55  /** @name column_variable
56  * Set the name of the variable containing the column indices
57  */
58  ///@{
59  TECA_ALGORITHM_PROPERTY(std::string, column_variable)
60  ///@}
61 
62  /** @name target_mask_variable
63  * Set the name of the variable containing a valid value mask telling which
64  * indices in the target are valid. This is used on GOES data where some
65  * mesh points are invalid. When supplied the result of the remap operation
66  * is coppied in order to the valid locations skipping over mesh locations
67  * marked as invalid.
68  */
69  ///@{
70  TECA_ALGORITHM_PROPERTY(std::string, target_mask_variable)
71  ///@}
72 
73  /** @name static_target_mesh
74  * Force requesting time step 0 of the target mesh.
75  */
76  ///@{
77  TECA_ALGORITHM_PROPERTY(int, static_target_mesh)
78  ///@}
79 
80 protected:
82 
83 private:
85 
86  teca_metadata get_output_metadata(unsigned int port,
87  const std::vector<teca_metadata> &input_md) override;
88 
89  std::vector<teca_metadata> get_upstream_request(
90  unsigned int port, const std::vector<teca_metadata> &input_md,
91  const teca_metadata &request) override;
92 
93  const_p_teca_dataset execute(
94  unsigned int port, const std::vector<const_p_teca_dataset> &input_data,
95  const teca_metadata &request) override;
96 private:
97  std::string weights_variable;
98  std::string row_variable;
99  std::string column_variable;
100  std::string target_mask_variable;
101  int static_target_mesh;
102 };
103 
104 #endif
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:244
virtual teca_metadata get_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md)
Moves data from one mesh to anotehr using remapping weights generated by TempestRemap.
Definition: teca_apply_tempest_remap.h:29
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:22
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.