Skip to content

Commit

Permalink
(#538) Support both meter and feet in LAS export
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Dec 2, 2015
1 parent d18e8f7 commit de14b93
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions ApplicationCode/ProjectDataModel/RimWellLogCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ class RimWellLogCurve : public caf::PdmObject
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;
Expand Down
48 changes: 24 additions & 24 deletions ApplicationCode/ReservoirDataModel/RigWellLogFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down Expand Up @@ -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>();
Expand Down Expand Up @@ -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);

Expand All @@ -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");

Expand Down
4 changes: 2 additions & 2 deletions ApplicationCode/ReservoirDataModel/RigWellLogFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class RigWellLogFile : public cvf::Object
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;
Expand Down

0 comments on commit de14b93

Please sign in to comment.