#3305 Implement well path attribute track in well bore stability plots

* Fix depth start and end of attributes to match the TVD/MD display setting.
This commit is contained in:
Gaute Lindkvist 2018-09-05 14:03:18 +02:00
parent bddb8fb6fb
commit 385f7ad0da
5 changed files with 118 additions and 55 deletions

View File

@ -165,19 +165,11 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack(RimWellLogPlot* p
casingShoeTrack->setFormationCase(geoMechCase); casingShoeTrack->setFormationCase(geoMechCase);
casingShoeTrack->setShowFormations(true); casingShoeTrack->setShowFormations(true);
casingShoeTrack->setShowFormationLabels(false); casingShoeTrack->setShowFormationLabels(false);
casingShoeTrack->setShowWellPathAttributes(true);
casingShoeTrack->setWellPathAttributesSource(wellPath);
casingShoeTrack->setVisibleXRange(0.0, 0.0); casingShoeTrack->setVisibleXRange(0.0, 0.0);
RimWellLogFile* foundLogFile = wellPath->firstWellLogFileMatchingChannelName("CASING_SIZE");
// foundLogFile may be nullptr. Create the curve anyway so it exists when changing well.
RimWellLogFileCurve* fileCurve = RicWellLogTools::addFileCurve(casingShoeTrack, false);
fileCurve->setWellLogFile(foundLogFile);
fileCurve->setWellPath(wellPath);
fileCurve->setWellLogChannelName("CASING_SIZE");
fileCurve->setCustomName(QString("Casing size [in]"));
fileCurve->setLineThickness(2);
fileCurve->loadDataAndUpdate(false);
casingShoeTrack->setAutoScaleXEnabled(true); casingShoeTrack->setAutoScaleXEnabled(true);
casingShoeTrack->calculateXZoomRangeAndUpdateQwt(); casingShoeTrack->loadDataAndUpdate();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -179,13 +179,13 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitField(&m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", ""); CAF_PDM_InitField(&m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributes, "ShowWellPathAttributes", false, "Show Well Attributes", "", "", ""); CAF_PDM_InitField(&m_showWellPathAttributes, "ShowWellPathAttributes", false, "Show Well Attributes", "", "", "");
CAF_PDM_InitField(&m_showWellPathAttributeBothSides, "ShowWellPathAttrBothSides", false, "Show Both Sides", "", "", ""); CAF_PDM_InitField(&m_showWellPathAttributeBothSides, "ShowWellPathAttrBothSides", true, "Show Both Sides", "", "", "");
CAF_PDM_InitField(&m_wellPathAttributesInLegend, "WellPathAttributesInLegend", false, "Contribute to Legend", "", "", ""); CAF_PDM_InitField(&m_wellPathAttributesInLegend, "WellPathAttributesInLegend", false, "Contribute to Legend", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_attributesWellPathSource, "AttributesWellPathSource", "Well Path", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeSource, "AttributesWellPathSource", "Well Path", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_attributesCollection, "AttributesCollection", "Well Attributes", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_attributeCurves, "AttributeCurves", "", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_wellPathAttributeCurves, "AttributeCurves", "", "", "", "");
m_attributeCurves.uiCapability()->setUiHidden(true); m_wellPathAttributeCurves.uiCapability()->setUiHidden(true);
m_attributeCurves.uiCapability()->setUiTreeChildrenHidden(true); m_wellPathAttributeCurves.uiCapability()->setUiTreeChildrenHidden(true);
CAF_PDM_InitFieldNoDefault(&m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", ""); CAF_PDM_InitFieldNoDefault(&m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", "");
@ -423,18 +423,9 @@ void RimWellLogTrack::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
{ {
updateWellPathAttributesOnPlot(); updateWellPathAttributesOnPlot();
} }
else if (changedField == &m_attributesWellPathSource) else if (changedField == &m_wellPathAttributeSource)
{ {
m_attributesCollection = nullptr; updateWellPathAttributesCollection();
if (m_attributesWellPathSource)
{
std::vector<RimWellPathAttributeCollection*> attributeCollection;
m_attributesWellPathSource->descendantsIncludingThisOfType(attributeCollection);
if (!attributeCollection.empty())
{
m_attributesCollection = attributeCollection.front();
}
}
updateWellPathAttributesOnPlot(); updateWellPathAttributesOnPlot();
} }
} }
@ -587,7 +578,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogTrack::calculateValueOptions(const caf::
} }
} }
} }
else if (fieldNeedingOptions == &m_attributesWellPathSource) else if (fieldNeedingOptions == &m_wellPathAttributeSource)
{ {
RimTools::wellPathOptionItems(&options); RimTools::wellPathOptionItems(&options);
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front(caf::PdmOptionItemInfo("None", nullptr));
@ -678,7 +669,7 @@ void RimWellLogTrack::availableDepthRange(double* minimumDepth, double* maximumD
std::vector<RimPlotCurve*> allCurves; std::vector<RimPlotCurve*> allCurves;
allCurves.insert(allCurves.end(), curves.begin(), curves.end()); allCurves.insert(allCurves.end(), curves.begin(), curves.end());
allCurves.insert(allCurves.end(), m_attributeCurves.begin(), m_attributeCurves.end()); allCurves.insert(allCurves.end(), m_wellPathAttributeCurves.begin(), m_wellPathAttributeCurves.end());
for (RimPlotCurve* curve : allCurves) for (RimPlotCurve* curve : allCurves)
{ {
@ -736,6 +727,7 @@ void RimWellLogTrack::loadDataAndUpdate()
if ( m_wellLogTrackPlotWidget ) if ( m_wellLogTrackPlotWidget )
{ {
this->updateWellPathAttributesCollection();
this->updateWellPathAttributesOnPlot(); this->updateWellPathAttributesOnPlot();
m_wellLogTrackPlotWidget->updateLegend(); m_wellLogTrackPlotWidget->updateLegend();
@ -956,14 +948,22 @@ void RimWellLogTrack::applyXZoomFromVisibleRange()
m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax); m_wellLogTrackPlotWidget->setXRange(m_visibleXRangeMin, m_visibleXRangeMax);
// Attribute range // Attribute range. Double the width of the radius (thus same as diameter) to allow for labels and casing shoe.
double posRange = 1.5 * 0.5 * RimWellPathAttribute::MAX_DIAMETER_IN_INCHES; double attributeRangeMax = RimWellPathAttribute::MAX_DIAMETER_IN_INCHES;
double negRange = 0.0; double attributeRangeMin = 0.0;
if (m_showWellPathAttributeBothSides) if (m_showWellPathAttributeBothSides)
{ {
negRange = -posRange; attributeRangeMin = -attributeRangeMax;
} }
m_wellLogTrackPlotWidget->setXRange(negRange, posRange, QwtPlot::xBottom); else if (m_wellPathAttributeCollection)
{
attributeRangeMin = attributeRangeMax;
for (const RimWellPathAttribute* attribute : m_wellPathAttributeCollection->attributes())
{
attributeRangeMin = std::max(attributeRangeMin, attribute->diameterInInches() * 0.5);
}
}
m_wellLogTrackPlotWidget->setXRange(attributeRangeMin, attributeRangeMax, QwtPlot::xBottom);
m_wellLogTrackPlotWidget->replot(); m_wellLogTrackPlotWidget->replot();
} }
@ -1113,6 +1113,23 @@ void RimWellLogTrack::setShowFormationLabels(bool on)
m_showFormationLabels = on; m_showFormationLabels = on;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setShowWellPathAttributes(bool on)
{
m_showWellPathAttributes = on;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setWellPathAttributesSource(RimWellPath* wellPath)
{
m_wellPathAttributeSource = wellPath;
updateWellPathAttributesCollection();
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1187,7 +1204,7 @@ void RimWellLogTrack::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering&
attributeGroup->add(&m_showWellPathAttributes); attributeGroup->add(&m_showWellPathAttributes);
attributeGroup->add(&m_showWellPathAttributeBothSides); attributeGroup->add(&m_showWellPathAttributeBothSides);
attributeGroup->add(&m_wellPathAttributesInLegend); attributeGroup->add(&m_wellPathAttributesInLegend);
attributeGroup->add(&m_attributesWellPathSource); attributeGroup->add(&m_wellPathAttributeSource);
uiOrderingForXAxisSettings(uiOrdering); uiOrderingForXAxisSettings(uiOrdering);
@ -1258,6 +1275,23 @@ std::pair<double, double> RimWellLogTrack::adjustXRange(double minValue, double
return std::make_pair(adjustedMin, adjustedMax); return std::make_pair(adjustedMin, adjustedMax);
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateWellPathAttributesCollection()
{
m_wellPathAttributeCollection = nullptr;
if (m_wellPathAttributeSource)
{
std::vector<RimWellPathAttributeCollection*> attributeCollection;
m_wellPathAttributeSource->descendantsIncludingThisOfType(attributeCollection);
if (!attributeCollection.empty())
{
m_wellPathAttributeCollection = attributeCollection.front();
}
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -1665,18 +1699,18 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::updateWellPathAttributesOnPlot() void RimWellLogTrack::updateWellPathAttributesOnPlot()
{ {
for (RimWellPathAttributeCurve* curve : m_attributeCurves) for (RimWellPathAttributeCurve* curve : m_wellPathAttributeCurves)
{ {
curve->detachQwtCurve(); curve->detachQwtCurve();
} }
m_attributeCurves.deleteAllChildObjects(); m_wellPathAttributeCurves.deleteAllChildObjects();
if (m_showWellPathAttributes) if (m_showWellPathAttributes)
{ {
if (m_attributesCollection) if (m_wellPathAttributeCollection)
{ {
int index = 0; int index = 0;
for (RimWellPathAttribute* attribute : m_attributesCollection->attributes()) for (RimWellPathAttribute* attribute : m_wellPathAttributeCollection->attributes())
{ {
cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(index++); cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(index++);
{ {
@ -1688,8 +1722,8 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
negativeCurve->setColor(curveColor); negativeCurve->setColor(curveColor);
positiveCurve->showLegend(m_wellPathAttributesInLegend()); positiveCurve->showLegend(m_wellPathAttributesInLegend());
negativeCurve->showLegend(false); negativeCurve->showLegend(false);
m_attributeCurves.push_back(positiveCurve); m_wellPathAttributeCurves.push_back(positiveCurve);
m_attributeCurves.push_back(negativeCurve); m_wellPathAttributeCurves.push_back(negativeCurve);
} }
if (attribute->type() == RimWellPathAttribute::AttributeCasing) if (attribute->type() == RimWellPathAttribute::AttributeCasing)
@ -1702,12 +1736,12 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot()
negativeSymbol->setColor(curveColor); negativeSymbol->setColor(curveColor);
positiveSymbol->showLegend(false); positiveSymbol->showLegend(false);
negativeSymbol->showLegend(false); negativeSymbol->showLegend(false);
m_attributeCurves.push_back(positiveSymbol); m_wellPathAttributeCurves.push_back(positiveSymbol);
m_attributeCurves.push_back(negativeSymbol); m_wellPathAttributeCurves.push_back(negativeSymbol);
} }
} }
} }
for (RimWellPathAttributeCurve* curve : m_attributeCurves) for (RimWellPathAttributeCurve* curve : m_wellPathAttributeCurves)
{ {
curve->loadDataAndUpdate(false); curve->loadDataAndUpdate(false);
if (m_wellLogTrackPlotWidget) if (m_wellLogTrackPlotWidget)

View File

@ -117,6 +117,8 @@ public:
void setXAxisGridVisibility(RimWellLogPlot::AxisGridVisibility gridLines); void setXAxisGridVisibility(RimWellLogPlot::AxisGridVisibility gridLines);
void setShowFormations(bool on); void setShowFormations(bool on);
void setShowFormationLabels(bool on); void setShowFormationLabels(bool on);
void setShowWellPathAttributes(bool on);
void setWellPathAttributesSource(RimWellPath* wellPath);
RiuWellLogTrack* viewer(); RiuWellLogTrack* viewer();
@ -173,6 +175,7 @@ private:
std::pair<double, double> adjustXRange(double minValue, double maxValue, double tickInterval); std::pair<double, double> adjustXRange(double minValue, double maxValue, double tickInterval);
void updateWellPathAttributesCollection();
private: private:
QString m_xAxisTitle; QString m_xAxisTitle;
@ -204,9 +207,9 @@ private:
caf::PdmField<bool> m_showWellPathAttributes; caf::PdmField<bool> m_showWellPathAttributes;
caf::PdmField<bool> m_showWellPathAttributeBothSides; caf::PdmField<bool> m_showWellPathAttributeBothSides;
caf::PdmField<bool> m_wellPathAttributesInLegend; caf::PdmField<bool> m_wellPathAttributesInLegend;
caf::PdmPtrField<RimWellPath*> m_attributesWellPathSource; caf::PdmPtrField<RimWellPath*> m_wellPathAttributeSource;
caf::PdmPtrField<RimWellPathAttributeCollection*> m_attributesCollection; caf::PdmPtrField<RimWellPathAttributeCollection*> m_wellPathAttributeCollection;
caf::PdmChildArrayField<RimWellPathAttributeCurve*> m_attributeCurves; caf::PdmChildArrayField<RimWellPathAttributeCurve*> m_wellPathAttributeCurves;
bool m_formationsForCaseWithSimWellOnly; bool m_formationsForCaseWithSimWellOnly;

View File

@ -18,8 +18,11 @@
#include "RimWellPathAttributeCurve.h" #include "RimWellPathAttributeCurve.h"
#include "RimWellLogPlot.h"
#include "RimWellPathAttribute.h" #include "RimWellPathAttribute.h"
#include "RimWellPath.h"
#include "RigWellPath.h"
#include "RiuQwtPlotCurve.h" #include "RiuQwtPlotCurve.h"
#include "qwt_plot.h" #include "qwt_plot.h"
@ -81,8 +84,24 @@ void RimWellPathAttributeCurve::onLoadDataAndUpdate(bool updateParentPlot)
std::vector<double> xValues; std::vector<double> xValues;
std::vector<double> yValues; std::vector<double> yValues;
RimWellLogPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted(plot);
RimWellLogPlot::DepthTypeEnum depthType = plot->depthType();
if (m_wellPathAttribute) if (m_wellPathAttribute)
{ {
RimWellPath* wellPath = nullptr;
m_wellPathAttribute->firstAncestorOrThisOfTypeAsserted(wellPath);
cvf::Vec3d startPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthStart());
cvf::Vec3d endPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthEnd());
double startTVD = -startPoint.z();
double endTVD = -endPoint.z();
double startDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? startTVD : m_wellPathAttribute->depthStart();
double endDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? endTVD : m_wellPathAttribute->depthEnd();
setCustomName(m_wellPathAttribute->label()); setCustomName(m_wellPathAttribute->label());
double sign = m_curvePlotPosition == PositiveSide ? 1.0 : -1.0; double sign = m_curvePlotPosition == PositiveSide ? 1.0 : -1.0;
@ -96,7 +115,7 @@ void RimWellPathAttributeCurve::onLoadDataAndUpdate(bool updateParentPlot)
setLineThickness(4); setLineThickness(4);
setSymbol(RiuQwtSymbol::SYMBOL_NONE); setSymbol(RiuQwtSymbol::SYMBOL_NONE);
xValues = { radius, radius }; xValues = { radius, radius };
yValues = { 0.0, m_wellPathAttribute->depthEnd() }; yValues = { startDepth, endDepth };
} }
else if (m_curvePlotItem == MarkerSymbol) else if (m_curvePlotItem == MarkerSymbol)
{ {
@ -115,7 +134,7 @@ void RimWellPathAttributeCurve::onLoadDataAndUpdate(bool updateParentPlot)
} }
xValues = { radius }; xValues = { radius };
yValues = { m_wellPathAttribute->depthEnd() }; yValues = { endDepth };
} }
} }
else if (m_wellPathAttribute->type() == RimWellPathAttribute::AttributeLiner) else if (m_wellPathAttribute->type() == RimWellPathAttribute::AttributeLiner)
@ -124,7 +143,7 @@ void RimWellPathAttributeCurve::onLoadDataAndUpdate(bool updateParentPlot)
setLineThickness(2); setLineThickness(2);
xValues = { radius, radius}; xValues = { radius, radius};
yValues = { m_wellPathAttribute->depthStart(), m_wellPathAttribute->depthEnd() }; yValues = { startDepth, endDepth };
} }
} }
if (!xValues.empty()) if (!xValues.empty())
@ -147,8 +166,23 @@ bool RimWellPathAttributeCurve::yValueRange(double* minimumValue, double* maximu
{ {
if (m_wellPathAttribute) if (m_wellPathAttribute)
{ {
*minimumValue = m_wellPathAttribute->depthStart(); RimWellLogPlot* plot = nullptr;
*maximumValue = m_wellPathAttribute->depthEnd(); firstAncestorOrThisOfTypeAsserted(plot);
RimWellLogPlot::DepthTypeEnum depthType = plot->depthType();
RimWellPath* wellPath = nullptr;
m_wellPathAttribute->firstAncestorOrThisOfTypeAsserted(wellPath);
cvf::Vec3d startPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthStart());
cvf::Vec3d endPoint = wellPath->wellPathGeometry()->interpolatedPointAlongWellPath(m_wellPathAttribute->depthEnd());
double startTVD = -startPoint.z();
double endTVD = -endPoint.z();
double startDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? startTVD : m_wellPathAttribute->depthStart();
double endDepth = depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? endTVD : m_wellPathAttribute->depthEnd();
*minimumValue = startDepth;
*maximumValue = endDepth;
return true; return true;
} }
return false; return false;

View File

@ -112,7 +112,7 @@ void RiuQwtSymbol::renderSymbolLabel(QPainter *painter, const QPointF& position)
} }
else if (m_labelPosition == LabelRightOfSymbol) else if (m_labelPosition == LabelRightOfSymbol)
{ {
painter->drawText(position.x() + symbolWidth / 2 + 1, position.y(), m_label); painter->drawText(position.x() + symbolWidth + 3, position.y(), m_label);
} }
} }