mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#498) Picking and displaying well log channel unit from LAS files
This commit is contained in:
parent
22d033669d
commit
5e8a6d90cd
@ -92,10 +92,14 @@ void RicAddWellLogToPlotFeature::onActionTriggered(bool isChecked)
|
||||
RimWellLogFileCurve* curve = new RimWellLogFileCurve;
|
||||
plotTrack->addCurve(curve);
|
||||
|
||||
RigWellLogFile* wellLogDataFile = wellLogFile->wellLogFile();
|
||||
CVF_ASSERT(wellLogDataFile);
|
||||
|
||||
cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromIndex(curveIdx);
|
||||
curve->setColor(curveColor);
|
||||
curve->setWellPath(wellPath);
|
||||
curve->setWellLogChannelName(wellLog->name());
|
||||
curve->setWellLogChannelUnit(wellLogDataFile->wellLogChannelUnit(wellLog->name()));
|
||||
|
||||
curve->updatePlotData();
|
||||
|
||||
|
@ -112,6 +112,14 @@ void RimWellLogFileCurve::setWellLogChannelName(const QString& name)
|
||||
m_wellLogChannnelName = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogFileCurve::setWellLogChannelUnit(const QString& name)
|
||||
{
|
||||
m_wellLogChannnelUnit = name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -246,6 +254,11 @@ QString RimWellLogFileCurve::createCurveName()
|
||||
txt += " : ";
|
||||
txt += m_wellLogChannnelName;
|
||||
|
||||
if (!m_wellLogChannnelUnit().isEmpty())
|
||||
{
|
||||
txt += QString(" [%1]").arg(m_wellLogChannnelUnit);
|
||||
}
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
void setWellPath(RimWellPath* wellPath);
|
||||
void setWellLogChannelName(const QString& name);
|
||||
void setWellLogChannelUnit(const QString& name);
|
||||
|
||||
// Overrides from RimWellLogPlotCurve
|
||||
virtual void updatePlotData();
|
||||
@ -60,6 +61,7 @@ protected:
|
||||
protected:
|
||||
caf::PdmPtrField<RimWellPath*> m_wellPath;
|
||||
caf::PdmField<QString> m_wellLogChannnelName;
|
||||
caf::PdmField<QString> m_wellLogChannnelUnit;
|
||||
};
|
||||
|
||||
|
||||
|
@ -172,3 +172,25 @@ QString RigWellLogFile::depthUnit() const
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) const
|
||||
{
|
||||
QString unit;
|
||||
|
||||
NRLib::LasWell* lasWell = dynamic_cast<NRLib::LasWell*>(m_wellLogFile);
|
||||
if (lasWell)
|
||||
{
|
||||
unit = QString::fromStdString(lasWell->unitName(wellLogChannelName.toStdString()));
|
||||
}
|
||||
|
||||
// Special handling of depth unit - we convert depth to meter
|
||||
if (unit == depthUnit())
|
||||
{
|
||||
return "m";
|
||||
}
|
||||
|
||||
return unit;
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
std::vector<double> values(const QString& name) const;
|
||||
|
||||
QString depthUnit() const;
|
||||
QString wellLogChannelUnit(const QString& wellLogChannelName) const;
|
||||
|
||||
private:
|
||||
void close();
|
||||
|
16
ThirdParty/NRLib/nrlib/well/laswell.cpp
vendored
16
ThirdParty/NRLib/nrlib/well/laswell.cpp
vendored
@ -335,6 +335,7 @@ LasWell::ParseCurveInformation(std::ifstream & fin,
|
||||
else {
|
||||
log_name_.push_back(token);
|
||||
log_unit_.push_back(unit);
|
||||
logUnitMap_[token] = unit;
|
||||
std::string comment = NRLib::Chomp(line.substr(start_pos+1));
|
||||
log_comment_.push_back(comment);
|
||||
}
|
||||
@ -533,3 +534,18 @@ void LasWell::WriteLasLine(std::ofstream & file,
|
||||
file << mnemonic << " ." << units << " " << data << " : " << description << "\n";
|
||||
}
|
||||
|
||||
std::string LasWell::depthUnit() const
|
||||
{
|
||||
return depth_unit_;
|
||||
};
|
||||
|
||||
std::string LasWell::unitName(const std::string& logName) const
|
||||
{
|
||||
std::map<std::string, std::string >::const_iterator it = logUnitMap_.find(logName);
|
||||
if (it != logUnitMap_.end())
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
5
ThirdParty/NRLib/nrlib/well/laswell.hpp
vendored
5
ThirdParty/NRLib/nrlib/well/laswell.hpp
vendored
@ -50,7 +50,8 @@ public:
|
||||
void WriteToFile(const std::string & filename,
|
||||
const std::vector<std::string> & comment_header);
|
||||
|
||||
std::string depthUnit() const { return depth_unit_; };
|
||||
std::string depthUnit() const;
|
||||
std::string unitName(const std::string& logName) const;
|
||||
|
||||
private:
|
||||
void ReadHeader(const std::string & filename,
|
||||
@ -129,6 +130,8 @@ private:
|
||||
std::vector<std::string> well_info_; //Unused well keywords, only read from file and rewritten.
|
||||
std::vector<std::string> parameter_info_; //Not used, only read from file and rewritten.
|
||||
std::vector<std::string> other_info_; //Not used, only read from file and rewritten.
|
||||
|
||||
std::map<std::string, std::string> logUnitMap_; // Log name/unit map
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user