(#538) Support both meter and feet in LAS export

This commit is contained in:
Magne Sjaastad 2015-12-02 13:49:36 +01:00
parent d18e8f7bd3
commit de14b93f6b
3 changed files with 28 additions and 28 deletions

View File

@ -83,8 +83,8 @@ protected:
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly);
QPointer<RiuWellLogTrack> m_ownerQwtTrack;
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
QPointer<RiuWellLogTrack> m_ownerQwtTrack;
RiuLineSegmentQwtPlotCurve* m_qwtPlotCurve;
cvf::ref<RigWellLogCurveData> m_curveData;
caf::PdmField<bool> m_showCurve;

View File

@ -30,8 +30,6 @@
#include <exception>
#include <cmath> // Needed for HUGE_VAL on Linux
#define RIG_WELL_FOOTPERMETER 3.2808399
//--------------------------------------------------------------------------------------------------
/// Find the largest possible "ususal" value to use for absent data (-999.25, -9999.25, etc.)
@ -172,33 +170,18 @@ std::vector<double> RigWellLogFile::values(const QString& name) const
if (m_wellLogFile->HasContLog(name.toStdString()))
{
if (name == m_depthLogName && (depthUnitString().toUpper() == "F" || depthUnitString().toUpper() == "FT"))
{
std::vector<double> footValues = m_wellLogFile->GetContLog(name.toStdString());
std::vector<double> meterValues;
meterValues.reserve(footValues.size());
for (size_t vIdx = 0; vIdx < footValues.size(); vIdx++)
{
meterValues.push_back(footValues[vIdx]/RIG_WELL_FOOTPERMETER);
}
return meterValues;
}
std::vector<double> values = m_wellLogFile->GetContLog(name.toStdString());
std::vector<double> logValues = m_wellLogFile->GetContLog(name.toStdString());
for (size_t vIdx = 0; vIdx < values.size(); vIdx++)
for (size_t vIdx = 0; vIdx < logValues.size(); vIdx++)
{
if (m_wellLogFile->IsMissing(values[vIdx]))
if (m_wellLogFile->IsMissing(logValues[vIdx]))
{
// Convert missing ("NULL") values to HUGE_VAL
values[vIdx] = HUGE_VAL;
logValues[vIdx] = HUGE_VAL;
}
}
return values;
return logValues;
}
return std::vector<double>();
@ -279,7 +262,16 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString
NRLib::LasWell lasFile;
lasFile.addWellInfo("WELL", curve->wellName().trimmed().toStdString());
lasFile.addWellInfo("DATE", wellLogDate.toStdString());
lasFile.AddLog("DEPTH", "M", "Depth in meters", curveData->measuredDepths());
if (curveData->depthUnit() == RimDefines::UNIT_METER)
{
lasFile.AddLog("DEPTH", "M", "Depth in meters", curveData->measuredDepths());
}
else if (curveData->depthUnit() == RimDefines::UNIT_FEET)
{
lasFile.AddLog("DEPTH", "FT", "Depth in feet", curveData->measuredDepths());
}
lasFile.AddLog(wellLogChannelName.trimmed().toStdString(), "NO_UNIT", "", wellLogValues);
lasFile.SetMissing(absentValue);
@ -289,7 +281,15 @@ bool RigWellLogFile::exportToLasFile(const RimWellLogCurve* curve, const QString
lasFile.setStartDepth(minDepth);
lasFile.setStopDepth(maxDepth);
lasFile.setDepthUnit("M");
if (curveData->depthUnit() == RimDefines::UNIT_METER)
{
lasFile.setDepthUnit("M");
}
else if (curveData->depthUnit() == RimDefines::UNIT_FEET)
{
lasFile.setDepthUnit("FT");
}
lasFile.setVersionInfo("2.0");

View File

@ -51,14 +51,14 @@ public:
std::vector<double> depthValues() const;
std::vector<double> values(const QString& name) const;
QString depthUnitString() const;
QString wellLogChannelUnitString(const QString& wellLogChannelName) const;
RimDefines::DepthUnitType depthUnit() const;
static bool exportToLasFile(const RimWellLogCurve* curve, const QString& fileName);
private:
void close();
void close();
QString depthUnitString() const;
NRLib::Well* m_wellLogFile;
QStringList m_wellLogChannelNames;