TECA
teca_ar_detect.h
1 #ifndef teca_ar_detect_h
2 #define teca_ar_detect_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_ar_detect)
12 
13 
25 {
26 public:
27  TECA_ALGORITHM_STATIC_NEW(teca_ar_detect)
28  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_ar_detect)
29  TECA_ALGORITHM_CLASS_NAME(teca_ar_detect)
30  ~teca_ar_detect();
31 
32  // report/initialize to/from Boost program options
33  // objects.
34  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
35  TECA_SET_ALGORITHM_PROPERTIES()
36 
37  // set/get the name of the integrated water vapor variable
38  TECA_ALGORITHM_PROPERTY(std::string, water_vapor_variable)
39 
40  // set/get threshold on water vapor variable used
41  // to segment the data
42  TECA_ALGORITHM_PROPERTY(double, low_water_vapor_threshold)
43  TECA_ALGORITHM_PROPERTY(double, high_water_vapor_threshold)
44 
45  // set/get the region of interest in lat lon coordinate system
46  // defaults are 19 56 180 250
47  TECA_ALGORITHM_PROPERTY(double, search_lat_low)
48  TECA_ALGORITHM_PROPERTY(double, search_lon_low)
49  TECA_ALGORITHM_PROPERTY(double, search_lat_high)
50  TECA_ALGORITHM_PROPERTY(double, search_lon_high)
51 
52  // set/get the river source region in lat lon coordinate system
53  // defaults are 18 180
54  TECA_ALGORITHM_PROPERTY(double, river_start_lat_low)
55  TECA_ALGORITHM_PROPERTY(double, river_start_lon_low)
56 
57  // set/get the river ladfall region in lat lon coordinate system
58  // defaults are 29 233 56 238
59  TECA_ALGORITHM_PROPERTY(double, river_end_lat_low)
60  TECA_ALGORITHM_PROPERTY(double, river_end_lon_low)
61  TECA_ALGORITHM_PROPERTY(double, river_end_lat_high)
62  TECA_ALGORITHM_PROPERTY(double, river_end_lon_high)
63 
64  // set/get the area as a percent of the search space that
65  // a potential river must occupy
66  TECA_ALGORITHM_PROPERTY(double, percent_in_mesh)
67 
68  // set/get the minimum river width and length. defaults
69  // are 1250 2000
70  TECA_ALGORITHM_PROPERTY(double, river_width)
71  TECA_ALGORITHM_PROPERTY(double, river_length)
72 
73  // set/get the land-sea mask variable. this array
74  // will be used to identify land from ocean using
75  // land_threshold properties.
76  TECA_ALGORITHM_PROPERTY(std::string, land_sea_mask_variable)
77 
78  // set/get the land classification range [low high). defaults
79  // are [1.0 DOUBLE_MAX)
80  TECA_ALGORITHM_PROPERTY(double, land_threshold_low)
81  TECA_ALGORITHM_PROPERTY(double, land_threshold_high)
82 
83  // send humand readable representation to the
84  // stream
85  virtual void to_stream(std::ostream &os) const override;
86 
87 protected:
89 
90  // helper that computes the output extent
91  int get_active_extent(
92  p_teca_variant_array lat,
93  p_teca_variant_array lon,
94  std::vector<unsigned long> &extent) const;
95 
96 private:
97  virtual
98  teca_metadata get_output_metadata(
99  unsigned int port,
100  const std::vector<teca_metadata> &input_md) override;
101 
102  virtual
103  std::vector<teca_metadata> get_upstream_request(
104  unsigned int port,
105  const std::vector<teca_metadata> &input_md,
106  const teca_metadata &request) override;
107 
108  virtual
109  const_p_teca_dataset execute(
110  unsigned int port,
111  const std::vector<const_p_teca_dataset> &input_data,
112  const teca_metadata &request) override;
113 
114 private:
115  std::string water_vapor_variable;
116  std::string land_sea_mask_variable;
117  double low_water_vapor_threshold;
118  double high_water_vapor_threshold;
119  double search_lat_low;
120  double search_lon_low;
121  double search_lat_high;
122  double search_lon_high;
123  double river_start_lat_low;
124  double river_start_lon_low;
125  double river_end_lat_low;
126  double river_end_lon_low;
127  double river_end_lat_high;
128  double river_end_lon_high;
129  double percent_in_mesh;
130  double river_width;
131  double river_length;
132  double land_threshold_low;
133  double land_threshold_high;
134 };
135 
136 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_ar_detect
Definition: teca_ar_detect.h:25
teca_algorithm
Definition: teca_algorithm.h:25