#7765 Well Log Curves : Improve handling of units

This commit is contained in:
Magne Sjaastad 2021-06-09 14:51:26 +02:00
parent be160a9fe6
commit 8259220abd
11 changed files with 84 additions and 49 deletions

View File

@ -194,6 +194,52 @@ QString RiaDefines::mockModelBasicInputCase()
return "Input Mock Debug Model Simple";
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::DepthUnitType RiaDefines::fromEclipseUnit( EclipseUnitSystem eclipseUnit )
{
switch ( eclipseUnit )
{
case RiaDefines::EclipseUnitSystem::UNITS_METRIC:
return DepthUnitType::UNIT_METER;
break;
case RiaDefines::EclipseUnitSystem::UNITS_FIELD:
return DepthUnitType::UNIT_FEET;
break;
case RiaDefines::EclipseUnitSystem::UNITS_LAB:
break;
case RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN:
break;
default:
break;
}
return DepthUnitType::UNIT_NONE;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::EclipseUnitSystem RiaDefines::fromDepthUnit( DepthUnitType depthUnit )
{
switch ( depthUnit )
{
case RiaDefines::DepthUnitType::UNIT_METER:
return RiaDefines::EclipseUnitSystem::UNITS_METRIC;
break;
case RiaDefines::DepthUnitType::UNIT_FEET:
return RiaDefines::EclipseUnitSystem::UNITS_FIELD;
break;
case RiaDefines::DepthUnitType::UNIT_NONE:
break;
default:
break;
}
return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -94,6 +94,9 @@ enum class DepthUnitType
UNIT_NONE
};
DepthUnitType fromEclipseUnit( EclipseUnitSystem eclipseUnit );
EclipseUnitSystem fromDepthUnit( DepthUnitType depthUnit );
// Depth types used for well log plots
enum class DepthTypeEnum
{

View File

@ -46,31 +46,6 @@ double RiaEclipseUnitTools::darcysConstant( RiaDefines::EclipseUnitSystem unitSy
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::DepthUnitType RiaEclipseUnitTools::depthUnit( RiaDefines::EclipseUnitSystem unit )
{
switch ( unit )
{
case RiaDefines::EclipseUnitSystem::UNITS_METRIC:
return RiaDefines::DepthUnitType::UNIT_METER;
break;
case RiaDefines::EclipseUnitSystem::UNITS_FIELD:
return RiaDefines::DepthUnitType::UNIT_FEET;
break;
case RiaDefines::EclipseUnitSystem::UNITS_LAB:
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
case RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN:
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
default:
return RiaDefines::DepthUnitType::UNIT_NONE;
break;
}
}
//--------------------------------------------------------------------------------------------------
/// Convert Gas to oil equivalents
/// If field unit, the Gas is in Mega ft^3 while the others are in [stb] (barrel)

View File

@ -44,8 +44,6 @@ public:
static double darcysConstant( RiaDefines::EclipseUnitSystem unitSystem );
static RiaDefines::DepthUnitType depthUnit( RiaDefines::EclipseUnitSystem unit );
static double convertSurfaceGasFlowRateToOilEquivalents( RiaDefines::EclipseUnitSystem, double eclGasFlowRate );
static QString unitStringPressure( RiaDefines::EclipseUnitSystem unitSystem );

View File

@ -19,6 +19,8 @@
#include "RicWellLogTools.h"
#include "RiaGuiApplication.h"
#include "RigEclipseCaseData.h"
#include "RigWellLogCurveData.h"
#include "Rim3dView.h"
@ -181,7 +183,16 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack*
bool showPlotWindow )
{
CVF_ASSERT( plotTrack );
RiaDefines::DepthUnitType defaultDepthUnit = RiaDefines::DepthUnitType::UNIT_METER;
if ( auto eclipseCase = dynamic_cast<RimEclipseCase*>( caseToApply ) )
{
defaultDepthUnit = RiaDefines::fromEclipseUnit( eclipseCase->eclipseCaseData()->unitsType() );
}
ExtractionCurveType* curve = new ExtractionCurveType();
curve->setDepthUnit( defaultDepthUnit );
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() );
curve->setColor( curveColor );

View File

@ -167,19 +167,8 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
{
if ( source.wellLogFile()->wellLogFileData() )
{
// Todo: Handle different units in the relevant las channels
switch ( source.wellLogFile()->wellLogFileData()->depthUnit() )
{
case RiaDefines::DepthUnitType::UNIT_METER:
presentUnitSystems.insert( RiaDefines::EclipseUnitSystem::UNITS_METRIC );
break;
case RiaDefines::DepthUnitType::UNIT_FEET:
presentUnitSystems.insert( RiaDefines::EclipseUnitSystem::UNITS_FIELD );
break;
case RiaDefines::DepthUnitType::UNIT_NONE:
presentUnitSystems.insert( RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN );
break;
}
auto eclipseUnit = RiaDefines::fromDepthUnit( source.wellLogFile()->wellLogFileData()->depthUnit() );
presentUnitSystems.insert( eclipseUnit );
}
}
}
@ -654,14 +643,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
std::vector<double> depthValues = wellLogFileData->depthValues();
RiaDefines::EclipseUnitSystem unitSystem = RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN;
{
RiaDefines::DepthUnitType depthUnit = wellLogFileData->depthUnit();
if ( depthUnit == RiaDefines::DepthUnitType::UNIT_FEET )
unitSystem = RiaDefines::EclipseUnitSystem::UNITS_FIELD;
if ( depthUnit == RiaDefines::DepthUnitType::UNIT_METER )
unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC;
}
RiaDefines::EclipseUnitSystem unitSystem = RiaDefines::fromDepthUnit( wellLogFileData->depthUnit() );
for ( const ChannelValNameIdxTuple& channelInfo : sortedChannels )
{

View File

@ -64,6 +64,14 @@ RimWellLogCurve::~RimWellLogCurve()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
{
m_curveData->setDepthUnit( depthUnit );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -40,6 +40,8 @@ public:
RimWellLogCurve();
~RimWellLogCurve() override;
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
bool xValueRangeInData( double* minimumValue, double* maximumValue ) const;
bool yValueRangeInData( double* minimumValue, double* maximumValue ) const;

View File

@ -456,7 +456,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot )
measuredDepthVector,
tvDepthVector,
rkbDiff,
RiaEclipseUnitTools::depthUnit( unitSystem ),
RiaDefines::fromEclipseUnit( unitSystem ),
false );
RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER;

View File

@ -45,6 +45,14 @@ RigWellLogCurveData::~RigWellLogCurveData()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWellLogCurveData::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
{
m_depthUnit = depthUnit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -41,6 +41,8 @@ public:
RigWellLogCurveData();
~RigWellLogCurveData() override;
void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
void setValuesAndDepths( const std::vector<double>& xValues,
const std::vector<double>& depths,
RiaDefines::DepthTypeEnum depthType,