IODA Bundle
DatetimeVariable.h
Go to the documentation of this file.
1 /*
2  * (C) Copyright 2020 NOAA/NWS/NCEP/EMC
3  *
4  * This software is licensed under the terms of the Apache Licence Version 2.0
5  * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6  */
7 
8 #pragma once
9 
10 #include <string>
11 #include <vector>
12 
13 
14 #include "eckit/config/LocalConfiguration.h"
15 
16 #include "BufrParser/BufrTypes.h"
18 #include "Variable.h"
19 
20 
21 namespace Ingester
22 {
23  /// \brief Exports parsed data as datetimes using speciefied Mnemonics
24  class DatetimeVariable final : public Variable
25  {
26  public:
27  explicit DatetimeVariable(const eckit::Configuration& conf);
29 
30  /// \brief Get the configured mnemonics and turn them into datetime strings
31  /// \param map BufrDataMap that contains the parsed data for each mnemonic
32  std::shared_ptr<DataObject> exportData(const BufrDataMap& map) final;
33 
34  private:
35  /// \brief Mnemonic for year
36  const std::string yearKey_;
37 
38  /// \brief Mnemonic for month
39  const std::string monthKey_;
40 
41  /// \brief Mnemonic for day
42  const std::string dayKey_;
43 
44  /// \brief Mnemonic for hour
45  const std::string hourKey_;
46 
47  /// \brief Mnemonic for minute
48  const std::string minuteKey_;
49 
50  /// \brief Mnemonic for second (optional)
51  std::string secondKey_;
52 
53  /// \brief Hours to offset from UTC (optional)
55 
56  /// \brief makes sure the bufr data map has all the required keys.
57  void checkKeys(const BufrDataMap& map);
58  };
59 } // namespace Ingester
Abstract base class for intermediate data object that bridges the Parsers with the IodaEncoder.
Definition: DataObject.h:21
Exports parsed data as datetimes using speciefied Mnemonics.
const std::string monthKey_
Mnemonic for month.
int hoursFromUtc_
Hours to offset from UTC (optional)
DatetimeVariable(const eckit::Configuration &conf)
const std::string hourKey_
Mnemonic for hour.
~DatetimeVariable() final=default
std::string secondKey_
Mnemonic for second (optional)
const std::string yearKey_
Mnemonic for year.
std::shared_ptr< DataObject > exportData(const BufrDataMap &map) final
Get the configured mnemonics and turn them into datetime strings.
const std::string dayKey_
Mnemonic for day.
void checkKeys(const BufrDataMap &map)
makes sure the bufr data map has all the required keys.
const std::string minuteKey_
Mnemonic for minute.
IngesterArrayMap BufrDataMap
Definition: BufrTypes.h:21
Definition: encode.cc:30