(#538) Added DepthUnitType enum containing meter and feet

This commit is contained in:
Magne Sjaastad 2015-12-02 12:19:35 +01:00
parent 76a90b04c8
commit fe261560bd
8 changed files with 76 additions and 12 deletions

View File

@ -44,6 +44,14 @@ namespace caf
setDefault(RimDefines::MATRIX_MODEL);
}
template<>
void caf::AppEnum< RimDefines::DepthUnitType >::setUp()
{
addItem(RimDefines::UNIT_METER, "UNIT_METER", "Meter");
addItem(RimDefines::UNIT_FEET, "UNIT_FEET", "Feet");
setDefault(RimDefines::UNIT_METER);
}
}

View File

@ -71,5 +71,11 @@ public:
static QString mockModelCustomized() { return "Result Mock Debug Model Customized"; }
static QString mockModelBasicInputCase() { return "Input Mock Debug Model Simple"; }
enum DepthUnitType
{
UNIT_METER,
UNIT_FEET
};
};

View File

@ -199,6 +199,8 @@ void RimWellLogExtractionCurve::updatePlotData()
std::vector<double> measuredDepthValues;
std::vector<double> tvDepthValues;
RimDefines::DepthUnitType depthUnit = RimDefines::UNIT_METER;
if (eclExtractor.notNull())
{
RimWellLogPlot* wellLogPlot;
@ -224,6 +226,14 @@ void RimWellLogExtractionCurve::updatePlotData()
{
eclExtractor->curveData(resAcc.p(), &values);
}
RigCaseData::UnitsType eclipseUnitsType = eclipseCase->reservoirData()->unitsType();
if (eclipseUnitsType == RigCaseData::UNITS_FIELD)
{
// See https://github.com/OPM/ResInsight/issues/538
depthUnit = RimDefines::UNIT_FEET;
}
}
else if (geomExtractor.notNull()) // geomExtractor
{
@ -247,11 +257,11 @@ void RimWellLogExtractionCurve::updatePlotData()
{
if (!tvDepthValues.size())
{
m_curveData->setValuesAndMD(values, measuredDepthValues, true);
m_curveData->setValuesAndMD(values, measuredDepthValues, depthUnit, true);
}
else
{
m_curveData->setValuesWithTVD(values, measuredDepthValues, tvDepthValues);
m_curveData->setValuesWithTVD(values, measuredDepthValues, tvDepthValues, depthUnit);
}
}

View File

@ -103,7 +103,7 @@ void RimWellLogFileCurve::updatePlotData()
if (values.size() == depthValues.size())
{
m_curveData->setValuesAndMD(values, depthValues, false);
m_curveData->setValuesAndMD(values, depthValues, wellLogFile->depthUnit(), false);
}
}
@ -257,7 +257,7 @@ QString RimWellLogFileCurve::createCurveName()
RigWellLogFile* wellLogFile = logFileInfo ? logFileInfo->wellLogFile() : NULL;
if (wellLogFile)
{
QString unitName = wellLogFile->wellLogChannelUnit(m_wellLogChannnelName);
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannnelName);
if (!unitName.isEmpty())
{
txt += QString(" [%1]").arg(unitName);

View File

@ -32,6 +32,7 @@
RigWellLogCurveData::RigWellLogCurveData()
{
m_isExtractionCurve = false;
m_depthUnit = RimDefines::UNIT_METER;
}
//--------------------------------------------------------------------------------------------------
@ -46,6 +47,7 @@ RigWellLogCurveData::~RigWellLogCurveData()
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setValuesAndMD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
RimDefines::DepthUnitType depthUnit,
bool isExtractionCurve)
{
CVF_ASSERT(xValues.size() == measuredDepths.size());
@ -53,6 +55,7 @@ void RigWellLogCurveData::setValuesAndMD(const std::vector<double>& xValues,
m_xValues = xValues;
m_measuredDepths = measuredDepths;
m_tvDepths.clear();
m_depthUnit = depthUnit;
// Disable depth value filtering is intended to be used for
// extraction curve data
@ -66,13 +69,15 @@ void RigWellLogCurveData::setValuesAndMD(const std::vector<double>& xValues,
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setValuesWithTVD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths)
const std::vector<double>& tvDepths,
RimDefines::DepthUnitType depthUnit)
{
CVF_ASSERT(xValues.size() == measuredDepths.size());
m_xValues = xValues;
m_measuredDepths = measuredDepths;
m_tvDepths = tvDepths;
m_depthUnit = depthUnit;
// Always use value filtering when TVD is present
m_isExtractionCurve = true;
@ -243,3 +248,11 @@ bool RigWellLogCurveData::calculateMDRange(double* minimumDepth, double* maximum
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDefines::DepthUnitType RigWellLogCurveData::depthUnit() const
{
return m_depthUnit;
}

View File

@ -19,6 +19,8 @@
#pragma once
#include "RimDefines.h"
#include "cvfBase.h"
#include "cvfObject.h"
@ -37,15 +39,20 @@ public:
void setValuesAndMD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
RimDefines::DepthUnitType depthUnit,
bool isExtractionCurve);
void setValuesWithTVD(const std::vector<double>& xValues,
const std::vector<double>& measuredDepths,
const std::vector<double>& tvDepths );
const std::vector<double>& tvDepths,
RimDefines::DepthUnitType depthUnit);
const std::vector<double>& xValues() const;
const std::vector<double>& measuredDepths() const;
bool calculateMDRange(double* minMD, double* maxMD) const;
RimDefines::DepthUnitType depthUnit() const;
std::vector<double> xPlotValues() const;
std::vector<double> depthPlotValues() const;
std::vector< std::pair<size_t, size_t> > polylineStartStopIndices() const;
@ -63,5 +70,7 @@ private:
bool m_isExtractionCurve;
std::vector< std::pair<size_t, size_t> > m_intervalsOfContinousValidValues;
RimDefines::DepthUnitType m_depthUnit;
};

