TECA
The Toolkit for Extreme Climate Analysis
teca_cf_time_axis_reader.h
1 #ifndef teca_cf_time_axis_reader_h
2 #define teca_cf_time_axis_reader_h
3 
4 #include "teca_config.h"
5 #include "teca_shared_object.h"
6 #include "teca_algorithm.h"
7 #include "teca_metadata.h"
8 
9 #include <string>
10 #include <vector>
11 #include <iostream>
12 
13 TECA_SHARED_OBJECT_FORWARD_DECL(teca_cf_time_axis_reader)
14 
15 /// An algorithm to read time axis and its attributes in parallel.
17 {
18 public:
19  TECA_ALGORITHM_STATIC_NEW(teca_cf_time_axis_reader)
20  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_cf_time_axis_reader)
21  TECA_ALGORITHM_CLASS_NAME(teca_cf_time_axis_reader)
22  ~teca_cf_time_axis_reader() = default;
23 
24  // describe the set of files comprising the dataset. This
25  // should contain the full path and regex describing the
26  // file name pattern
27  TECA_ALGORITHM_PROPERTY(std::string, files_regex)
28 
29  // list of file names to open. if this is set the files_regex
30  // is ignored.
31  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, file_name)
32 
33  // set the name of the time axis (time)
34  TECA_ALGORITHM_PROPERTY(std::string, t_axis_variable)
35 
36  // get the path and files found. only rank 0 will have these
37  // these will be populated after the report phase
38  const std::string &get_path() const { return this->path; }
39  const std::vector<std::string> &get_files() const { return this->files; }
40 
41 protected:
43 
44  void set_modified() override;
45 
47 
48  teca_metadata get_output_metadata(unsigned int port,
49  const std::vector<teca_metadata> &input_md) override;
50 
51  const_p_teca_dataset execute(unsigned int port,
52  const std::vector<const_p_teca_dataset> &input_data,
53  const teca_metadata &request) override;
54 
55 private:
56  std::string t_axis_variable;
57  std::string files_regex;
58  std::vector<std::string> file_names;
59  std::vector<std::string> files;
60  std::string path;
61 };
62 
63 #endif
teca_metadata
A generic container for meta data in the form of name=value pairs.
Definition: teca_metadata.h:21
teca_algorithm::get_output_metadata
virtual teca_metadata get_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md)
teca_cf_time_axis_reader
An algorithm to read time axis and its attributes in parallel.
Definition: teca_cf_time_axis_reader.h:16
teca_shared_object.h
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
teca_file_util::path
TECA_EXPORT std::string path(const std::string &filename)