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 column integrated water vapor (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  using teca_algorithm::get_output_metadata;
66 
67  teca_metadata get_output_metadata(
68  unsigned int port,
69  const std::vector<teca_metadata> &input_md) override;
70 
71  std::vector<teca_metadata> get_upstream_request(
72  unsigned int port,
73  const std::vector<teca_metadata> &input_md,
74  const teca_metadata &request) override;
75 
76  const_p_teca_dataset execute(
77  unsigned int port,
78  const std::vector<const_p_teca_dataset> &input_data,
79  const teca_metadata &request) override;
80 
81 private:
82  std::string specific_humidity_variable;
83  std::string iwv_variable;
84  double fill_value;
85 };
86 
87 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
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
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