TECA
The Toolkit for Extreme Climate Analysis
teca_integrated_water_vapor.h
1 #ifndef teca_integrated_water_vapor_h
2 #define teca_integrated_water_vapor_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_water_vapor)
12 
13 /// An algorithm that computes integrated water vapor (IWV)
14 /**
15  * Compute integrated vaport transport (IWV) from the specific humidity.
16  *
17  * \f[
18  * IWV = \frac{1}{g} \int_{p_{sfc}}^{p_{top}} q dp
19  * \f]
20  *
21  * where q is the specific humidity.
22  *
23  * This calculation is an instance of a vertical reduction where
24  * a 3D mesh is transformed into a 2D one.
25  */
27 {
28 public:
29  TECA_ALGORITHM_STATIC_NEW(teca_integrated_water_vapor)
30  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_integrated_water_vapor)
31  TECA_ALGORITHM_CLASS_NAME(teca_integrated_water_vapor)
33 
34  // report/initialize to/from Boost program options
35  // objects.
36  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
37  TECA_SET_ALGORITHM_PROPERTIES()
38 
39  /** @name specific_humidity_variable
40  * set the name of the variable that contains the specific humidity ("hus")
41  */
42  ///@{
43  TECA_ALGORITHM_PROPERTY(std::string, specific_humidity_variable)
44  ///@}
45 
46  /** @name iwv_variable
47  * set the name of the varaiable that contains the integrated water vapor
48  * ("iwv").
49  */
50  ///@{
51  TECA_ALGORITHM_PROPERTY(std::string, iwv_variable)
52  ///@}
53 
54  /** @name fill_value
55  * set the _fillValue attribute for the output data. default 1.0e20
56  */
57  ///@{
58  TECA_ALGORITHM_PROPERTY(double, fill_value)
59  ///@}
60 
61 protected:
63 
64 private:
65  teca_metadata get_output_metadata(
66  unsigned int port,
67  const std::vector<teca_metadata> &input_md) override;
68 
69  std::vector<teca_metadata> get_upstream_request(
70  unsigned int port,
71  const std::vector<teca_metadata> &input_md,
72  const teca_metadata &request) override;
73 
74  const_p_teca_dataset execute(
75  unsigned int port,
76  const std::vector<const_p_teca_dataset> &input_data,
77  const teca_metadata &request) override;
78 
79 private:
80  std::string specific_humidity_variable;
81  std::string iwv_variable;
82  double fill_value;
83 };
84 
85 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:18
teca_integrated_water_vapor
An algorithm that computes integrated water vapor (IWV)
Definition: teca_integrated_water_vapor.h:26
teca_shared_object.h
teca_vertical_reduction
The base class for vertical reducitons.
Definition: teca_vertical_reduction.h:20