#2215 Plt Ploit : Show units in legend

This commit is contained in:
Magne Sjaastad 2017-12-05 09:45:41 +01:00
parent 7b3a9de199
commit 88559c8252
3 changed files with 103 additions and 13 deletions

View File

@ -683,6 +683,24 @@ QString RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WellFlowCondition co
return axisTitle;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString flowConditionReservoirUnitText(RiaEclipseUnitTools::UnitSystem unitSystem)
{
QString unitText;
switch (unitSystem)
{
case RiaEclipseUnitTools::UNITS_METRIC: unitText = "[m<sup>3</sup>/day]"; break;
case RiaEclipseUnitTools::UNITS_FIELD: unitText = "[Brl/day]"; break;
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break;
default: break;
}
return unitText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -692,13 +710,7 @@ QString RimWellPlotTools::flowUnitText(RimWellLogFile::WellFlowCondition conditi
if (condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR)
{
switch (unitSystem)
{
case RiaEclipseUnitTools::UNITS_METRIC: unitText = "[m<sup>3</sup>/day]"; break;
case RiaEclipseUnitTools::UNITS_FIELD: unitText = "[Brl/day]"; break;
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break;
default: break;
}
unitText = flowConditionReservoirUnitText(unitSystem);
}
else
{
@ -714,6 +726,49 @@ QString RimWellPlotTools::flowUnitText(RimWellLogFile::WellFlowCondition conditi
return unitText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPlotTools::curveUnitText(RimWellLogFile::WellFlowCondition condition, RiaEclipseUnitTools::UnitSystem unitSystem, FlowPhase flowPhase)
{
QString unitText;
if (condition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR)
{
unitText = flowConditionReservoirUnitText(unitSystem);
}
else
{
switch (unitSystem)
{
case RiaEclipseUnitTools::UNITS_METRIC:
switch (flowPhase)
{
case FLOW_PHASE_GAS: unitText = "[kSm<sup>3</sup>/day]"; break;
case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit
case FLOW_PHASE_OIL: unitText = "[Sm<sup>3</sup>/day]"; break;
default: unitText = "[Liquid Sm<sup>3</sup>/day], [Gas kSm<sup>3</sup>/day]"; break;
}
break;
case RiaEclipseUnitTools::UNITS_FIELD:
switch (flowPhase)
{
case FLOW_PHASE_GAS: unitText = "[BOE/day]"; break;
case FLOW_PHASE_WATER: // Intentionally fall through, water and oil have same unit
case FLOW_PHASE_OIL: unitText = "[BBL/day]"; break;
default: unitText = "[Liquid BBL/day], [Gas BOE/day]"; break;
}
break;
case RiaEclipseUnitTools::UNITS_LAB: unitText = "[cm<sup>3</sup>/hr]"; break;
default: break;
}
}
return unitText;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -99,6 +99,10 @@ public:
static QString flowUnitText(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem);
static QString curveUnitText(RimWellLogFile::WellFlowCondition condition,
RiaEclipseUnitTools::UnitSystem unitSystem,
FlowPhase flowPhase);
private:
friend class StaticFieldsInitializer;
static const std::set<QString> PRESSURE_DATA_NAMES;

View File

@ -528,6 +528,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::unique_ptr<RigResultPointCalculator> resultPointCalc;
QString curveName;
{
curveName += sourceDef.eclCase() ? sourceDef.eclCase()->caseUserDescription() : "";
curveName += sourceDef.wellLogFile() ? sourceDef.wellLogFile()->name() : "";
@ -535,23 +536,32 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
curveName += ", " + timeStep.toString(dateFormatString);
}
RimEclipseResultCase* rimEclipseResultCase = dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase());
if ( sourceDef.sourceType() == RifDataSourceForRftPlt::RFT )
{
resultPointCalc.reset(new RigRftResultPointCalculator(m_wellPathName,
dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
rimEclipseResultCase,
timeStep));
}
else if (sourceDef.sourceType() == RifDataSourceForRftPlt::GRID)
{
resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellPathName,
dynamic_cast<RimEclipseResultCase*>(sourceDef.eclCase()),
rimEclipseResultCase,
timeStep));
}
RiaEclipseUnitTools::UnitSystem unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN;
if (rimEclipseResultCase)
{
unitSet = rimEclipseResultCase->eclipseCaseData()->unitsType();
}
if (resultPointCalc != nullptr)
{
if ( resultPointCalc->pipeBranchCLCoords().size() )
{
if ( selectedPhases.count(FLOW_PHASE_TOTAL)
&& m_useReservoirConditionCurves()
&& sourceDef.sourceType() == RifDataSourceForRftPlt::GRID )
@ -563,8 +573,10 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
const std::vector<double>& depthValues = wfTotalAccumulator.pseudoLengthFromTop(0);
QString curveUnitText = RimWellPlotTools::flowUnitText(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet);
const std::vector<double> accFlow = wfTotalAccumulator.accumulatedTracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, 0);
addStackedCurve(curveName + ", " + RIG_FLOW_TOTAL_NAME + " [R]",
addStackedCurve(curveName + ", " + RIG_FLOW_TOTAL_NAME + " " + curveUnitText,
depthValues,
accFlow,
plotTrack,
@ -595,8 +607,14 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
|| tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS)
|| tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER) )
{
FlowPhase flowPhase = FLOW_PHASE_NONE;
if (tracerName == RIG_FLOW_OIL_NAME) flowPhase = FLOW_PHASE_OIL;
else if (tracerName == RIG_FLOW_GAS_NAME) flowPhase = FLOW_PHASE_GAS;
else if (tracerName == RIG_FLOW_WATER_NAME) flowPhase = FLOW_PHASE_WATER;
QString curveUnitText = RimWellPlotTools::curveUnitText(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase);
const std::vector<double> accFlow = wfPhaseAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0);
addStackedCurve(curveName + ", " + tracerName + " [S]",
addStackedCurve(curveName + ", " + tracerName + " " + curveUnitText,
depthValues,
accFlow,
plotTrack,
@ -639,7 +657,14 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
}
std::vector<double> depthValues = wellLogFileData->depthValues();
QString conditionName = (flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR) ? " [R]" : " [S]";
RiaEclipseUnitTools::UnitSystem unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN;
{
RiaDefines::DepthUnitType depthUnit = wellLogFileData->depthUnit();
if (depthUnit == RiaDefines::UNIT_FEET) unitSystem = RiaEclipseUnitTools::UNITS_FIELD;
if (depthUnit == RiaDefines::UNIT_METER) unitSystem = RiaEclipseUnitTools::UNITS_METRIC;
}
for ( const ChannelValNameIdxTuple& channelInfo: sortedChannels )
{
@ -651,8 +676,14 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
RimWellPlotTools::isWaterFlowChannel(channelName) ? cvf::Color3f::BLUE :
cvf::Color3f::DARK_GRAY;
FlowPhase flowPhase = FLOW_PHASE_NONE;
if (RimWellPlotTools::isOilFlowChannel(channelName)) flowPhase = FLOW_PHASE_OIL;
else if (RimWellPlotTools::isGasFlowChannel(channelName)) flowPhase = FLOW_PHASE_GAS;
else if (RimWellPlotTools::isWaterFlowChannel(channelName)) flowPhase = FLOW_PHASE_WATER;
QString curveUnitText = RimWellPlotTools::curveUnitText(flowCondition, unitSet, flowPhase);
addStackedCurve(curveName + ", " + channelName + conditionName,
addStackedCurve(curveName + ", " + channelName + curveUnitText,
depthValues,
channelData[std::get<2>(channelInfo)],
plotTrack,