(#557, #560, #561) WLP: Massive renaming in WellLogCurveData. Fixed undiscovered bug.

Curves plotted by TVD was not correctly splitted where well path went out in free air.
This commit is contained in:
Jacob Støren
2015-10-15 23:12:18 +02:00
parent aeeb445dae
commit 5d642719b7
7 changed files with 113 additions and 68 deletions

View File

@@ -195,7 +195,8 @@ void RimWellLogExtractionCurve::updatePlotData()
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase); cvf::ref<RigGeoMechWellLogExtractor> geomExtractor = wellLogCollection->findOrCreateExtractor(m_wellPath, geomCase);
std::vector<double> values; std::vector<double> values;
std::vector<double> depthValues; std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
if (eclExtractor.notNull()) if (eclExtractor.notNull())
{ {
@@ -203,7 +204,11 @@ void RimWellLogExtractionCurve::updatePlotData()
firstAnchestorOrThisOfType(wellLogPlot); firstAnchestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot); CVF_ASSERT(wellLogPlot);
depthValues = wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH ? eclExtractor->measuredDepth() : eclExtractor->trueVerticalDepth(); measuredDepthValues = eclExtractor->measuredDepth();
if (wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
tvDepthValues = eclExtractor->trueVerticalDepth();
}
RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel()); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel());
m_eclipseResultDefinition->loadResult(); m_eclipseResultDefinition->loadResult();
@@ -225,7 +230,12 @@ void RimWellLogExtractionCurve::updatePlotData()
firstAnchestorOrThisOfType(wellLogPlot); firstAnchestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot); CVF_ASSERT(wellLogPlot);
depthValues = wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH ? geomExtractor->measuredDepth() : geomExtractor->trueVerticalDepth(); measuredDepthValues = geomExtractor->measuredDepth();
if (wellLogPlot->depthType() == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
{
tvDepthValues = geomExtractor->trueVerticalDepth();
}
m_geomResultDefinition->loadResult(); m_geomResultDefinition->loadResult();
geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, &values); geomExtractor->curveData(m_geomResultDefinition->resultAddress(), m_timeStep, &values);
@@ -233,9 +243,13 @@ void RimWellLogExtractionCurve::updatePlotData()
m_curveData = new RigWellLogCurveData; m_curveData = new RigWellLogCurveData;
if (values.size() == depthValues.size()) if (!tvDepthValues.size())
{ {
m_curveData->setPoints(values, depthValues); m_curveData->setValuesAndMD(values, measuredDepthValues);
}
else
{
m_curveData->setValuesWithTVD(values, measuredDepthValues, tvDepthValues);
} }
m_plotCurve->setCurveData(m_curveData.p()); m_plotCurve->setCurveData(m_curveData.p());

View File

@@ -86,7 +86,7 @@ void RimWellLogFileCurve::updatePlotData()
if (values.size() == depthValues.size()) if (values.size() == depthValues.size())
{ {
m_curveData->setPoints(values, depthValues); m_curveData->setValuesAndMD(values, depthValues);
} }
} }

View File

