#2003 Observed Data : If YEARX is present, use this as basis for the time step

This commit is contained in:
Magne Sjaastad
2017-11-03 16:59:59 +01:00
parent f50760bb35
commit 7d3a547ad6
2 changed files with 22 additions and 20 deletions

View File

@@ -142,6 +142,7 @@ void RifColumnBasedUserData::buildTimeStepsFromTables()
// Find time index
size_t dateColumnIndex = tableData.columnInfos().size();
size_t dayOrYearColumnIndex = tableData.columnInfos().size();
size_t yearXColumnIndex = tableData.columnInfos().size();
for (size_t columIndex = 0; columIndex < tableData.columnInfos().size(); columIndex++)
{
@@ -151,11 +152,18 @@ void RifColumnBasedUserData::buildTimeStepsFromTables()
{
dateColumnIndex = columIndex;
}
else if (dayOrYearColumnIndex == tableData.columnInfos().size() &&
if (dayOrYearColumnIndex == tableData.columnInfos().size() &&
RifEclipseUserDataParserTools::hasTimeUnit(ci.unitName))
{
dayOrYearColumnIndex = columIndex;
}
if (yearXColumnIndex == tableData.columnInfos().size() &&
ci.summaryAddress.quantityName() == "YEARX")
{
yearXColumnIndex = columIndex;
}
}
if (dateColumnIndex == tableData.columnInfos().size() &&
@@ -181,6 +189,16 @@ void RifColumnBasedUserData::buildTimeStepsFromTables()
timeSteps.push_back(dt.toTime_t());
}
}
else if (yearXColumnIndex != tableData.columnInfos().size())
{
const ColumnInfo& ci = tableData.columnInfos()[yearXColumnIndex];
for (const auto& timeStepValue : ci.values)
{
QDateTime dateTime = RiaQDateTimeTools::fromYears(timeStepValue);
timeSteps.push_back(dateTime.toTime_t());
}
}
else
{
QDateTime startDate = RiaQDateTimeTools::epoch();
@@ -216,7 +234,6 @@ void RifColumnBasedUserData::buildTimeStepsFromTables()
timeSteps.push_back(dateTime.toTime_t());
}
}
}
}