#7716 Use units from las files

This commit is contained in:
Kristian Bendiksen 2021-06-09 16:13:15 +02:00
parent fed98a4183
commit 5660f780b6
3 changed files with 65 additions and 34 deletions

View File

@ -19,7 +19,10 @@
#include "RimEnsembleWellLogStatistics.h"
#include "RiaCurveMerger.h"
#include "RiaDefines.h"
#include "RiaLogging.h"
#include "RiaWeightedMeanCalculator.h"
#include "RiaWellLogUnitTools.h"
#include "RigStatisticsMath.h"
#include "RigWellLogFile.h"
@ -44,6 +47,8 @@ void caf::AppEnum<RimEnsembleWellLogStatistics::StatisticsType>::setUp()
RimEnsembleWellLogStatistics::RimEnsembleWellLogStatistics()
{
m_depthUnit = RiaDefines::DepthUnitType::UNIT_NONE;
m_logChannelUnitString = RiaWellLogUnitTools<double>::noUnitString();
}
//--------------------------------------------------------------------------------------------------
@ -61,9 +66,24 @@ void RimEnsembleWellLogStatistics::calculate( const std::vector<RimWellLogFile*>
QString errorMessage;
if ( wellLogFile->readFile( &errorMessage ) )
{
RigWellLogFile* fileData = wellLogFile->wellLogFileData();
std::vector<double> depths = fileData->depthValues();
std::vector<double> values = fileData->values( wellLogChannelName );
RigWellLogFile* fileData = wellLogFile->wellLogFileData();
RiaDefines::DepthUnitType depthUnitInFile = fileData->depthUnit();
if ( m_depthUnit != RiaDefines::DepthUnitType::UNIT_NONE && m_depthUnit != depthUnitInFile )
{
RiaLogging::error( QString( "Unexpected depth unit in file %1." ).arg( wellLogFile->fileName() ) );
}
m_depthUnit = depthUnitInFile;
QString logChannelUnitString = fileData->wellLogChannelUnitString( wellLogChannelName );
if ( m_logChannelUnitString != RiaWellLogUnitTools<double>::noUnitString() &&
m_logChannelUnitString != logChannelUnitString )
{
RiaLogging::error( QString( "Unexpected unit in file %1." ).arg( wellLogFile->fileName() ) );
}
m_logChannelUnitString = logChannelUnitString;
std::vector<double> depths = fileData->depthValues();
std::vector<double> values = fileData->values( wellLogChannelName );
if ( !depths.empty() && !values.empty() )
{
dataSetSizeCalc.addValueAndWeight( depths.size(), 1.0 );
@ -195,3 +215,19 @@ void RimEnsembleWellLogStatistics::clearData()
m_p90Data.clear();
m_meanData.clear();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::DepthUnitType RimEnsembleWellLogStatistics::depthUnitType() const
{
return m_depthUnit;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimEnsembleWellLogStatistics::logChannelUnitString() const
{
return m_logChannelUnitString;
}

View File

@ -18,6 +18,8 @@
#pragma once
#include "RiaDefines.h"
#include <vector>
class QString;
@ -46,6 +48,8 @@ public:
const std::vector<double>& p50() const;
const std::vector<double>& p90() const;
const std::vector<double>& mean() const;
QString logChannelUnitString() const;
RiaDefines::DepthUnitType depthUnitType() const;
bool hasP10Data() const;
bool hasP50Data() const;
@ -57,10 +61,12 @@ public:
private:
void clearData();
std::vector<double> m_measuredDepths;
std::vector<double> m_tvDepths;
std::vector<double> m_p10Data;
std::vector<double> m_p50Data;
std::vector<double> m_p90Data;
std::vector<double> m_meanData;
QString m_logChannelUnitString;
RiaDefines::DepthUnitType m_depthUnit;
std::vector<double> m_measuredDepths;
std::vector<double> m_tvDepths;
std::vector<double> m_p10Data;
std::vector<double> m_p50Data;
std::vector<double> m_p90Data;
std::vector<double> m_meanData;
};

View File

@ -109,10 +109,6 @@ void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseu
std::vector<double> tvDepthValues;
double rkbDiff = 0.0;
// TODO: get if from the file???
RiaDefines::DepthUnitType depthUnit = RiaDefines::DepthUnitType::UNIT_FEET; // METER;
QString xUnits = RiaWellLogUnitTools<double>::noUnitString();
*isUsingPseudoLength = false;
if ( m_ensembleWellLogCurveSet )
@ -120,6 +116,9 @@ void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseu
const RimEnsembleWellLogStatistics* ensembleWellLogStatistics =
m_ensembleWellLogCurveSet->ensembleWellLogStatistics();
RiaDefines::DepthUnitType depthUnit = ensembleWellLogStatistics->depthUnitType();
QString xUnits = ensembleWellLogStatistics->logChannelUnitString();
if ( m_statisticsType == RimEnsembleWellLogStatistics::StatisticsType::MEAN )
{
values = ensembleWellLogStatistics->mean();
@ -141,27 +140,17 @@ void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseu
measuredDepthValues = ensembleWellLogStatistics->measuredDepths();
}
// RiaDefines::EclipseUnitSystem eclipseUnitsType = eclipseCase->eclipseCaseData()->unitsType();
// if ( eclipseUnitsType == RiaDefines::EclipseUnitSystem::UNITS_FIELD )
// {
// // See https://github.com/OPM/ResInsight/issues/538
// depthUnit = RiaDefines::DepthUnitType::UNIT_FEET;
// }
}
bool performDataSmoothing = false;
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
{
this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
rkbDiff,
depthUnit,
!performDataSmoothing,
xUnits );
// this->setValuesWithMdAndTVD( values, measuredDepthValues, tvDepthValues, rkbDiff, depthUnit,
// !performDataSmoothing, xUnits );
bool performDataSmoothing = false;
if ( !values.empty() && !measuredDepthValues.empty() && measuredDepthValues.size() == values.size() )
{
this->setValuesAndDepths( values,
measuredDepthValues,
RiaDefines::DepthTypeEnum::MEASURED_DEPTH,
rkbDiff,
depthUnit,
!performDataSmoothing,
xUnits );
}
}
}