@@ -41,14 +41,32 @@ RigWellLogCurveData::~RigWellLogCurveData()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setPoints(const std::vector<double>& xValues, const std::vector<double>& yValues) void RigWellLogCurveData::setValuesAndMD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths)
{ {
CVF_ASSERT(xValues.size() == yValues.size()); CVF_ASSERT(xValues.size() == measuredDepths.size());
m_xValues = xValues; m_xValues = xValues;
m_yValues = yValues; m_measuredDepths = measuredDepths;
m_tvDepths.clear();
calculateValidPointsIntervals();
calculateIntervalsOfContinousValidValues();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setValuesWithTVD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths)
{
CVF_ASSERT(xValues.size() == measuredDepths.size());
m_xValues = xValues;
m_measuredDepths = measuredDepths;
m_tvDepths = tvDepths;
calculateIntervalsOfContinousValidValues();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -62,26 +80,19 @@ const std::vector<double>& RigWellLogCurveData::xValues() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector<double>& RigWellLogCurveData::yValues() const const std::vector<double>& RigWellLogCurveData::measuredDepths() const
{ {
return m_yValues; return m_measuredDepths;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
const std::vector< std::pair<size_t, size_t> >& RigWellLogCurveData::filteredIntervals() const std::vector<double> RigWellLogCurveData::xPlotValues() const
{
return m_validPointsIntervals;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCurveData::validXValues() const
{ {
std::vector<double> filteredValues; std::vector<double> filteredValues;
getValuesByIntervals(m_xValues, m_validPointsIntervals, &filteredValues); getValuesByIntervals(m_xValues, m_intervalsOfContinousValidValues, &filteredValues);
return filteredValues; return filteredValues;
} }
@@ -89,10 +100,17 @@ std::vector<double> RigWellLogCurveData::validXValues() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCurveData::validYValues() const std::vector<double> RigWellLogCurveData::depthPlotValues() const
{ {
std::vector<double> filteredValues; std::vector<double> filteredValues;
getValuesByIntervals(m_yValues, m_validPointsIntervals, &filteredValues); if (m_tvDepths.size())
{
getValuesByIntervals(m_tvDepths, m_intervalsOfContinousValidValues, &filteredValues);
}
else
{
getValuesByIntervals(m_measuredDepths, m_intervalsOfContinousValidValues, &filteredValues);
}
return filteredValues; return filteredValues;
} }
@@ -100,38 +118,38 @@ std::vector<double> RigWellLogCurveData::validYValues() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::validPointsIntervals() const std::vector< std::pair<size_t, size_t> > RigWellLogCurveData::polylineStartStopIndices() const
{ {
std::vector< std::pair<size_t, size_t> > intervals; std::vector< std::pair<size_t, size_t> > lineStartStopIndices;
computeFilteredIntervals(m_validPointsIntervals, &intervals); computePolyLineStartStopIndices(m_intervalsOfContinousValidValues, &lineStartStopIndices);
return intervals; return lineStartStopIndices;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::calculateValidPointsIntervals() void RigWellLogCurveData::calculateIntervalsOfContinousValidValues()
{ {
std::vector< std::pair<size_t, size_t> > valuesIntervals; std::vector< std::pair<size_t, size_t> > intervalsOfValidValues;
calculateIntervalsOfValidValues(m_xValues, &valuesIntervals); calculateIntervalsOfValidValues(m_xValues, &intervalsOfValidValues);
std::vector< std::pair<size_t, size_t> > pointsIntervals; m_intervalsOfContinousValidValues.clear();
size_t intervalsCount = valuesIntervals.size(); size_t intervalsCount = intervalsOfValidValues.size();
for (size_t intIdx = 0; intIdx < intervalsCount; intIdx++) for (size_t intIdx = 0; intIdx < intervalsCount; intIdx++)
{ {
std::vector< std::pair<size_t, size_t> > depthValuesIntervals; std::vector< std::pair<size_t, size_t> > depthValuesIntervals;
calculateIntervalsOfValidDepthValues(m_yValues, valuesIntervals[intIdx].first, valuesIntervals[intIdx].second, &depthValuesIntervals); splitIntervalAtEmptySpace(m_measuredDepths,
intervalsOfValidValues[intIdx].first, intervalsOfValidValues[intIdx].second,
&depthValuesIntervals);
for (size_t dvintIdx = 0; dvintIdx < depthValuesIntervals.size(); dvintIdx++) for (size_t dvintIdx = 0; dvintIdx < depthValuesIntervals.size(); dvintIdx++)
{ {
pointsIntervals.push_back(depthValuesIntervals[dvintIdx]); m_intervalsOfContinousValidValues.push_back(depthValuesIntervals[dvintIdx]);
} }
} }
m_validPointsIntervals = pointsIntervals;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -171,18 +189,18 @@ void RigWellLogCurveData::calculateIntervalsOfValidValues(const std::vector<doub
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// /// Splits the start stop interval between cells that are not close enough.
/// The depth values are expected to contain pair of depths: Depth at cell enter, and cell leave
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::calculateIntervalsOfValidDepthValues(const std::vector<double>& depthValues, size_t startIdx, size_t stopIdx, std::vector< std::pair<size_t, size_t> >* intervals) void RigWellLogCurveData::splitIntervalAtEmptySpace(const std::vector<double>& depthValues,
size_t startIdx, size_t stopIdx,
std::vector< std::pair<size_t, size_t> >* intervals)
{ {
CVF_ASSERT(intervals); CVF_ASSERT(intervals);
if (startIdx > stopIdx) CVF_ASSERT(startIdx < stopIdx);
{
return;
}
if (startIdx == stopIdx || stopIdx - startIdx == 1) if (stopIdx - startIdx == 1)
{ {
intervals->push_back(std::make_pair(startIdx, stopIdx)); intervals->push_back(std::make_pair(startIdx, stopIdx));
return; return;
@@ -212,7 +230,9 @@ void RigWellLogCurveData::calculateIntervalsOfValidDepthValues(const std::vector
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::getValuesByIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues) void RigWellLogCurveData::getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues)
{ {
CVF_ASSERT(filteredValues); CVF_ASSERT(filteredValues);
@@ -228,7 +248,8 @@ void RigWellLogCurveData::getValuesByIntervals(const std::vector<double>& values
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::computeFilteredIntervals(const std::vector< std::pair<size_t, size_t> >& intervals, std::vector< std::pair<size_t, size_t> >* fltrIntervals) void RigWellLogCurveData::computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* fltrIntervals)
{ {
CVF_ASSERT(fltrIntervals); CVF_ASSERT(fltrIntervals);

View File

@@ -35,31 +35,41 @@ public:
RigWellLogCurveData(); RigWellLogCurveData();
virtual ~RigWellLogCurveData(); virtual ~RigWellLogCurveData();
void setPoints(const std::vector<double>& xValues, const std::vector<double>& yValues); void setValuesAndMD(const std::vector<double>& xValues, const std::vector<double>& measuredDepths);
void setValuesWithTVD(const std::vector<double>& xValues, const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths );
bool depthRange(double* minimumDepth, double* maximumDepth) const; bool depthRange(double* minimumDepth, double* maximumDepth) const;
const std::vector<double>& xValues() const; const std::vector<double>& xValues() const;
const std::vector<double>& yValues() const; const std::vector<double>& measuredDepths() const;
const std::vector< std::pair<size_t, size_t> >& filteredIntervals() const;
std::vector<double> validXValues() const; std::vector<double> xPlotValues() const;
std::vector<double> validYValues() const; std::vector<double> depthPlotValues() const;
std::vector< std::pair<size_t, size_t> > validPointsIntervals() const; std::vector< std::pair<size_t, size_t> > polylineStartStopIndices() const;
private: private:
void calculateValidPointsIntervals(); void calculateIntervalsOfContinousValidValues();
static void calculateIntervalsOfValidValues(const std::vector<double>& values, std::vector< std::pair<size_t, size_t> >* intervals); static void calculateIntervalsOfValidValues(const std::vector<double>& values,
static void calculateIntervalsOfValidDepthValues(const std::vector<double>& depthValues, size_t startIdx, size_t stopIdx, std::vector< std::pair<size_t, size_t> >* intervals); std::vector< std::pair<size_t, size_t> >* intervals);
static void getValuesByIntervals(const std::vector<double>& values, const std::vector< std::pair<size_t, size_t> >& intervals, std::vector<double>* filteredValues); static void splitIntervalAtEmptySpace(const std::vector<double>& depthValues,
static void computeFilteredIntervals(const std::vector< std::pair<size_t, size_t> >& intervals, std::vector< std::pair<size_t, size_t> >* filteredIntervals); size_t startIdx, size_t stopIdx,
std::vector< std::pair<size_t, size_t> >* intervals);
static void getValuesByIntervals(const std::vector<double>& values,
const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector<double>* filteredValues);
static void computePolyLineStartStopIndices(const std::vector< std::pair<size_t, size_t> >& intervals,
std::vector< std::pair<size_t, size_t> >* filteredIntervals);
private: private:
std::vector<double> m_xValues; std::vector<double> m_xValues;
std::vector<double> m_yValues; std::vector<double> m_measuredDepths;
std::vector< std::pair<size_t, size_t> > m_validPointsIntervals; std::vector<double> m_tvDepths;
friend class RigWellLogCurveDataTestInterface; std::vector< std::pair<size_t, size_t> > m_intervalsOfContinousValidValues;
friend class RigWellLogCurveDataTestInterface;
}; };
//================================================================================================== //==================================================================================================

View File

@@ -270,7 +270,7 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogPlotCurve* curve, const QSt
wellLogChannelName.replace(".", "_"); wellLogChannelName.replace(".", "_");
NRLib::LasWell lasFile; NRLib::LasWell lasFile;
lasFile.AddLog("DEPTH", "M", "Depth [M]", curveData->yValues()); lasFile.AddLog("DEPTH", "M", "Depth [M]", curveData->measuredDepths());
lasFile.AddLog(wellLogChannelName.toStdString(), "NO_UNIT", "", wellLogValues); lasFile.AddLog(wellLogChannelName.toStdString(), "NO_UNIT", "", wellLogValues);
lasFile.SetMissing(absentValue); lasFile.SetMissing(absentValue);

View File

@@ -43,12 +43,12 @@ void RiuWellLogPlotCurve::drawCurve(QPainter* p, int style,
const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to) const const QRectF& canvasRect, int from, int to) const
{ {
size_t intervalCount = m_intervals.size(); size_t intervalCount = m_polyLineStartStopIndices.size();
if (intervalCount > 0) if (intervalCount > 0)
{ {
for (size_t intIdx = 0; intIdx < intervalCount; intIdx++) for (size_t intIdx = 0; intIdx < intervalCount; intIdx++)
{ {
QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_intervals[intIdx].first, (int) m_intervals[intIdx].second); QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, (int) m_polyLineStartStopIndices[intIdx].first, (int) m_polyLineStartStopIndices[intIdx].second);
} }
} }
else QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to); else QwtPlotCurve::drawCurve(p, style, xMap, yMap, canvasRect, from, to);
@@ -61,9 +61,9 @@ void RiuWellLogPlotCurve::setCurveData(const RigWellLogCurveData* curveData)
{ {
CVF_ASSERT(curveData); CVF_ASSERT(curveData);
std::vector<double> validXValues = curveData->validXValues(); std::vector<double> validXValues = curveData->xPlotValues();
std::vector<double> validYValues = curveData->validYValues(); std::vector<double> validYValues = curveData->depthPlotValues();
setSamples(validXValues.data(), validYValues.data(), (int) validXValues.size()); setSamples(validXValues.data(), validYValues.data(), (int) validXValues.size());
m_intervals = curveData->validPointsIntervals(); m_polyLineStartStopIndices = curveData->polylineStartStopIndices();
} }

View File

@@ -45,5 +45,5 @@ protected:
const QRectF& canvasRect, int from, int to) const; const QRectF& canvasRect, int from, int to) const;
private: private:
std::vector< std::pair<size_t, size_t> > m_intervals; std::vector< std::pair<size_t, size_t> > m_polyLineStartStopIndices;
}; };