View File

@ -172,7 +172,7 @@ std::vector<double> RigWellLogFile::values(const QString& name) const
if (m_wellLogFile->HasContLog(name.toStdString()))
{
if (name == m_depthLogName && (depthUnit().toUpper() == "F" || depthUnit().toUpper() == "FT"))
if (name == m_depthLogName && (depthUnitString().toUpper() == "F" || depthUnitString().toUpper() == "FT"))
{
std::vector<double> footValues = m_wellLogFile->GetContLog(name.toStdString());
@ -207,7 +207,7 @@ std::vector<double> RigWellLogFile::values(const QString& name) const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigWellLogFile::depthUnit() const
QString RigWellLogFile::depthUnitString() const
{
QString unit;
@ -223,7 +223,7 @@ QString RigWellLogFile::depthUnit() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) const
QString RigWellLogFile::wellLogChannelUnitString(const QString& wellLogChannelName) const
{
QString unit;
@ -234,7 +234,7 @@ QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) co
}
// Special handling of depth unit - we convert depth to meter
if (unit == depthUnit())
if (unit == depthUnitString())
{
return "m";
}
@ -298,3 +298,18 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString
return true;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimDefines::DepthUnitType RigWellLogFile::depthUnit() const
{
RimDefines::DepthUnitType unitType = RimDefines::UNIT_METER;
if (depthUnitString().toUpper() == "F" || depthUnitString().toUpper() == "FT")
{
unitType = RimDefines::UNIT_FEET;
}
return unitType;
}

View File

@ -19,6 +19,8 @@
#pragma once
#include "RimDefines.h"
#include "cvfBase.h"
#include "cvfObject.h"
@ -49,8 +51,9 @@ public:
std::vector<double> depthValues() const;
std::vector<double> values(const QString& name) const;
QString depthUnit() const;
QString wellLogChannelUnit(const QString& wellLogChannelName) const;
QString depthUnitString() const;
QString wellLogChannelUnitString(const QString& wellLogChannelName) const;
RimDefines::DepthUnitType depthUnit() const;
static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName);