mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2227 Well formations: New Rig data stucture with top+base MD and level
This commit is contained in:
parent
04e5ccfd7e
commit
a2d2879bab
@ -37,19 +37,43 @@ std::map<QString, cvf::ref<RigWellPathFormations>>
|
|||||||
{
|
{
|
||||||
std::map<QString, cvf::ref<RigWellPathFormations>> result;
|
std::map<QString, cvf::ref<RigWellPathFormations>> result;
|
||||||
|
|
||||||
std::map<QString, std::vector<std::pair<double, QString>>> formations;
|
std::vector<QString> wellNames;
|
||||||
|
std::vector<QString> formationNames;
|
||||||
|
std::vector<double> mdTop;
|
||||||
|
std::vector<double> mdBase;
|
||||||
|
|
||||||
readFileIntoMap(filePath, &formations);
|
readFile(filePath, &wellNames, &formationNames, &mdTop, &mdBase);
|
||||||
if (formations.empty())
|
if (wellNames.empty() || formationNames.empty() || mdTop.empty() || mdBase.empty())
|
||||||
{
|
{
|
||||||
QMessageBox::warning(RiuMainWindow::instance(), "Import failure",
|
QMessageBox::warning(RiuMainWindow::instance(), "Import failure",
|
||||||
QString("Failed to parse %1 as well picks file").arg(filePath));
|
QString("Failed to parse %1 as a well pick file").arg(filePath));
|
||||||
RiaLogging::error(QString("Failed to parse %1 as well picks file").arg(filePath));
|
RiaLogging::error(QString("Failed to parse %1 as a well pick file").arg(filePath));
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<QString, std::vector<std::pair<double, QString>>>::iterator it;
|
CVF_ASSERT(wellNames.size() == formationNames.size());
|
||||||
|
CVF_ASSERT(mdTop.size() == formationNames.size());
|
||||||
|
CVF_ASSERT(mdBase.size() == formationNames.size());
|
||||||
|
|
||||||
for (it = formations.begin(); it != formations.end(); it++)
|
std::map<QString, std::vector<RigWellPathFormation>> formations;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < wellNames.size(); i++)
|
||||||
|
{
|
||||||
|
RigWellPathFormation formation;
|
||||||
|
formation.formationName = formationNames[i];
|
||||||
|
formation.mdTop = mdTop[i];
|
||||||
|
formation.mdBase = mdBase[i];
|
||||||
|
|
||||||
|
if (!formations.count(wellNames[i]))
|
||||||
|
{
|
||||||
|
formations[wellNames[i]] = std::vector<RigWellPathFormation>();
|
||||||
|
}
|
||||||
|
|
||||||
|
formations[wellNames[i]].push_back(formation);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = formations.begin(); it != formations.end(); it++)
|
||||||
{
|
{
|
||||||
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations(it->second, filePath, it->first);
|
cvf::ref<RigWellPathFormations> wellPathFormations = new RigWellPathFormations(it->second, filePath, it->first);
|
||||||
result[it->first] = wellPathFormations;
|
result[it->first] = wellPathFormations;
|
||||||
@ -69,8 +93,9 @@ void removeWhiteSpaces(QString* word)
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RifWellPathFormationReader::readFileIntoMap(const QString& filePath,
|
void RifWellPathFormationReader::readFile(const QString& filePath, std::vector<QString>* wellNames,
|
||||||
std::map<QString, std::vector<std::pair<double, QString>>>* formations)
|
std::vector<QString>* formationNames, std::vector<double>* mdTop,
|
||||||
|
std::vector<double>* mdBase)
|
||||||
{
|
{
|
||||||
QFile data(filePath);
|
QFile data(filePath);
|
||||||
|
|
||||||
@ -114,7 +139,9 @@ void RifWellPathFormationReader::readFileIntoMap(const QString&
|
|||||||
QString wellName = dataLine[wellNameIndex];
|
QString wellName = dataLine[wellNameIndex];
|
||||||
QString surfaceName = dataLine[surfaceNameIndex];
|
QString surfaceName = dataLine[surfaceNameIndex];
|
||||||
|
|
||||||
(*formations)[wellName].push_back(std::make_pair(measuredDepth, surfaceName));
|
wellNames->push_back(wellName);
|
||||||
|
formationNames->push_back(surfaceName);
|
||||||
|
mdTop->push_back(measuredDepth);
|
||||||
|
|
||||||
} while (!data.atEnd());
|
} while (!data.atEnd());
|
||||||
|
|
||||||
@ -144,8 +171,10 @@ void RifWellPathFormationReader::readFileIntoMap(const QString&
|
|||||||
double measuredDepthTop = dataLine[measuredDepthTopIndex].toDouble();
|
double measuredDepthTop = dataLine[measuredDepthTopIndex].toDouble();
|
||||||
double measuredDepthBase = dataLine[measuredDepthBaseIndex].toDouble();
|
double measuredDepthBase = dataLine[measuredDepthBaseIndex].toDouble();
|
||||||
|
|
||||||
(*formations)[wellName].push_back(std::make_pair(measuredDepthTop, unitName));
|
wellNames->push_back(wellName);
|
||||||
(*formations)[wellName].push_back(std::make_pair(measuredDepthBase, unitName));
|
formationNames->push_back(unitName);
|
||||||
|
mdTop->push_back(measuredDepthTop);
|
||||||
|
mdBase->push_back(measuredDepthBase);
|
||||||
|
|
||||||
} while (!data.atEnd());
|
} while (!data.atEnd());
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#include "RigWellPathFormations.h"
|
#include "RigWellPathFormations.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "cvfBase.h"
|
#include "cvfBase.h"
|
||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
@ -35,8 +35,9 @@
|
|||||||
class RifWellPathFormationReader
|
class RifWellPathFormationReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::map<QString, cvf::ref<RigWellPathFormations> > readWellFormationsToGeometry(const QString& filePath);
|
static std::map<QString, cvf::ref<RigWellPathFormations>> readWellFormationsToGeometry(const QString& filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void readFileIntoMap(const QString& filePath, std::map<QString, std::vector<std::pair<double, QString>> >* formations);
|
static void readFile(const QString& filePath, std::vector<QString>* wellNames, std::vector<QString>* formationNames,
|
||||||
|
std::vector<double>* mdTop, std::vector<double>* mdBase);
|
||||||
};
|
};
|
||||||
|
@ -1247,7 +1247,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot()
|
|||||||
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
const RigWellPathFormations* formations = m_formationWellPath->formationsGeometry();
|
||||||
if (!formations) return;
|
if (!formations) return;
|
||||||
|
|
||||||
formations->measuredDepthAndFormationNamesWithoutDuplicates(formationNamesToPlot, yValues);
|
formations->measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(&formationNamesToPlot, &yValues);
|
||||||
|
|
||||||
m_annotationTool->attachWellPicks(this->viewer(), formationNamesToPlot, yValues);
|
m_annotationTool->attachWellPicks(this->viewer(), formationNamesToPlot, yValues);
|
||||||
}
|
}
|
||||||
|
@ -337,6 +337,8 @@ void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
|
|||||||
outputMessage += "-----------------------------------------------\n";
|
outputMessage += "-----------------------------------------------\n";
|
||||||
outputMessage += "Well Name \tDetected Well Path \tCount\n";
|
outputMessage += "Well Name \tDetected Well Path \tCount\n";
|
||||||
|
|
||||||
|
bool fileReadSuccess = false;
|
||||||
|
|
||||||
for (QString filePath : filePaths)
|
for (QString filePath : filePaths)
|
||||||
{
|
{
|
||||||
std::map<QString, cvf::ref<RigWellPathFormations>> newFormations =
|
std::map<QString, cvf::ref<RigWellPathFormations>> newFormations =
|
||||||
@ -344,6 +346,8 @@ void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
|
|||||||
|
|
||||||
for (auto it = newFormations.begin(); it != newFormations.end(); it++)
|
for (auto it = newFormations.begin(); it != newFormations.end(); it++)
|
||||||
{
|
{
|
||||||
|
fileReadSuccess = true;
|
||||||
|
|
||||||
RimWellPath* wellPath = tryFindMatchingWellPath(it->first);
|
RimWellPath* wellPath = tryFindMatchingWellPath(it->first);
|
||||||
if (!wellPath)
|
if (!wellPath)
|
||||||
{
|
{
|
||||||
@ -364,8 +368,12 @@ void RimWellPathCollection::addWellPathFormations(const QStringList& filePaths)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
outputMessage += "-----------------------------------------------";
|
outputMessage += "-----------------------------------------------";
|
||||||
|
|
||||||
|
if (fileReadSuccess)
|
||||||
|
{
|
||||||
QMessageBox::information(RiuMainWindow::instance(), "Well Picks Import", outputMessage);
|
QMessageBox::information(RiuMainWindow::instance(), "Well Picks Import", outputMessage);
|
||||||
RiaLogging::info(outputMessage);
|
RiaLogging::info(outputMessage);
|
||||||
|
}
|
||||||
|
|
||||||
this->sortWellsByName();
|
this->sortWellsByName();
|
||||||
}
|
}
|
||||||
|
@ -18,33 +18,59 @@
|
|||||||
|
|
||||||
#include "RigWellPathFormations.h"
|
#include "RigWellPathFormations.h"
|
||||||
|
|
||||||
|
#include "QStringList"
|
||||||
|
|
||||||
|
#include "cvfMath.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RigWellPathFormations::RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames, const QString& filePath, const QString& key)
|
RigWellPathFormations::RigWellPathFormations(std::vector<RigWellPathFormation> formations, const QString& filePath, const QString& key)
|
||||||
{
|
{
|
||||||
m_measuredDepthAndFormationNames = measuredDepthAndFormationNames;
|
|
||||||
m_filePath = filePath;
|
m_filePath = filePath;
|
||||||
m_keyInFile = key;
|
m_keyInFile = key;
|
||||||
|
m_formations = formations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct MeasuredDepthComp
|
||||||
|
{
|
||||||
|
bool operator()(const double& md1, const double& md2) const
|
||||||
|
{
|
||||||
|
if (cvf::Math::abs(md1 - md2) < 1.0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return md1 < md2;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicates(std::vector<QString>& names, std::vector<double>& measuredDepths) const
|
void RigWellPathFormations::measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names, std::vector<double>* measuredDepths) const
|
||||||
{
|
{
|
||||||
names.clear();
|
names->clear();
|
||||||
measuredDepths.clear();
|
measuredDepths->clear();
|
||||||
|
|
||||||
std::map<double, QString> tempMakeVectorUniqueOnMeasuredDepth;
|
std::map<double, bool, MeasuredDepthComp> tempMakeVectorUniqueOnMeasuredDepth;
|
||||||
|
|
||||||
for (const std::pair<double, QString>& mdAndFormName : m_measuredDepthAndFormationNames)
|
for (RigWellPathFormation formation : m_formations)
|
||||||
{
|
{
|
||||||
if (tempMakeVectorUniqueOnMeasuredDepth.find(mdAndFormName.first) == tempMakeVectorUniqueOnMeasuredDepth.end())
|
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.mdTop))
|
||||||
{
|
{
|
||||||
measuredDepths.push_back(mdAndFormName.first);
|
measuredDepths->push_back(formation.mdTop);
|
||||||
names.push_back(mdAndFormName.second);
|
names->push_back(formation.formationName + " Top");
|
||||||
tempMakeVectorUniqueOnMeasuredDepth[mdAndFormName.first] = mdAndFormName.second;
|
tempMakeVectorUniqueOnMeasuredDepth[formation.mdTop] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RigWellPathFormation formation : m_formations)
|
||||||
|
{
|
||||||
|
if (!tempMakeVectorUniqueOnMeasuredDepth.count(formation.mdBase))
|
||||||
|
{
|
||||||
|
measuredDepths->push_back(formation.mdBase);
|
||||||
|
names->push_back(formation.formationName + " Base");
|
||||||
|
tempMakeVectorUniqueOnMeasuredDepth[formation.mdBase] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,5 +96,5 @@ QString RigWellPathFormations::keyInFile() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
size_t RigWellPathFormations::formationNamesCount() const
|
size_t RigWellPathFormations::formationNamesCount() const
|
||||||
{
|
{
|
||||||
return m_measuredDepthAndFormationNames.size();
|
return m_formations.size();
|
||||||
}
|
}
|
||||||
|
@ -22,17 +22,28 @@
|
|||||||
#include "cvfObject.h"
|
#include "cvfObject.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <utility>
|
|
||||||
|
struct RigWellPathFormation
|
||||||
|
{
|
||||||
|
double mdTop;
|
||||||
|
double mdBase;
|
||||||
|
QString formationName;
|
||||||
|
size_t level = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class RigWellPathFormations : public cvf::Object
|
class RigWellPathFormations : public cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RigWellPathFormations(std::vector<std::pair<double, QString>> measuredDepthAndFormationNames, const QString& filePath, const QString& key);
|
RigWellPathFormations(std::vector<RigWellPathFormation> formations, const QString& filePath, const QString& key);
|
||||||
|
|
||||||
void measuredDepthAndFormationNamesWithoutDuplicates(std::vector<QString>& names, std::vector<double>& measuredDepths) const;
|
void measuredDepthAndFormationNamesWithoutDuplicatesOnDepth(std::vector<QString>* names, std::vector<double>* measuredDepths) const;
|
||||||
|
|
||||||
|
void measuredDepthAndFormationNamesForLevel(size_t level, std::vector<QString>* names, std::vector<double>* measuredDepths) const;
|
||||||
|
|
||||||
QString filePath() const;
|
QString filePath() const;
|
||||||
QString keyInFile() const;
|
QString keyInFile() const;
|
||||||
@ -43,5 +54,5 @@ private:
|
|||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
QString m_keyInFile;
|
QString m_keyInFile;
|
||||||
|
|
||||||
std::vector<std::pair<double, QString>> m_measuredDepthAndFormationNames;
|
std::vector<RigWellPathFormation> m_formations;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user