TECA
The Toolkit for Extreme Climate Analysis
teca_integrated_vapor_transport.h
1 #ifndef teca_integrated_vapor_transport_h
2 #define teca_integrated_vapor_transport_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_vertical_reduction.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 
11 TECA_SHARED_OBJECT_FORWARD_DECL(teca_integrated_vapor_transport)
12 
13 /// An algorithm that computes integrated vapor transport (IVT)
14 /**
15  * Compute integrated vapor transport (IVT) from wind vector and
16  * specific humidity.
17  *
18  * \f[
19  * IVT = \frac{1}{g} \int_{p_{sfc}}^{p_{top}} \vec{v} q dp
20  * \f]
21  *
22  * where q is the specific humidity, and \f$\vec{v} = (u, v)\f$ are the
23  * longitudinal and latitudinal components of wind.
24  *
25  * This calculation is an instance of a vertical reduction where
26  * a 3D mesh is transformed into a 2D one.
27  */
29 {
30 public:
31  TECA_ALGORITHM_STATIC_NEW(teca_integrated_vapor_transport)
32  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_integrated_vapor_transport)
33  TECA_ALGORITHM_CLASS_NAME(teca_integrated_vapor_transport)
35 
36  /** @name program_options
37  * report/initialize to/from Boost program options objects.
38  */
39  ///@{
40  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
41  TECA_SET_ALGORITHM_PROPERTIES()
42  ///@}
43 
44  /** @name wind_u_variable
45  * set the name of the varaiable that contains the longitudinal component
46  * of the wind vector ("ua")
47  */
48  ///@{
49  TECA_ALGORITHM_PROPERTY(std::string, wind_u_variable)
50  ///@}
51 
52  /** @name wind_v_variable
53  * set the name of the varaiable that contains the latitudinal component of
54  * the wind vector ("va")
55  */
56  ///@{
57  TECA_ALGORITHM_PROPERTY(std::string, wind_v_variable)
58  ///@}
59 
60  /** @name specific_humidity_variable
61  * set the name of the variable that contains the specific humidity ("hus")
62  */
63  ///@{
64  TECA_ALGORITHM_PROPERTY(std::string, specific_humidity_variable)
65  ///@}
66 
67  /** @name ivt_u_variable
68  * set the name of the varaiable that contains the longitudinal component
69  * of the ivt vector ("ivt_u")
70  */
71  ///@{
72  TECA_ALGORITHM_PROPERTY(std::string, ivt_u_variable)
73  ///@}
74 
75  /** @name ivt_v_variable
76  * set the name of the varaiable that contains the latitudinal component of
77  * the ivt vector ("ivt_v")
78  */
79  ///@{
80  TECA_ALGORITHM_PROPERTY(std::string, ivt_v_variable)
81  ///@}
82 
83  /** @name fill_value
84  * set the _fillValue attribute for the output data. default 1.0e20
85  */
86  ///@{
87  TECA_ALGORITHM_PROPERTY(double, fill_value)
88  ///@}
89 
90 protected:
92 
93 private:
94  teca_metadata get_output_metadata(
95  unsigned int port,
96  const std::vector<teca_metadata> &input_md) override;
97 
98  std::vector<teca_metadata> get_upstream_request(
99  unsigned int port,
100  const std::vector<teca_metadata> &input_md,
101  const teca_metadata &request) override;
102 
103  const_p_teca_dataset execute(
104  unsigned int port,
105  const std::vector<const_p_teca_dataset> &input_data,
106  const teca_metadata &request) override;
107 
108 private:
109  std::string wind_u_variable;
110  std::string wind_v_variable;
111  std::string specific_humidity_variable;
112  std::string ivt_u_variable;
113  std::string ivt_v_variable;
114  double fill_value;
115 };
116 
117 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:18
teca_integrated_vapor_transport
An algorithm that computes integrated vapor transport (IVT)
Definition: teca_integrated_vapor_transport.h:28
teca_shared_object.h
teca_vertical_reduction
The base class for vertical reducitons.
Definition: teca_vertical_reduction.h:20