mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2327 Formation RFT Plot: Read tvdss from well pick files
This commit is contained in:
@@ -20,16 +20,14 @@
|
||||
|
||||
#include "QStringList"
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormation>& formations, const QString& filePath,
|
||||
const QString& key)
|
||||
{
|
||||
m_filePath = filePath;
|
||||
m_keyInFile = key;
|
||||
m_filePath = filePath;
|
||||
m_keyInFile = key;
|
||||
|
||||
for (const RigWellPathFormation& formation : formations)
|
||||
{
|
||||
@@ -39,7 +37,7 @@ RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormat
|
||||
}
|
||||
else
|
||||
{
|
||||
FormationLevel level = detectLevel(formation.formationName);
|
||||
FormationLevel level = detectLevel(formation.formationName);
|
||||
m_formationsLevelsPresent[level] = true;
|
||||
|
||||
m_formations.push_back(std::pair<RigWellPathFormation, FormationLevel>(formation, level));
|
||||
@@ -47,74 +45,114 @@ RigWellPathFormations::RigWellPathFormations(const std::vector<RigWellPathFormat
|
||||
}
|
||||
}
|
||||
|
||||
struct MeasuredDepthComp
|
||||
{
|
||||
bool operator()(const double& md1, const double& md2) const
|
||||
{
|
||||
if (cvf::Math::abs(md1 - md2) < 0.1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return md1 < md2;
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths) const
|
||||
void RigWellPathFormations::depthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths,
|
||||
RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
{
|
||||
std::map<double, bool, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
std::map<double, bool, DepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdTop);
|
||||
names->push_back(formation.first.formationName + " Top");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdTop] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdBase))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdBase);
|
||||
names->push_back(formation.first.formationName + " Base");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdBase] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdTop))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.tvdTop);
|
||||
names->push_back(formation.first.formationName + " Top");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdTop] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.tvdBase))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.tvdBase);
|
||||
names->push_back(formation.first.formationName + " Base");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.tvdBase] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdTop))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdTop);
|
||||
double depth;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
depth = formation.first.mdTop;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
depth = formation.first.tvdTop;
|
||||
}
|
||||
else return;
|
||||
|
||||
measuredDepths->push_back(depth);
|
||||
names->push_back(formation.first.formationName + " Top");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdTop] = true;
|
||||
tempMakeVectorUniqueOnMeasuredDepth[depth] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : m_formations)
|
||||
{
|
||||
double depth;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
depth = formation.first.mdBase;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
depth = formation.first.tvdBase;
|
||||
}
|
||||
else return;
|
||||
|
||||
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.first.mdBase))
|
||||
{
|
||||
measuredDepths->push_back(formation.first.mdBase);
|
||||
measuredDepths->push_back(depth);
|
||||
names->push_back(formation.first.formationName + " Base");
|
||||
tempMakeVectorUniqueOnMeasuredDepth[formation.first.mdBase] = true;
|
||||
tempMakeVectorUniqueOnMeasuredDepth[depth] = true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
struct LevelAndName
|
||||
{
|
||||
LevelAndName() {}
|
||||
LevelAndName(RigWellPathFormations::FormationLevel level, QString name) : level(level), name(name) {}
|
||||
|
||||
RigWellPathFormations::FormationLevel level;
|
||||
QString name;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
enum PICK_POSITION
|
||||
{
|
||||
TOP,
|
||||
BASE
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void evaluateFormationsForOnePosition(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations,
|
||||
const RigWellPathFormations::FormationLevel& maxLevel, const PICK_POSITION& position,
|
||||
std::map<double, LevelAndName, MeasuredDepthComp>* uniqueListMaker)
|
||||
void RigWellPathFormations::evaluateFormationsForOnePosition(
|
||||
const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
|
||||
const FormationLevel& maxLevel, const PickPosition& position,
|
||||
std::map<double, LevelAndName, DepthComp>* uniqueListMaker, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
{
|
||||
QString postFix;
|
||||
|
||||
@@ -127,92 +165,134 @@ void evaluateFormationsForOnePosition(const std::vector<std::pair<RigWellPathFor
|
||||
postFix = " Base";
|
||||
}
|
||||
|
||||
for (const std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>& formation : formations)
|
||||
for (const std::pair<RigWellPathFormation, FormationLevel>& formation : formations)
|
||||
{
|
||||
double md;
|
||||
if (position == TOP)
|
||||
double depth;
|
||||
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
md = formation.first.mdTop;
|
||||
if (position == TOP)
|
||||
{
|
||||
depth = formation.first.mdTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
depth = formation.first.mdBase;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
md = formation.first.mdBase;
|
||||
if (position == TOP)
|
||||
{
|
||||
depth = formation.first.tvdTop;
|
||||
}
|
||||
else
|
||||
{
|
||||
depth = formation.first.tvdBase;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
|
||||
if (formation.second > maxLevel) continue;
|
||||
|
||||
if (!uniqueListMaker->count(md) || uniqueListMaker->at(md).level < formation.second)
|
||||
if (!uniqueListMaker->count(depth) || uniqueListMaker->at(depth).level < formation.second)
|
||||
{
|
||||
(*uniqueListMaker)[md] = LevelAndName(formation.second, formation.first.formationName + postFix);
|
||||
(*uniqueListMaker)[depth] = LevelAndName(formation.second, formation.first.formationName + postFix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void evaluateFormations(const std::vector<std::pair<RigWellPathFormation, RigWellPathFormations::FormationLevel>>& formations,
|
||||
const RigWellPathFormations::FormationLevel& maxLevel,
|
||||
std::vector<QString>* names, std::vector<double>* measuredDepths)
|
||||
{
|
||||
std::map<double, LevelAndName, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::TOP, &tempMakeVectorUniqueOnMeasuredDepth);
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PICK_POSITION::BASE, &tempMakeVectorUniqueOnMeasuredDepth);
|
||||
|
||||
for (auto it = tempMakeVectorUniqueOnMeasuredDepth.begin(); it != tempMakeVectorUniqueOnMeasuredDepth.end(); it++)
|
||||
{
|
||||
measuredDepths->push_back(it->first);
|
||||
names->push_back(it->second.name);
|
||||
}
|
||||
}
|
||||
|
||||
void evaluateFluids(const std::vector<RigWellPathFormation>& fluidFormations,
|
||||
std::vector<QString>* names, std::vector<double>* measuredDepths)
|
||||
{
|
||||
|
||||
std::map<double, QString, MeasuredDepthComp> uniqueListMaker;
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
{
|
||||
uniqueListMaker[formation.mdBase] = formation.formationName + " Base";
|
||||
}
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
{
|
||||
uniqueListMaker[formation.mdTop] = formation.formationName + " Top";
|
||||
}
|
||||
|
||||
for (auto it = uniqueListMaker.begin(); it != uniqueListMaker.end(); it++)
|
||||
{
|
||||
measuredDepths->push_back(it->first);
|
||||
names->push_back(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::measuredDepthAndFormationNamesUpToLevel(FormationLevel maxLevel,
|
||||
std::vector<QString>* names,
|
||||
std::vector<double>* measuredDepths, bool includeFluids) const
|
||||
void RigWellPathFormations::evaluateFormations(const std::vector<std::pair<RigWellPathFormation, FormationLevel>>& formations,
|
||||
const FormationLevel& maxLevel, std::vector<QString>* names,
|
||||
std::vector<double>* depths, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
{
|
||||
std::map<double, LevelAndName, DepthComp> tempMakeVectorUniqueOnDepth;
|
||||
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::TOP, &tempMakeVectorUniqueOnDepth, depthType);
|
||||
evaluateFormationsForOnePosition(formations, maxLevel, PickPosition::BASE, &tempMakeVectorUniqueOnDepth, depthType);
|
||||
|
||||
for (const std::pair<double, LevelAndName>& uniqueDepth : tempMakeVectorUniqueOnDepth)
|
||||
{
|
||||
depths->push_back(uniqueDepth.first);
|
||||
names->push_back(uniqueDepth.second.name);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::evaluateFluids(const std::vector<RigWellPathFormation>& fluidFormations, std::vector<QString>* names,
|
||||
std::vector<double>* depths, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
{
|
||||
std::map<double, QString, DepthComp> uniqueListMaker;
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
{
|
||||
double depthBase;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
depthBase = formation.mdBase;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
depthBase = formation.tvdBase;
|
||||
}
|
||||
else return;
|
||||
|
||||
uniqueListMaker[depthBase] = formation.formationName + " Base";
|
||||
}
|
||||
|
||||
for (const RigWellPathFormation& formation : fluidFormations)
|
||||
{
|
||||
double depthTop;
|
||||
if (depthType == RimWellLogPlot::MEASURED_DEPTH)
|
||||
{
|
||||
depthTop = formation.mdTop;
|
||||
}
|
||||
else if (depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH)
|
||||
{
|
||||
depthTop = formation.tvdTop;
|
||||
}
|
||||
else return;
|
||||
|
||||
uniqueListMaker[depthTop] = formation.formationName + " Top";
|
||||
}
|
||||
|
||||
for (const std::pair<double, QString>& depthAndFormation : uniqueListMaker)
|
||||
{
|
||||
depths->push_back(depthAndFormation.first);
|
||||
names->push_back(depthAndFormation.second);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RigWellPathFormations::depthAndFormationNamesUpToLevel(FormationLevel level, std::vector<QString>* names, std::vector<double>* depths,
|
||||
bool includeFluids, RimWellLogPlot::DepthTypeEnum depthType) const
|
||||
{
|
||||
names->clear();
|
||||
measuredDepths->clear();
|
||||
depths->clear();
|
||||
|
||||
if (includeFluids)
|
||||
{
|
||||
evaluateFluids(m_fluids, names, measuredDepths);
|
||||
evaluateFluids(m_fluids, names, depths, depthType);
|
||||
}
|
||||
|
||||
if (maxLevel == RigWellPathFormations::NONE)
|
||||
if (level == RigWellPathFormations::NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else if (maxLevel == RigWellPathFormations::ALL)
|
||||
else if (level == RigWellPathFormations::ALL)
|
||||
{
|
||||
measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(names, measuredDepths);
|
||||
depthAndFormationNamesWithoutDuplicatesOnDepth(names, depths, depthType);
|
||||
}
|
||||
else
|
||||
{
|
||||
evaluateFormations(m_formations, maxLevel, names, measuredDepths);
|
||||
evaluateFormations(m_formations, level, names, depths, depthType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,9 +303,9 @@ std::vector<RigWellPathFormations::FormationLevel> RigWellPathFormations::format
|
||||
{
|
||||
std::vector<RigWellPathFormations::FormationLevel> formationLevels;
|
||||
|
||||
for (auto it = m_formationsLevelsPresent.begin(); it != m_formationsLevelsPresent.end(); it++)
|
||||
for (const std::pair<RigWellPathFormations::FormationLevel, bool>& formationLevel : m_formationsLevelsPresent)
|
||||
{
|
||||
formationLevels.push_back(it->first);
|
||||
formationLevels.push_back(formationLevel.first);
|
||||
}
|
||||
return formationLevels;
|
||||
}
|
||||
@@ -255,7 +335,7 @@ size_t RigWellPathFormations::formationNamesCount() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RigWellPathFormations::isFluid(QString formationName)
|
||||
{
|
||||
@@ -327,7 +407,7 @@ RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString
|
||||
QString levelDescriptor = levelDesctiptorCandidates[0];
|
||||
|
||||
QStringList joinedLevel = levelDescriptor.split('+');
|
||||
if ( joinedLevel.size() > 1 )
|
||||
if (joinedLevel.size() > 1)
|
||||
{
|
||||
levelDescriptor = joinedLevel[0];
|
||||
}
|
||||
@@ -338,16 +418,16 @@ RigWellPathFormations::FormationLevel RigWellPathFormations::detectLevel(QString
|
||||
|
||||
switch (dotCount)
|
||||
{
|
||||
case 0: return RigWellPathFormations::LEVEL1;
|
||||
case 1: return RigWellPathFormations::LEVEL2;
|
||||
case 2: return RigWellPathFormations::LEVEL3;
|
||||
case 3: return RigWellPathFormations::LEVEL4;
|
||||
case 4: return RigWellPathFormations::LEVEL5;
|
||||
case 5: return RigWellPathFormations::LEVEL6;
|
||||
case 6: return RigWellPathFormations::LEVEL7;
|
||||
case 7: return RigWellPathFormations::LEVEL8;
|
||||
case 8: return RigWellPathFormations::LEVEL9;
|
||||
case 9: return RigWellPathFormations::LEVEL10;
|
||||
case 0: return RigWellPathFormations::LEVEL1;
|
||||
case 1: return RigWellPathFormations::LEVEL2;
|
||||
case 2: return RigWellPathFormations::LEVEL3;
|
||||
case 3: return RigWellPathFormations::LEVEL4;
|
||||
case 4: return RigWellPathFormations::LEVEL5;
|
||||
case 5: return RigWellPathFormations::LEVEL6;
|
||||
case 6: return RigWellPathFormations::LEVEL7;
|
||||
case 7: return RigWellPathFormations::LEVEL8;
|
||||
case 8: return RigWellPathFormations::LEVEL9;
|
||||
case 9: return RigWellPathFormations::LEVEL10;
|
||||
default: break;
|
||||
}
|
||||
return RigWellPathFormations::UNKNOWN;
|
||||
|
||||
Reference in New Issue
Block a user