IODA Bundle
BufrCollector.cpp
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 #include "BufrCollector.h"
9 
10 
11 namespace Ingester
12 {
13  BufrCollector::BufrCollector(const int fortranFileId, const BufrMnemonicSet mnemonicSet) :
14  fortranFileId_(fortranFileId),
15  accumulator_(BufrAccumulator(mnemonicSet.getSize() * mnemonicSet.getMaxColumn())),
16  mnemonicSet_(mnemonicSet)
17  {
18  }
19 
21  {
22  IngesterArrayMap dataMap;
23  size_t fieldIdx = 0;
24  for (const auto &fieldName : mnemonicSet_.getMnemonics())
25  {
26  IngesterArray dataArr = accumulator_.getData(fieldIdx,
29 
30  dataMap.insert({fieldName, dataArr});
31  fieldIdx++;
32  }
33 
35 
36  return dataMap;
37  }
38 } // namespace Ingester
39 
Accumulates provided data into a dynamically expanding Eigen Array.
IngesterArray getData(Eigen::Index elementPos, Eigen::Index numElementsPerSet, const Channels &indices={1})
Get an Eigen Array that contains a slice of the collected data.
BufrCollector(const int fortranFileId, const BufrMnemonicSet mnemonicSet)
BufrDataMap finalize()
Get the data we want from the accumulator and make our data map. Resets the accumulator.
BufrAccumulator accumulator_
Accumulator to collect the data we are collecting.
Definition: BufrCollector.h:42
const BufrMnemonicSet mnemonicSet_
Specifies the mnemonics and channels this collector gets from the BUFR file.
Definition: BufrCollector.h:45
Defenition of BUFR mnemonics and associated channels of interest.
std::vector< std::string > getMnemonics() const
Channels getChannels() const
Eigen::Array< FloatType, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > IngesterArray
Definition: IngesterTypes.h:19
IngesterArrayMap BufrDataMap
Definition: BufrTypes.h:21
std::map< std::string, IngesterArray > IngesterArrayMap
Definition: IngesterTypes.h:20