TECA
teca_tc_wind_radii.h
1 #ifndef teca_tc_wind_radii_h
2 #define teca_tc_wind_radii_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 
11 TECA_SHARED_OBJECT_FORWARD_DECL(teca_tc_wind_radii)
12 
13 
26 {
27 public:
28  TECA_ALGORITHM_STATIC_NEW(teca_tc_wind_radii)
29  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_tc_wind_radii)
30  TECA_ALGORITHM_CLASS_NAME(teca_tc_wind_radii)
32 
33  // report/initialize to/from Boost program options
34  // objects.
35  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
36  TECA_SET_ALGORITHM_PROPERTIES()
37 
38  // set the name of the column that defines the track ids
39  // if set the specified column is coppied into the output
40  // metadata and accessed with the key event_id
41  TECA_ALGORITHM_PROPERTY(std::string, storm_id_column)
42 
43  // set the name of the columns that define the event position
44  // if set the columns are coppied into the output metadata
45  // and accessed with the keys storm_x_coordinate, storm_y_coordinate
46  TECA_ALGORITHM_PROPERTY(std::string, storm_x_coordinate_column)
47  TECA_ALGORITHM_PROPERTY(std::string, storm_y_coordinate_column)
48 
49  // set the name of the column containing peak instantanious
50  // surface wind speed
51  TECA_ALGORITHM_PROPERTY(std::string, storm_wind_speed_column)
52 
53  // set the name of the column that defines the event time
54  // if set the specified column is coppied into the output
55  // metadata and accessed with the key event_time
56  TECA_ALGORITHM_PROPERTY(std::string, storm_time_column)
57 
58  // set the name of the wind variable components
59  TECA_ALGORITHM_PROPERTY(std::string, wind_u_variable)
60  TECA_ALGORITHM_PROPERTY(std::string, wind_v_variable)
61 
62  // set the radius in degrees of latitude to sample the wind
63  // field
64  TECA_ALGORITHM_PROPERTY(double, search_radius)
65 
66  // set the radius in degrees of latitude beyond which to
67  // terminate the search for peak wind speed. if the peak
68  // lies beyond this distance search is terminated and a
69  // warning is displayed.
70  TECA_ALGORITHM_PROPERTY(double, core_radius)
71 
72  // number of bins to discetize by in the radial direction
73  TECA_ALGORITHM_PROPERTY(int, number_of_radial_bins)
74 
75  // set the wind speeds (in m/s) to find the radius of. the
76  // defualt values are the transition speeds of the Saffir-Simpson
77  // scale.
78  TECA_ALGORITHM_VECTOR_PROPERTY(double, critical_wind_speed)
79 
80  // set the profile type. PROFILE_MAX uses the maximum
81  // wind speed on each interval of the discretization, while
82  // PROFILE_AVERAGE uses the average on each interval
83  enum {PROFILE_MAX = 0, PROFILE_AVERAGE = 1};
84  TECA_ALGORITHM_PROPERTY(int, profile_type);
85 
86 
87  // override the input connections because we are going to
88  // take the first input and use it to generate metadata.
89  // the second input then becomes the only one the pipeline
90  // knows about.
91  void set_input_connection(unsigned int id,
92  const teca_algorithm_output_port &port) override;
93 
94 protected:
96 
97 private:
98  teca_metadata get_output_metadata(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, const std::vector<teca_metadata> &input_md,
103  const teca_metadata &request) override;
104 
105  const_p_teca_dataset execute(unsigned int port,
106  const std::vector<const_p_teca_dataset> &input_data,
107  const teca_metadata &request) override;
108 
109  void set_modified() override;
110 
111 private:
112  // for the metadata input
113  std::string storm_id_column;
114  std::string storm_x_coordinate_column;
115  std::string storm_y_coordinate_column;
116  std::string storm_wind_speed_column;
117  std::string storm_time_column;
118 
119  // for netcdf cf data input
120  std::string wind_u_variable;
121  std::string wind_v_variable;
122 
123  std::vector<double> critical_wind_speeds;
124  double search_radius;
125  double core_radius;
126  int number_of_radial_bins;
127  int profile_type;
128 
129  class internals_t;
130  internals_t *internals;
131 };
132 
133 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_tc_wind_radii::internals_t
Definition: teca_tc_wind_radii.cxx:33
teca_tc_wind_radii
computes wind radius at the specified coordinates
Definition: teca_tc_wind_radii.h:26
teca_algorithm
Definition: teca_algorithm.h:25