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 \f$q\f$ 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  *
26  * This algorithm handles missing values.
27  */
29 {
30 public:
31  TECA_ALGORITHM_STATIC_NEW(teca_integrated_water_vapor)
32  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_integrated_water_vapor)
33  TECA_ALGORITHM_CLASS_NAME(teca_integrated_water_vapor)
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 specific_humidity_variable
42  * set the name of the variable that contains the specific humidity ("hus")
43  */
44  ///@{
45  TECA_ALGORITHM_PROPERTY(std::string, specific_humidity_variable)
46  ///@}
47 
48  /** @name iwv_variable
49  * set the name of the varaiable that contains the integrated water vapor
50  * ("iwv").
51  */
52  ///@{
53  TECA_ALGORITHM_PROPERTY(std::string, iwv_variable)
54  ///@}
55 
56  /** @name fill_value
57  * set the _fillValue attribute for the output data. default 1.0e20
58  */
59  ///@{
60  TECA_ALGORITHM_PROPERTY(double, fill_value)
61  ///@}
62 
63 protected:
65 
66 private:
67  using teca_algorithm::get_output_metadata;
68 
69  teca_metadata get_output_metadata(
70  unsigned int port,
71  const std::vector<teca_metadata> &input_md) override;
72 
73  std::vector<teca_metadata> get_upstream_request(
74  unsigned int port,
75  const std::vector<teca_metadata> &input_md,
76  const teca_metadata &request) override;
77 
78  const_p_teca_dataset execute(
79  unsigned int port,
80  const std::vector<const_p_teca_dataset> &input_data,
81  const teca_metadata &request) override;
82 
83 private:
84  std::string specific_humidity_variable;
85  std::string iwv_variable;
86  double fill_value;
87 };
88 
89 #endif
The interface to TECA pipeline architecture.
Definition: teca_algorithm.h:244
An algorithm that computes integrated water vapor (IWV)
Definition: teca_integrated_water_vapor.h:29
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:22
The base class for vertical reducitons.
Definition: teca_vertical_reduction.h:21
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.