#5164 Fix crash when adding LAS curve and support TVDRKB from LAS-files

This commit is contained in:
Gaute Lindkvist
2020-01-22 13:20:18 +01:00
parent df5ba4c0d1
commit 1c283d9c2d
5 changed files with 116 additions and 82 deletions

View File

@@ -345,13 +345,16 @@ void RigLasFileExporter::wellPathsAndRkbDiff( std::vector<QString>* wellNames, s
for ( auto metaData : lasFileDescriptions )
{
QString wellName = metaData.wellName();
if ( uniqueWellNames.find( wellName ) == uniqueWellNames.end() )
if ( metaData.rkbDiff() != std::numeric_limits<double>::infinity() )
{
uniqueWellNames.insert( wellName );
QString wellName = metaData.wellName();
if ( uniqueWellNames.find( wellName ) == uniqueWellNames.end() )
{
uniqueWellNames.insert( wellName );
wellNames->push_back( wellName );
rkbDiffs->push_back( metaData.rkbDiff() );
wellNames->push_back( wellName );
rkbDiffs->push_back( metaData.rkbDiff() );
}
}
}
}

View File

@@ -105,20 +105,34 @@ const std::vector<double>& RigWellLogCurveData::xValues() const
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogCurveData::depths( RiaDefines::DepthTypeEnum depthType ) const
{
if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH_RKB && m_rkbDiff != 0.0 )
auto it = m_depths.find( depthType );
if ( it != m_depths.end() )
{
std::vector<double> tvds = depths( RiaDefines::TRUE_VERTICAL_DEPTH );
for ( double& tvdValue : tvds )
return it->second;
}
if ( m_rkbDiff != 0.0 )
{
if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH_RKB && m_depths.count( RiaDefines::TRUE_VERTICAL_DEPTH ) )
{
tvdValue += m_rkbDiff;
std::vector<double> tvds = depths( RiaDefines::TRUE_VERTICAL_DEPTH );
for ( double& tvdValue : tvds )
{
tvdValue += m_rkbDiff;
}
return tvds;
}
else if ( depthType == RiaDefines::TRUE_VERTICAL_DEPTH && m_depths.count( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ) )
{
std::vector<double> tvds = depths( RiaDefines::TRUE_VERTICAL_DEPTH_RKB );
for ( double& tvdValue : tvds )
{
tvdValue -= m_rkbDiff;
}
return tvds;
}
return tvds;
}
else
{
auto it = m_depths.find( depthType );
return it != m_depths.end() ? it->second : std::vector<double>();
}
return std::vector<double>();
}
//--------------------------------------------------------------------------------------------------
@@ -131,11 +145,22 @@ std::set<RiaDefines::DepthTypeEnum> RigWellLogCurveData::availableDepthTypes() c
for ( auto depthValuePair : m_depths )
{
depthTypes.insert( depthValuePair.first );
if ( depthValuePair.first == RiaDefines::TRUE_VERTICAL_DEPTH && m_rkbDiff != 0.0 )
}
if ( m_rkbDiff != 0.0 )
{
if ( depthTypes.count( RiaDefines::TRUE_VERTICAL_DEPTH ) &&
!depthTypes.count( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ) )
{
depthTypes.insert( RiaDefines::TRUE_VERTICAL_DEPTH_RKB );
}
else if ( depthTypes.count( RiaDefines::TRUE_VERTICAL_DEPTH_RKB ) &&
!depthTypes.count( RiaDefines::TRUE_VERTICAL_DEPTH ) )
{
depthTypes.insert( RiaDefines::TRUE_VERTICAL_DEPTH );
}
}
return depthTypes;
}

View File

@@ -104,6 +104,10 @@ bool RigWellLogFile::open( const QString& fileName, QString* errorMessage )
{
m_tvdMslLogName = logName;
}
else if ( logName.toUpper() == "TVDRKB" )
{
m_tvdRkbLogName = logName;
}
}
m_wellLogChannelNames = wellLogNames;
@@ -169,6 +173,14 @@ std::vector<double> RigWellLogFile::tvdMslValues() const
return values( m_tvdMslLogName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<double> RigWellLogFile::tvdRkbValues() const
{
return values( m_tvdRkbLogName );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -251,11 +263,19 @@ QString RigWellLogFile::wellLogChannelUnitString( const QString& well
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogFile::hasTvdChannel() const
bool RigWellLogFile::hasTvdMslChannel() const
{
return !m_tvdMslLogName.isEmpty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogFile::hasTvdRkbChannel() const
{
return !m_tvdRkbLogName.isEmpty();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -50,13 +50,16 @@ public:
std::vector<double> depthValues() const;
std::vector<double> tvdMslValues() const;
std::vector<double> tvdRkbValues() const;
std::vector<double> values( const QString& name ) const;
QString wellLogChannelUnitString( const QString& wellLogChannelName,
RiaDefines::DepthUnitType displayDepthUnit ) const;
RiaDefines::DepthUnitType depthUnit() const;
bool hasTvdChannel() const;
bool hasTvdMslChannel() const;
bool hasTvdRkbChannel() const;
private:
void close();
@@ -66,4 +69,5 @@ private:
QStringList m_wellLogChannelNames;
QString m_depthLogName;
QString m_tvdMslLogName;
QString m_tvdRkbLogName;
};