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