#1168, #1171 Added new depth types to RimWellLogPlot, with handling of unit type "none" as well. Made Well Alloc Plots make only "Connection Number" available on its WellLogPlot

This commit is contained in:
Jacob Støren 2017-02-09 13:30:36 +01:00
parent dea5c8fc8c
commit 65f36d6a3f
10 changed files with 142 additions and 14 deletions

View File

@ -73,6 +73,8 @@ RimWellAllocationPlot::RimWellAllocationPlot()
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "");
m_accumulatedWellFlowPlot.uiCapability()->setUiHidden(true);
m_accumulatedWellFlowPlot = new RimWellLogPlot;
m_accumulatedWellFlowPlot->setDepthUnit(RimDefines::UNIT_NONE);
m_accumulatedWellFlowPlot->setDepthType(RimWellLogPlot::CONNECTION_NUMBER);
CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "");
m_totalWellAllocationPlot.uiCapability()->setUiHidden(true);
@ -308,7 +310,7 @@ void RimWellAllocationPlot::addStackedCurve(const QString& tracerName,
RimWellLogTrack* plotTrack)
{
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValues(tracerName, connNumbers, accFlow);
curve->setFlowValuesPrConnection(tracerName, connNumbers, accFlow);
if ( m_flowDiagSolution )
curve->setColor(m_flowDiagSolution->tracerColor(tracerName));

View File

@ -142,7 +142,7 @@ void RimWellFlowRateCurve::updateStackedPlotData()
bool isFirstTrack = (wellLogTrack == wellLogPlot->trackByIndex(0));
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_METER;
RimDefines::DepthUnitType displayUnit = RimDefines::UNIT_NONE;
std::vector<double> depthValues = m_curveData->measuredDepthPlotValues(displayUnit);
if (depthValues.size()) depthValues.insert(depthValues.begin(), depthValues[0]); // Insert the first depth position again, to make room for a real 0 value
@ -192,10 +192,10 @@ RimWellAllocationPlot* RimWellFlowRateCurve::wellAllocationPlot() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellFlowRateCurve::setFlowValues(const QString& tracerName, const std::vector<double>& measuredDepths, const std::vector<double>& flowRates)
void RimWellFlowRateCurve::setFlowValuesPrConnection(const QString& tracerName, const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates)
{
m_curveData = new RigWellLogCurveData;
m_curveData->setValuesAndMD(flowRates, measuredDepths, RimDefines::UNIT_METER, false);
m_curveData->setValuesAndMD(flowRates, connectionNumbers, RimDefines::UNIT_NONE, false);
m_tracerName = tracerName;
}

View File

@ -38,7 +38,7 @@ public:
RimWellFlowRateCurve();
virtual ~RimWellFlowRateCurve();
void setFlowValues(const QString& tracerName , const std::vector<double>& measuredDepths, const std::vector<double>& flowRates);
void setFlowValuesPrConnection(const QString& tracerName , const std::vector<double>& connectionNumbers, const std::vector<double>& flowRates);
void updateStackedPlotData();
virtual QString wellName() const override;

View File

@ -50,6 +50,8 @@ namespace caf
{
addItem(RimDefines::UNIT_METER, "UNIT_METER", "Meter");
addItem(RimDefines::UNIT_FEET, "UNIT_FEET", "Feet");
addItem(RimDefines::UNIT_NONE, "UNIT_NONE", "None");
setDefault(RimDefines::UNIT_METER);
}

View File

@ -77,7 +77,8 @@ public:
enum DepthUnitType
{
UNIT_METER,
UNIT_FEET
UNIT_FEET,
UNIT_NONE
};
static double feetPerMeter() { return 3.2808399; }

View File

@ -304,7 +304,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate()
{
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->trueDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
}
else
else if (wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH)
{
m_qwtPlotCurve->setSamples(m_curveData->xPlotValues().data(), m_curveData->measuredDepthPlotValues(displayUnit).data(), static_cast<int>(m_curveData->xPlotValues().size()));
}

View File

@ -30,6 +30,7 @@
#include "cvfAssert.h"
#include <math.h>
#include "RimWellAllocationPlot.h"
#define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0
#define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0
@ -41,6 +42,8 @@ namespace caf {
{
addItem(RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth");
addItem(RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth");
addItem(RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length");
addItem(RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number");
setDefault(RimWellLogPlot::MEASURED_DEPTH);
}
@ -111,6 +114,7 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
{
updateMdiWindowTitle();
}
if (changedField == &m_depthType ||
changedField == &m_depthUnit)
{
@ -118,6 +122,36 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly)
{
QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_depthType )
{
using DepthAppEnum = caf::AppEnum< DepthTypeEnum >;
for (size_t i = 0; i < DepthAppEnum::size(); ++i)
{
DepthTypeEnum enumVal = DepthAppEnum::fromIndex(i);
if (m_disabledDepthTypes.count( enumVal) == 0)
{
options.push_back(caf::PdmOptionItemInfo(DepthAppEnum::uiText(enumVal), enumVal));
}
}
}
else if ( fieldNeedingOptions == &m_depthUnit)
{
using UnitAppEnum = caf::AppEnum< RimDefines::DepthUnitType >;
options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RimDefines::UNIT_METER), RimDefines::UNIT_METER));
options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(RimDefines::UNIT_FEET), RimDefines::UNIT_FEET));
}
(*useOptionsOnly) = true;
return options;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -352,12 +386,17 @@ void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
{
uiOrdering.add(&m_userName);
uiOrdering.add(&m_depthType);
uiOrdering.add(&m_depthUnit);
if ( m_depthType() != CONNECTION_NUMBER )
{
uiOrdering.add(&m_depthUnit);
}
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Visible Depth Range");
gridGroup->add(&m_isAutoScaleDepthEnabled);
gridGroup->add(&m_minVisibleDepth);
gridGroup->add(&m_maxVisibleDepth);
uiOrdering.setForgetRemainingFields(true);
}
@ -377,6 +416,8 @@ void RimWellLogPlot::updateTracks()
{
if (m_showWindow)
{
updateDisabledDepthTypes();
for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx)
{
m_tracks[tIdx]->loadDataAndUpdate();
@ -518,6 +559,14 @@ RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const
return m_depthType.value();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::setDepthType(DepthTypeEnum depthType)
{
m_depthType = depthType;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -536,14 +585,24 @@ QString RimWellLogPlot::depthPlotTitle() const
switch (m_depthType.value())
{
case MEASURED_DEPTH:
depthTitle = "MD";
break;
depthTitle = "MD";
break;
case TRUE_VERTICAL_DEPTH:
depthTitle = "TVD";
break;
depthTitle = "TVD";
break;
case PSEUDO_LENGTH:
depthTitle = "PL";
break;
case CONNECTION_NUMBER:
depthTitle = "Connection";
break;
}
if (m_depthType() == CONNECTION_NUMBER) return depthTitle;
if (m_depthUnit == RimDefines::UNIT_METER)
{
depthTitle += " [m]";
@ -552,6 +611,10 @@ QString RimWellLogPlot::depthPlotTitle() const
{
depthTitle += " [ft]";
}
else if (m_depthUnit == RimDefines::UNIT_NONE)
{
depthTitle += "";
}
return depthTitle;
}
@ -574,3 +637,24 @@ void RimWellLogPlot::setDepthUnit(RimDefines::DepthUnitType depthUnit)
updateTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateDisabledDepthTypes()
{
m_disabledDepthTypes.clear();
RimWellAllocationPlot* wap;
firstAncestorOrThisOfType(wap);
if (wap)
{
m_disabledDepthTypes.insert(MEASURED_DEPTH);
m_disabledDepthTypes.insert(TRUE_VERTICAL_DEPTH);
m_disabledDepthTypes.insert(PSEUDO_LENGTH);
}
else
{
m_disabledDepthTypes.insert(PSEUDO_LENGTH);
m_disabledDepthTypes.insert(CONNECTION_NUMBER);
}
}

View File

@ -45,10 +45,14 @@ public:
enum DepthTypeEnum
{
MEASURED_DEPTH,
TRUE_VERTICAL_DEPTH
TRUE_VERTICAL_DEPTH,
PSEUDO_LENGTH,
CONNECTION_NUMBER
};
public:
RimWellLogPlot();
virtual ~RimWellLogPlot();
@ -57,10 +61,12 @@ public:
QString description() const;
DepthTypeEnum depthType() const;
void setDepthType(DepthTypeEnum depthType);
RimDefines::DepthUnitType depthUnit() const;
void setDepthUnit(RimDefines::DepthUnitType depthUnit);
QString depthPlotTitle() const;
void addTrack(RimWellLogTrack* track);
@ -97,6 +103,7 @@ protected:
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; }
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override;
virtual QImage snapshotWindowContent() override;
@ -107,6 +114,8 @@ private:
void recreateTrackPlots();
void detachAllCurves();
void updateDisabledDepthTypes();
public: // Needed by RiuWellAllocation Plot
// RimViewWindow overrides
@ -118,6 +127,7 @@ private:
caf::PdmField< caf::AppEnum< DepthTypeEnum > > m_depthType;
caf::PdmField< caf::AppEnum< RimDefines::DepthUnitType > > m_depthUnit;
std::set<DepthTypeEnum> m_disabledDepthTypes;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;

View File

@ -203,6 +203,11 @@ public:
{
lasFile->AddLog("DEPTH", "FT", "Depth in feet", firstCurveData->measuredDepths());
}
else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE )
{
CVF_ASSERT(false);
lasFile->AddLog("DEPTH", "", "Depth in Connection number", firstCurveData->measuredDepths());
}
if (firstCurveData->tvDepths().size())
{
@ -225,6 +230,12 @@ public:
{
lasFile->AddLog("TVDRKB", "FT", "True vertical depth (Rotary Kelly Bushing)", tvdrkbValues);
}
else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE )
{
CVF_ASSERT(false);
lasFile->AddLog("TVDRKB", "", "", tvdrkbValues);
}
}
}
@ -243,6 +254,10 @@ public:
{
lasFile->setDepthUnit("FT");
}
else if ( firstCurveData->depthUnit() == RimDefines::UNIT_NONE )
{
CVF_ASSERT(false);
}
double absentValue = SingleLasFileMetaData::createAbsentValue(m_minimumCurveValue);
lasFile->SetMissing(absentValue);

View File

@ -228,6 +228,11 @@ QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelNa
{
return "FT";
}
else if (displayDepthUnit == RimDefines::UNIT_NONE)
{
CVF_ASSERT(false);
return "";
}
}
}
@ -279,7 +284,11 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString
else if (curveData->depthUnit() == RimDefines::UNIT_FEET)
{
lasFile.AddLog("DEPTH", "FT", "Depth in feet", curveData->measuredDepths());
}
else if (curveData->depthUnit() == RimDefines::UNIT_NONE)
{
CVF_ASSERT(false);
lasFile.AddLog("DEPTH", "", "Depth in connection number", curveData->measuredDepths());
}
if(curveData->tvDepths().size())
@ -305,6 +314,11 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString
{
lasFile.setDepthUnit("FT");
}
else if ( curveData->depthUnit() == RimDefines::UNIT_NONE )
{
CVF_ASSERT(false);
lasFile.setDepthUnit("");
}
lasFile.setVersionInfo("2.0");