mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5164 Fix crash when adding LAS curve and support TVDRKB from LAS-files
This commit is contained in:
@@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user