Adjustment of creating depth adjusted LAS files

* Make source well LAS files selectable in combobox
Detect all las files for source well and make selectable in combobox

* Add source well info to file name and as comment in file
Add info of source well in file name and as comment in LAS file for created depth adjusted las files
This commit is contained in:
Jørgen Herje authored and Magne Sjaastad committed 2023-03-16 07:16:11 +01:00
1 parent c61d492a2b
commit 1d1b90e4ae
4 files changed
+58 -10

No files matched your search

@@ -74,7 +74,7 @@ void RicCreateDepthAdjustedLasFilesFeature::onActionTriggered( bool isChecked )
{
RimCase* selectedCase = featureUi.selectedCase();
RimWellPath* sourceWell = featureUi.sourceWell();
RimWellLogFile* sourceWellLogFile = sourceWell->wellLogFiles()[0];
RimWellLogFile* sourceWellLogFile = featureUi.wellLogFile();
std::vector<RimWellPath*> destinationWells = featureUi.destinationWells().ptrReferencedObjects();
std::vector<QString> selectedResultProperties = featureUi.selectedResultProperties();
QString exportFolder = featureUi.exportFolder();
@@ -239,8 +239,29 @@ void RicCreateDepthAdjustedLasFilesImpl::createDestinationWellLasFile( const QSt
lasFile.AddLog( name.toUpper().toStdString(), unitText, "", values );
}
std::vector<std::string> commentHeader;
QString fullPathName = exportFolder + "/" + wellName + "_" + caseDescription + "_" + sourceWellLogData->date() + ".las";
// Add comment to LAS file
const std::vector<std::string> commentHeader = {
QString( "Note: Generated depth adjusted LAS file for '%1', using '%2'" )
.arg( wellName )
.arg( sourceWellLogData->wellName() )
.toStdString() };
// Add property value to file name if single property
QString propertyNameStr;
if ( propertyMap.size() == 1 )
{
propertyNameStr = QString( "-%1" ).arg( propertyMap.begin()->first );
}
// Replace white space from well names in file name
QString sourceWell = sourceWellLogData->wellName();
sourceWell = sourceWell.replace( QRegExp( "[\\s]+" ), "_" );
QString destinationWell = wellName;
destinationWell = destinationWell.replace( QRegExp( "[\\s]+" ), "_" );
// Create full file path name
QString fullPathName = exportFolder + "/" + destinationWell + "_Depth_Adjusted_Using_" + sourceWell + "_" +
caseDescription + propertyNameStr + "-" + sourceWellLogData->date() + ".las";
lasFile.WriteToFile( fullPathName.toStdString(), commentHeader );
}
@@ -46,6 +46,7 @@ RicCreateDepthAdjustedLasFilesUi::RicCreateDepthAdjustedLasFilesUi()
CAF_PDM_InitFieldNoDefault( &selectedCase, "SelectedCase", "Select Case" );
CAF_PDM_InitFieldNoDefault( &sourceWell, "SourceWell", "Source Well" );
CAF_PDM_InitFieldNoDefault( &wellLogFile, "WellLogFile", "Well Log File" );
CAF_PDM_InitFieldNoDefault( &selectedResultProperties, "SelectedResultProperties", "Selected Result Properties" );
selectedResultProperties.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() );
CAF_PDM_InitFieldNoDefault( &destinationWells, "DestinationWells", "Destination Wells" );
@@ -86,16 +87,25 @@ QList<caf::PdmOptionItemInfo>
}
}
}
if ( fieldNeedingOptions == &wellLogFile )
{
if ( sourceWell )
{
for ( auto* file : sourceWell->wellLogFiles() )
{
options.push_back( caf::PdmOptionItemInfo( file->name(), file ) );
}
}
}
if ( fieldNeedingOptions == &selectedResultProperties )
{
if ( sourceWell && !sourceWell->wellLogFiles().empty() )
if ( sourceWell && wellLogFile != nullptr )
{
auto* firstWellLogFile = sourceWell->wellLogFiles()[0];
for ( auto* property : firstWellLogFile->wellLogChannels() )
for ( auto* channel : wellLogFile->wellLogChannels() )
{
if ( !m_depthProperties.contains( property->name() ) )
if ( !m_depthProperties.contains( channel->name() ) )
{
options.push_back( caf::PdmOptionItemInfo( property->name(), property->name() ) );
options.push_back( caf::PdmOptionItemInfo( channel->name(), channel->name() ) );
}
}
}
@@ -130,6 +140,15 @@ void RicCreateDepthAdjustedLasFilesUi::fieldChangedByUi( const caf::PdmFieldHand
{
selectedResultProperties.v().clear();
destinationWells.clearWithoutDelete();
wellLogFile = nullptr;
if ( sourceWell != nullptr && !sourceWell->wellLogFiles().empty() )
{
wellLogFile = sourceWell->wellLogFiles()[0];
}
}
if ( changedField == &wellLogFile )
{
selectedResultProperties.v().clear();
}
}
@@ -173,7 +192,8 @@ void RicCreateDepthAdjustedLasFilesUi::setDefaultValues()
{
if ( !wellPath->wellLogFiles().empty() )
{
sourceWell = wellPath;
sourceWell = wellPath;
wellLogFile = wellPath->wellLogFiles()[0];
break;
}
}
@@ -186,7 +206,7 @@ void RicCreateDepthAdjustedLasFilesUi::setDefaultValues()
bool RicCreateDepthAdjustedLasFilesUi::hasValidSelections() const
{
return !exportFolder().isEmpty() && sourceWell() != nullptr && selectedCase() != nullptr &&
!selectedResultProperties().empty() && !destinationWells.empty();
wellLogFile != nullptr && !selectedResultProperties().empty() && !destinationWells.empty();
}
//--------------------------------------------------------------------------------------------------
@@ -212,6 +232,10 @@ QString RicCreateDepthAdjustedLasFilesUi::invalidSelectionsLogString() const
{
logStr += "Source well is not defined!\n";
}
if ( wellLogFile() == nullptr )
{
logStr += "Well log file for source well is not defined!\n";
}
if ( selectedResultProperties().empty() )
{
logStr += "No result properties are selected!\n";
@@ -232,6 +256,7 @@ void RicCreateDepthAdjustedLasFilesUi::defineUiOrdering( QString uiConfigName, c
uiOrdering.add( &exportFolder );
uiOrdering.add( &selectedCase );
uiOrdering.add( &sourceWell );
uiOrdering.add( &wellLogFile );
uiOrdering.add( &selectedResultProperties );
uiOrdering.add( &destinationWells );
@@ -32,6 +32,7 @@
class RimCase;
class RimWellPath;
class RimWellLogFile;
//==================================================================================================
///
@@ -58,6 +59,7 @@ public:
caf::PdmField<QString> exportFolder;
caf::PdmPtrField<RimCase*> selectedCase;
caf::PdmPtrField<RimWellPath*> sourceWell;
caf::PdmPtrField<RimWellLogFile*> wellLogFile;
caf::PdmField<std::vector<QString>> selectedResultProperties;
caf::PdmPtrArrayField<RimWellPath*> destinationWells;