#1933 Observed data: Add scaleFactor to ColumnInfo

This commit is contained in:
Rebecca Cox
2017-09-26 10:12:05 +02:00
parent 563a426ed5
commit e15d26cddb
2 changed files with 20 additions and 7 deletions
@@ -50,6 +50,12 @@ bool RifRsmspecParserTools::isLineSkippable(const std::string& line)
{ {
return true; return true;
} }
if (str.find("PAGE") < str.size())
{
return true;
}
return false; return false;
} }
@@ -191,7 +197,7 @@ size_t RifRsmspecParserTools::findFirstNonEmptyEntryIndex(std::vector<std::strin
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RifEclipseSummaryAddress RifRsmspecParserTools::makeAndFillAddress(std::string scaleFactor, std::string quantityName, std::vector< std::string > headerColumn) RifEclipseSummaryAddress RifRsmspecParserTools::makeAndFillAddress(std::string quantityName, std::vector< std::string > headerColumn)
{ {
int regionNumber = -1; int regionNumber = -1;
int regionNumber2 = -1; int regionNumber2 = -1;
@@ -290,15 +296,19 @@ std::vector<ColumnInfo> RifRsmspecParserTools::columnInfoForTable(std::stringstr
table.push_back(columnInfo); table.push_back(columnInfo);
} }
if (scaleFactors.size() < columnCount) if (scaleFactors.empty())
{ {
int diff = columnCount - scaleFactors.size(); for (size_t i = 0; i < table.size(); i++)
for (int i = 0; i < diff; i++)
{ {
scaleFactors.push_back("1.0"); scaleFactors.push_back("1");
} }
} }
for (size_t i = 0; i < table.size(); i++)
{
table[i].scaleFactor = scaleFactors[i];
}
std::vector< std::vector< std::string > > restOfHeader; std::vector< std::vector< std::string > > restOfHeader;
bool header = true; bool header = true;
@@ -338,7 +348,7 @@ std::vector<ColumnInfo> RifRsmspecParserTools::columnInfoForTable(std::stringstr
{ {
restOfHeaderColumn.push_back(restOfHeaderRow.at(i)); restOfHeaderColumn.push_back(restOfHeaderRow.at(i));
} }
table[i].summaryAddress = makeAndFillAddress(scaleFactors.at(i), quantityNames.at(i), restOfHeaderColumn); table[i].summaryAddress = makeAndFillAddress(quantityNames.at(i), restOfHeaderColumn);
} }
return table; return table;
@@ -33,7 +33,10 @@ struct ColumnInfo
bool isAVector = false; bool isAVector = false;
RifEclipseSummaryAddress summaryAddress; RifEclipseSummaryAddress summaryAddress;
std::string unitName; std::string unitName;
std::string scaleFactor;
std::vector<double> values; std::vector<double> values;
std::string dateFormat;
std::string origin;
}; };
//================================================================================================== //==================================================================================================
@@ -50,7 +53,7 @@ public:
static RifEclipseSummaryAddress::SummaryVarCategory identifyCategory(const std::string& word); static RifEclipseSummaryAddress::SummaryVarCategory identifyCategory(const std::string& word);
static void splitLineToDoubles(const std::string& line, std::vector<double>& values); static void splitLineToDoubles(const std::string& line, std::vector<double>& values);
static size_t findFirstNonEmptyEntryIndex(std::vector<std::string>& list); static size_t findFirstNonEmptyEntryIndex(std::vector<std::string>& list);
static RifEclipseSummaryAddress makeAndFillAddress(std::string scaleFactor, std::string quantityName, std::vector< std::string > headerColumn); static RifEclipseSummaryAddress makeAndFillAddress(std::string quantityName, std::vector< std::string > headerColumn);
static std::vector<ColumnInfo> columnInfoForTable(std::stringstream& data, std::string& line); static std::vector<ColumnInfo> columnInfoForTable(std::stringstream& data, std::string& line);
static bool isANumber(const std::string& line); static bool isANumber(const std::string& line);
static std::vector<std::string> headerReader(std::stringstream& streamData, std::string& line); static std::vector<std::string> headerReader(std::stringstream& streamData, std::string& line);