(#541) Added feature for export of well log plot curves to a LAS file

Did some refactoring/improvements by introducing new class
RigWellLogCurveData.
This commit is contained in:
Pål Hagen
2015-10-15 11:27:12 +02:00
parent 5f92e87070
commit 08573be64b
16 changed files with 476 additions and 68 deletions

View File

@@ -19,6 +19,8 @@
#include "RigWellLogFile.h"
#include "RimWellLogPlotCurve.h"
#include "well.hpp"
#include "laswell.hpp"
@@ -234,3 +236,43 @@ QString RigWellLogFile::wellLogChannelUnit(const QString& wellLogChannelName) co
return unit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RigWellLogFile::exportToLasFile(const RimWellLogPlotCurve* curve, const QString& fileName)
{
CVF_ASSERT(curve);
const RigWellLogCurveData* curveData = curve->curveData();
if (!curveData)
{
return false;
}
double minX, maxX;
curve->valueRange(&minX, &maxX);
// Might want to use a different way to find an absent/"null" value, maybe use the default if possible
double absentValue = ((size_t) maxX) + 1000;
std::vector<double> wellLogValues = curveData->xValues();
for (size_t vIdx = 0; vIdx < wellLogValues.size(); vIdx++)
{
double value = wellLogValues[vIdx];
if (value == HUGE_VAL || value == -HUGE_VAL || value != value)
{
wellLogValues[vIdx] = absentValue;
}
}
NRLib::LasWell lasFile;
lasFile.AddLog("DEPTH", "m", "Depth [m]", curveData->yValues());
lasFile.AddLog(curve->name().trimmed().toStdString(), "NO_UNIT", "PARAMETERINFO", wellLogValues);
lasFile.SetMissing(absentValue);
std::vector<std::string> commentHeader;
lasFile.WriteToFile(fileName.toStdString(), commentHeader);
return true;
}