TECA
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_shared_object.h"
5 #include "teca_algorithm.h"
6 #include "teca_metadata.h"
7 
8 #include <string>
9 #include <vector>
10 #include <iostream>
11 
12 TECA_SHARED_OBJECT_FORWARD_DECL(teca_cf_time_axis_reader)
13 
16 {
17 public:
18  TECA_ALGORITHM_STATIC_NEW(teca_cf_time_axis_reader)
19  TECA_ALGORITHM_DELETE_COPY_ASSIGN(teca_cf_time_axis_reader)
20  TECA_ALGORITHM_CLASS_NAME(teca_cf_time_axis_reader)
21  ~teca_cf_time_axis_reader() = default;
22 
23  // describe the set of files comprising the dataset. This
24  // should contain the full path and regex describing the
25  // file name pattern
26  TECA_ALGORITHM_PROPERTY(std::string, files_regex)
27 
28  // list of file names to open. if this is set the files_regex
29  // is ignored.
30  TECA_ALGORITHM_VECTOR_PROPERTY(std::string, file_name)
31 
32  // set the name of the time axis (time)
33  TECA_ALGORITHM_PROPERTY(std::string, t_axis_variable)
34 
35  // get the path and files found. only rank 0 will have these
36  // these will be populated after the report phase
37  const std::string &get_path() const { return this->path; }
38  const std::vector<std::string> &get_files() const { return this->files; }
39 
40 protected:
42 
43  void set_modified() override;
44 
45  teca_metadata get_output_metadata(unsigned int port,
46  const std::vector<teca_metadata> &input_md) override;
47 
48  const_p_teca_dataset execute(unsigned int port,
49  const std::vector<const_p_teca_dataset> &input_data,
50  const teca_metadata &request) override;
51 
52 private:
53  std::string t_axis_variable;
54  std::string files_regex;
55  std::vector<std::string> file_names;
56  std::vector<std::string> files;
57  std::string path;
58 };
59 
60 #endif
teca_metadata
Definition: teca_metadata.h:17
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_algorithm
Definition: teca_algorithm.h:25