IODA Bundle
StrVecDataObject.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 "DataObject.h"
11 
12 #include <string>
13 #include <vector>
14 
15 
16 namespace Ingester
17 {
18  /// \brief Container for data that can be expressed as lists of strings
20  {
21  public:
22  explicit StrVecDataObject(const std::vector<std::string>& strVector);
23  ~StrVecDataObject() = default;
24 
25  /// \brief Makes an ioda::Variable and ads it to the given ioda::ObsGroup
26  /// \param obsGroup Obsgroup were to add the variable
27  /// \param name The name to associate with the variable (ex "latitude@MetaData")
28  /// \param dimensions List of Variables to use as the dimensions for this new variable
29  /// \param chunks List of integers specifying the chunking dimensions
30  /// \param compressionLevel The GZip compression level to use, must be 0-9
32  const std::string& name,
33  const std::vector<ioda::Variable>& dimensions,
34  const std::vector<ioda::Dimensions_t>& chunks,
35  int compressionLevel) final;
36 
37  /// \brief Print data to stdout for debug purposes.
38  void print() const final;
39 
40  /// \brief Get the number of rows represented in the data.
41  size_t nrows() const final;
42 
43  /// \brief Get the number of columns represented in the data.
44  size_t ncols() const final;
45 
46  // Getters
47  inline std::vector<std::string> get() const { return strVector_; }
48 
49  private:
50  /// \brief The data
51  const std::vector<std::string> strVector_;
52 
53  /// \brief Create an ioda::VariableCreationParameters for the data
54  /// \param chunks List of integers specifying the chunking dimensions
55  /// \param compressionLevel The GZip compression level to use, must be 0-9
57  const std::vector<ioda::Dimensions_t>& chunks,
58  int compressionLevel);
59  };
60 } // namespace Ingester
61 
62 
Abstract base class for intermediate data object that bridges the Parsers with the IodaEncoder.
Definition: DataObject.h:21
Container for data that can be expressed as lists of strings.
const std::vector< std::string > strVector_
The data.
void print() const final
Print data to stdout for debug purposes.
StrVecDataObject(const std::vector< std::string > &strVector)
static ioda::VariableCreationParameters makeCreationParams(const std::vector< ioda::Dimensions_t > &chunks, int compressionLevel)
Create an ioda::VariableCreationParameters for the data.
ioda::Variable createVariable(ioda::ObsGroup &obsGroup, const std::string &name, const std::vector< ioda::Variable > &dimensions, const std::vector< ioda::Dimensions_t > &chunks, int compressionLevel) final
Makes an ioda::Variable and ads it to the given ioda::ObsGroup.
size_t ncols() const final
Get the number of columns represented in the data.
size_t nrows() const final
Get the number of rows represented in the data.
std::vector< std::string > get() const
An ObsGroup is a specialization of a ioda::Group. It provides convenience functions and guarantees th...
Definition: ObsGroup.h:32
Definition: encode.cc:30
Used to specify Variable creation-time properties.
Definition: Has_Variables.h:57