#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

View File

@ -50,6 +50,12 @@ bool RifRsmspecParserTools::isLineSkippable(const std::string& line)
{
return true;
}
if (str.find("PAGE") < str.size())
{
return true;
}
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 regionNumber2 = -1;
@ -290,15 +296,19 @@ std::vector<ColumnInfo> RifRsmspecParserTools::columnInfoForTable(std::stringstr
table.push_back(columnInfo);
}
if (scaleFactors.size() < columnCount)
if (scaleFactors.empty())
{
int diff = columnCount - scaleFactors.size();
for (int i = 0; i < diff; i++)
for (size_t i = 0; i < table.size(); 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;
bool header = true;
@ -338,7 +348,7 @@ std::vector<ColumnInfo> RifRsmspecParserTools::columnInfoForTable(std::stringstr
{
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;

View File

@ -33,7 +33,10 @@ struct ColumnInfo
bool isAVector = false;
RifEclipseSummaryAddress summaryAddress;
std::string unitName;
std::string scaleFactor;
std::vector<double> values;
std::string dateFormat;
std::string origin;
};
//==================================================================================================
@ -50,7 +53,7 @@ public:
static RifEclipseSummaryAddress::SummaryVarCategory identifyCategory(const std::string& word);
static void splitLineToDoubles(const std::string& line, std::vector<double>& values);
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 bool isANumber(const std::string& line);
static std::vector<std::string> headerReader(std::stringstream& streamData, std::string& line);