UFO
DataExtractorInput.h
Go to the documentation of this file.
1 /*
2  * (C) Crown copyright 2021, Met Office
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 #ifndef UFO_UTILS_DATAEXTRACTOR_DATAEXTRACTORINPUT_H_
9 #define UFO_UTILS_DATAEXTRACTOR_DATAEXTRACTORINPUT_H_
10 
11 #include <string>
12 #include <unordered_map>
13 #include <vector>
14 
15 #include <boost/multi_array.hpp>
16 #include <boost/variant.hpp>
17 
18 namespace ufo
19 {
20 
21 /// \brief Parts of the input data for the DataExtractor that don't depend on the type of the
22 /// extracted values.
23 ///
24 /// Note: the names of all coordinates are expected to be of the form `Group/var` (ioda-v2 style)
25 /// rather than `var@Group` (ioda-v1 style).
27  /// \brief A coordinate indexing a dimension of the payload array, i.e. the array from which
28  /// a DataExtractor will extract data.
29  typedef boost::variant<std::vector<int>,
30  std::vector<float>,
31  std::vector<std::string>
33  /// \brief A collection of named coordinate vectors.
34  typedef std::unordered_map<std::string, Coordinate> Coordinates;
35 
36  /// Coordinates indexing the payload array
38 
39  /// Maps coordinate names to dimensions (0 or 1) of the payload array
40  std::unordered_map<std::string, int> coord2DimMapping;
41  /// Maps dimensions of the payload array (0 or 1) to coordinate names
42  std::vector<std::vector<std::string>> dim2CoordMapping;
43 };
44 
45 /// \brief Input data for the DataExtractor.
46 ///
47 /// \tparam ExtractedValue
48 /// Type of the values to be extracted. Must be `float`, `int` or `std::string`.
49 ///
50 /// Note: the names of all coordinates are expected to be of the form `Group/var` (ioda-v2 style)
51 /// rather than `var@Group` (ioda-v1 style).
52 template <typename ExtractedValue>
54  /// Array from which values will be extracted
55  boost::multi_array<ExtractedValue, 3> payloadArray;
56 };
57 
58 } // namespace ufo
59 
60 #endif // UFO_UTILS_DATAEXTRACTOR_DATAEXTRACTORINPUT_H_
Definition: RunCRTM.h:27
Parts of the input data for the DataExtractor that don't depend on the type of the extracted values.
Coordinates coordsVals
Coordinates indexing the payload array.
boost::variant< std::vector< int >, std::vector< float >, std::vector< std::string > > Coordinate
A coordinate indexing a dimension of the payload array, i.e. the array from which a DataExtractor wil...
std::unordered_map< std::string, Coordinate > Coordinates
A collection of named coordinate vectors.
std::unordered_map< std::string, int > coord2DimMapping
Maps coordinate names to dimensions (0 or 1) of the payload array.
std::vector< std::vector< std::string > > dim2CoordMapping
Maps dimensions of the payload array (0 or 1) to coordinate names.
Input data for the DataExtractor.
boost::multi_array< ExtractedValue, 3 > payloadArray
Array from which values will be extracted.