TECA
teca_unpack_data.h
1 #ifndef teca_unpack_data_h
2 #define teca_unpack_data_h
3 
4 #include "teca_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 #include "teca_variant_array.h"
8 
9 #include <string>
10 #include <vector>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_unpack_data)
13 
14 
31 {
32 public:
33  TECA_ALGORITHM_STATIC_NEW(teca_unpack_data)
34  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_unpack_data)
35  TECA_ALGORITHM_CLASS_NAME(teca_unpack_data)
37 
38  // report/initialize to/from Boost program options
39  // objects.
40  TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
41  TECA_SET_ALGORITHM_PROPERTIES()
42 
43  // set the output data type.
44  // use teca_variant_array_code<T>::get() to get the numeric
45  // code corresponding to the data type T. The default output
46  // data type is single precision floating point.
47  TECA_ALGORITHM_PROPERTY_V(int, output_data_type)
48 
49  // set the output data type to double precision floating point
50  void set_output_data_type_to_float()
51  { this->set_output_data_type(teca_variant_array_code<float>::get()); }
52 
53  // set the output data type to single precision floating point
54  void set_output_data_type_to_double()
55  { this->set_output_data_type(teca_variant_array_code<double>::get()); }
56 
57  // set the algorihtm verbosity. off by default.
58  TECA_ALGORITHM_PROPERTY(int, verbose)
59 
60 protected:
62 
63 private:
64  teca_metadata get_output_metadata(
65  unsigned int port,
66  const std::vector<teca_metadata> &input_md) override;
67 
68  std::vector<teca_metadata> get_upstream_request(
69  unsigned int port,
70  const std::vector<teca_metadata> &input_md,
71  const teca_metadata &request) override;
72 
73  const_p_teca_dataset execute(
74  unsigned int port,
75  const std::vector<const_p_teca_dataset> &input_data,
76  const teca_metadata &request) override;
77 
78  int validate_output_data_type(int val);
79 
80 private:
81  int output_data_type;
82  int verbose;
83 };
84 
85 #endif
teca_metadata
Definition: teca_metadata.h:17
teca_variant_array_code
Definition: teca_variant_array.h:1247
teca_unpack_data
an algorithm that unpacks NetCDF packed values
Definition: teca_unpack_data.h:31
teca_algorithm
Definition: teca_algorithm.h:25