mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4817 #4830 #4832 #4837 #4839 Python commands for WBS creation, well path import and well log file import (#4838)
* Better minimum width for well log tracks * Fix alignment of scrollbar in Well log plots * Better Well Log Plot export * Hide scroll bar before plotting * Better borders * Create plots through Python * #4817 Create WBS plots with Python * Rebase Summary and WellLogPlot on top of a new RimPlot * Also Python: Allow setting folder as a parameter to export_snapshots * #4832 Prepare for well path import command * Well Path import WIP * #4830 #4832 Import well paths and well log files from file using Python. * #4837 Implement import of formation names in Python * Fix debug build issue * Fix RiaLogging build issue * Fix warnings * Yet another RiaLogging.h import added * #4839 Import exporting of las and ascii files from well log plots
This commit is contained in:
@@ -33,6 +33,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfNewWellBoreStabilityPlotFeature.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellPaths.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@@ -69,6 +74,11 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateGridCaseGroup.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateStatisticsCase.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCloneView.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfCreateWellBoreStabilityPlotFeature.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellPaths.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
||||
@@ -26,6 +26,15 @@ RicfCommandResponse::RicfCommandResponse( Status status, const QString& message
|
||||
updateStatus( status, message );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse::RicfCommandResponse( caf::PdmObject* ok_result )
|
||||
: m_status( COMMAND_OK )
|
||||
, m_result( ok_result )
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -35,11 +44,11 @@ RicfCommandResponse::Status RicfCommandResponse::status() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
/// The resulting message is sent in HTTP metadata and must not have any newlines.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicfCommandResponse::message() const
|
||||
QString RicfCommandResponse::sanitizedResponseMessage() const
|
||||
{
|
||||
return m_messages.join( "\n" );
|
||||
return m_messages.join( ";;" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -47,7 +56,7 @@ QString RicfCommandResponse::message() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObject* RicfCommandResponse::result() const
|
||||
{
|
||||
return m_result.p();
|
||||
return m_result.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -55,7 +64,7 @@ caf::PdmObject* RicfCommandResponse::result() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandResponse::setResult( caf::PdmObject* result )
|
||||
{
|
||||
m_result = result;
|
||||
m_result.reset( result );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -63,8 +72,11 @@ void RicfCommandResponse::setResult( caf::PdmObject* result )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfCommandResponse::updateStatus( Status status, const QString& message )
|
||||
{
|
||||
QString cleanedMessage = message;
|
||||
cleanedMessage.replace( '\n', ";;" );
|
||||
m_status = std::max( m_status, status );
|
||||
if ( !message.isEmpty() ) m_messages.push_back( QString( "%1:%2" ).arg( statusLabel( status ) ).arg( message ) );
|
||||
if ( !message.isEmpty() )
|
||||
m_messages.push_back( QString( "%1: %2" ).arg( statusLabel( status ) ).arg( cleanedMessage ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -43,9 +43,10 @@ public:
|
||||
|
||||
public:
|
||||
RicfCommandResponse( Status status = COMMAND_OK, const QString& message = "" );
|
||||
RicfCommandResponse( caf::PdmObject* ok_result );
|
||||
|
||||
Status status() const;
|
||||
QString message() const;
|
||||
QString sanitizedResponseMessage() const;
|
||||
caf::PdmObject* result() const;
|
||||
void setResult( caf::PdmObject* result );
|
||||
void updateStatus( Status status, const QString& message );
|
||||
@@ -56,5 +57,5 @@ private:
|
||||
private:
|
||||
Status m_status;
|
||||
QStringList m_messages;
|
||||
caf::PdmPointer<caf::PdmObject> m_result;
|
||||
std::unique_ptr<caf::PdmObject> m_result;
|
||||
};
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateViewResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfCreateWellBoreStabilityPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "WellLogCommands/RicNewWellBoreStabilityPlotFeature.h"
|
||||
|
||||
#include "RimGeoMechCase.h"
|
||||
#include "RimGeoMechView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellBoreStabilityPlot.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateWbsPlotResult, "createWbsPlotResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateWbsPlotResult::RicfCreateWbsPlotResult( int viewId /*= -1*/ )
|
||||
{
|
||||
CAF_PDM_InitObject( "wbs_result", "", "", "" );
|
||||
CAF_PDM_InitField( &this->viewId, "viewId", viewId, "", "", "", "" );
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfCreateWellBoreStabilityPlotFeature, "createWellBoreStabilityPlot" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature()
|
||||
{
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" );
|
||||
RICF_InitField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" );
|
||||
RICF_InitField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfCreateWellBoreStabilityPlotFeature::execute()
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimGeoMechCase*> geoMechCases;
|
||||
project->descendantsIncludingThisOfType( geoMechCases );
|
||||
|
||||
RimGeoMechCase* chosenCase = nullptr;
|
||||
for ( RimGeoMechCase* geoMechCase : geoMechCases )
|
||||
{
|
||||
if ( geoMechCase->caseId() == m_caseId() )
|
||||
{
|
||||
chosenCase = geoMechCase;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
RimWellPath* chosenWellPath = nullptr;
|
||||
for ( RimWellPath* wellPath : project->allWellPaths() )
|
||||
{
|
||||
if ( wellPath->name() == m_wellPath() )
|
||||
{
|
||||
chosenWellPath = wellPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( chosenCase && chosenWellPath && m_timeStep() >= 0 )
|
||||
{
|
||||
RimWellBoreStabilityPlot* wbsPlot = RicNewWellBoreStabilityPlotFeature::createPlot( chosenCase,
|
||||
chosenWellPath,
|
||||
m_timeStep() );
|
||||
RicfCommandResponse response;
|
||||
response.setResult( new RicfCreateWbsPlotResult( wbsPlot->id() ) );
|
||||
return response;
|
||||
}
|
||||
|
||||
QString error = QString( "createWellBoreStabilityPlot: Could not find GeoMech case with id %1" ).arg( m_caseId() );
|
||||
RiaLogging::error( error );
|
||||
return RicfCommandResponse( RicfCommandResponse::COMMAND_ERROR, error );
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateWbsPlotResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateWbsPlotResult( int viewId = -1 );
|
||||
|
||||
public:
|
||||
caf::PdmField<int> viewId;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfCreateWellBoreStabilityPlotFeature : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfCreateWellBoreStabilityPlotFeature();
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<QString> m_wellPath;
|
||||
caf::PdmField<int> m_timeStep;
|
||||
};
|
||||
@@ -53,6 +53,7 @@ RicfExportSnapshots::RicfExportSnapshots()
|
||||
RICF_InitField( &m_prefix, "prefix", QString(), "Prefix", "", "", "" );
|
||||
RICF_InitField( &m_caseId, "caseId", -1, "Case Id", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "View Id", "", "", "" );
|
||||
RICF_InitField( &m_exportFolder, "exportFolder", QString(), "Export Folder", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -74,6 +75,11 @@ RicfCommandResponse RicfExportSnapshots::execute()
|
||||
|
||||
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(
|
||||
RicfCommandFileExecutor::SNAPSHOTS );
|
||||
|
||||
if ( !m_exportFolder().isEmpty() )
|
||||
{
|
||||
absolutePathToSnapshotDir = m_exportFolder;
|
||||
}
|
||||
if ( absolutePathToSnapshotDir.isNull() )
|
||||
{
|
||||
absolutePathToSnapshotDir = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath(
|
||||
@@ -88,7 +94,9 @@ RicfCommandResponse RicfExportSnapshots::execute()
|
||||
}
|
||||
if ( m_type == RicfExportSnapshots::PLOTS || m_type == RicfExportSnapshots::ALL )
|
||||
{
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( absolutePathToSnapshotDir, m_prefix );
|
||||
RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( absolutePathToSnapshotDir,
|
||||
m_prefix,
|
||||
m_viewId() );
|
||||
}
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
|
||||
@@ -52,4 +52,5 @@ private:
|
||||
caf::PdmField<QString> m_prefix;
|
||||
caf::PdmField<int> m_caseId;
|
||||
caf::PdmField<int> m_viewId;
|
||||
caf::PdmField<QString> m_exportFolder;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfExportWellLogPlotData.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "ExportCommands/RicExportToLasFileFeature.h"
|
||||
#include "WellLogCommands/RicAsciiExportWellLogPlotFeature.h"
|
||||
|
||||
#include "RimProject.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
namespace caf
|
||||
{
|
||||
template <>
|
||||
void RicfExportWellLogPlotData::ExportFormatEnum::setUp()
|
||||
{
|
||||
addItem( RicfExportWellLogPlotData::LAS, "LAS", "LAS" );
|
||||
addItem( RicfExportWellLogPlotData::ASCII, "ASCII", "ASCII" );
|
||||
setDefault( RicfExportWellLogPlotData::LAS );
|
||||
}
|
||||
} // namespace caf
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotDataResult, "exportWellLogPlotDataResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellLogPlotDataResult::RicfExportWellLogPlotDataResult()
|
||||
{
|
||||
CAF_PDM_InitObject( "export_well_data_result", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &this->exportedFiles, "exportedFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotData, "exportWellLogPlotData" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfExportWellLogPlotData::RicfExportWellLogPlotData()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_format, "exportFormat", "", "", "", "" );
|
||||
RICF_InitField( &m_viewId, "viewId", -1, "", "", "", "" );
|
||||
RICF_InitField( &m_folder, "exportFolder", QString(), "", "", "", "" );
|
||||
RICF_InitField( &m_filePrefix, "filePrefix", QString(), "", "", "", "" );
|
||||
RICF_InitField( &m_exportTvdRkb, "exportTvdRkb", false, "", "", "", "" );
|
||||
RICF_InitField( &m_capitalizeFileNames, "capitalizeFileNames", false, "", "", "", "" );
|
||||
RICF_InitField( &m_resampleInterval, "resampleInterval", 0.0, "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfExportWellLogPlotData::execute()
|
||||
{
|
||||
QStringList errorMessages;
|
||||
|
||||
RicfCommandResponse response;
|
||||
|
||||
if ( QFileInfo::exists( m_folder ) )
|
||||
{
|
||||
std::vector<RimWellLogPlot*> plots;
|
||||
RiaApplication::instance()->project()->descendantsIncludingThisOfType( plots );
|
||||
for ( RimWellLogPlot* plot : plots )
|
||||
{
|
||||
if ( plot->id() == m_viewId() )
|
||||
{
|
||||
RicfExportWellLogPlotDataResult* result = new RicfExportWellLogPlotDataResult;
|
||||
if ( m_format() == ASCII )
|
||||
{
|
||||
QString validFileName =
|
||||
RicAsciiExportWellLogPlotFeature::makeValidExportFileName( plot,
|
||||
m_folder(),
|
||||
m_filePrefix(),
|
||||
m_capitalizeFileNames() );
|
||||
if ( RicAsciiExportWellLogPlotFeature::exportAsciiForWellLogPlot( validFileName, plot ) )
|
||||
{
|
||||
result->exportedFiles.v().push_back( validFileName );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<QString> exportedFiles =
|
||||
RicExportToLasFileFeature::exportToLasFiles( m_folder(),
|
||||
m_filePrefix(),
|
||||
plot,
|
||||
m_exportTvdRkb(),
|
||||
m_capitalizeFileNames(),
|
||||
m_resampleInterval() );
|
||||
result->exportedFiles.v() = exportedFiles;
|
||||
}
|
||||
response.setResult( result );
|
||||
if ( result->exportedFiles().empty() )
|
||||
{
|
||||
errorMessages << "No files exported";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( m_folder() + " does not exist" );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportWellLogPlotDataResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfExportWellLogPlotDataResult();
|
||||
|
||||
public:
|
||||
caf::PdmField<std::vector<QString>> exportedFiles;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RicfExportWellLogPlotData : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
// Values are exposed in gRPC .proto. Do not change without also changing .proto
|
||||
enum ExportFormat
|
||||
{
|
||||
LAS,
|
||||
ASCII
|
||||
};
|
||||
typedef caf::AppEnum<ExportFormat> ExportFormatEnum;
|
||||
|
||||
public:
|
||||
RicfExportWellLogPlotData();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<ExportFormatEnum> m_format;
|
||||
caf::PdmField<int> m_viewId;
|
||||
caf::PdmField<QString> m_folder;
|
||||
caf::PdmField<QString> m_filePrefix;
|
||||
caf::PdmField<bool> m_exportTvdRkb;
|
||||
caf::PdmField<bool> m_capitalizeFileNames;
|
||||
caf::PdmField<double> m_resampleInterval;
|
||||
};
|
||||
@@ -0,0 +1,99 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfImportFormationNames.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RicImportFormationNamesFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimFormationNames.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportFormationNames, "importFormationNames" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportFormationNames::RicfImportFormationNames()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_formationFiles, "formationFiles", "", "", "", "" );
|
||||
RICF_InitField( &m_applyToCaseId, "applyToCaseId", -1, "", "", "", "" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfCommandResponse RicfImportFormationNames::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
|
||||
if ( !m_formationFiles().empty() )
|
||||
{
|
||||
QStringList formationFileList;
|
||||
for ( QString formationFile : m_formationFiles() )
|
||||
{
|
||||
if ( QFileInfo::exists( formationFile ) )
|
||||
{
|
||||
formationFileList.push_back( formationFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages.push_back( QString( "%1 does not exist" ).arg( formationFile ) );
|
||||
}
|
||||
}
|
||||
|
||||
RimFormationNames* formationNames = RicImportFormationNamesFeature::importFormationFiles( formationFileList );
|
||||
if ( formationNames )
|
||||
{
|
||||
if ( m_applyToCaseId() != -1 )
|
||||
{
|
||||
bool foundCase = false;
|
||||
std::vector<RimCase*> cases;
|
||||
RiaApplication::instance()->project()->allCases( cases );
|
||||
for ( RimCase* rimCase : cases )
|
||||
{
|
||||
if ( rimCase->caseId() == m_applyToCaseId() )
|
||||
{
|
||||
rimCase->setFormationNames( formationNames );
|
||||
rimCase->updateConnectedEditors();
|
||||
foundCase = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !foundCase ) warningMessages << "Could not find the case to apply the formations to";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << "No formation files provided";
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicfImportFormationNames : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfImportFormationNames();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<std::vector<QString>> m_formationFiles;
|
||||
caf::PdmField<int> m_applyToCaseId;
|
||||
};
|
||||
115
ApplicationCode/CommandFileInterface/RicfImportWellLogFiles.cpp
Normal file
115
ApplicationCode/CommandFileInterface/RicfImportWellLogFiles.cpp
Normal file
@@ -0,0 +1,115 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfImportWellLogFiles.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogsImportFileFeature.h"
|
||||
|
||||
#include "RimWellLogFile.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportWellLogFilesResult, "importWellLogFilesResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportWellLogFilesResult::RicfImportWellLogFilesResult()
|
||||
{
|
||||
CAF_PDM_InitObject( "well_log_files_result", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" );
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportWellLogFiles, "importWellLogFiles" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportWellLogFiles::RicfImportWellLogFiles()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_wellLogFileFolder, "wellLogFolder", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_wellLogFilePaths, "wellLogFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
RicfCommandResponse RicfImportWellLogFiles::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellLogFilePaths;
|
||||
|
||||
QDir wellPathFolder( m_wellLogFileFolder );
|
||||
if ( wellPathFolder.exists() )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << RicWellLogsImportFileFeature::wellLogFileNameFilters();
|
||||
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
for ( QString relativePath : relativePaths )
|
||||
{
|
||||
wellLogFilePaths.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( m_wellLogFileFolder() + " doesn't exist" );
|
||||
}
|
||||
|
||||
for ( QString wellLogFilePath : m_wellLogFilePaths() )
|
||||
{
|
||||
if ( QFileInfo::exists( wellLogFilePath ) )
|
||||
{
|
||||
wellLogFilePaths.push_back( wellLogFilePath );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( wellLogFilePath + " doesn't exist" );
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
|
||||
if ( !wellLogFilePaths.empty() )
|
||||
{
|
||||
std::vector<RimWellLogFile*> importedWellLogFiles =
|
||||
RicWellLogsImportFileFeature::importWellLogFiles( wellLogFilePaths, &warningMessages );
|
||||
if ( !importedWellLogFiles.empty() )
|
||||
{
|
||||
RicfImportWellLogFilesResult* result = new RicfImportWellLogFilesResult;
|
||||
for ( RimWellLogFile* wellLogFile : importedWellLogFiles )
|
||||
{
|
||||
result->wellPathNames.v().push_back( wellLogFile->wellName() );
|
||||
}
|
||||
response.setResult( result );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
warningMessages << "No well log files found";
|
||||
}
|
||||
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicfImportWellLogFilesResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfImportWellLogFilesResult();
|
||||
|
||||
public:
|
||||
caf::PdmField<std::vector<QString>> wellPathNames;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicfImportWellLogFiles : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfImportWellLogFiles();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellLogFileFolder;
|
||||
caf::PdmField<std::vector<QString>> m_wellLogFilePaths;
|
||||
};
|
||||
116
ApplicationCode/CommandFileInterface/RicfImportWellPaths.cpp
Normal file
116
ApplicationCode/CommandFileInterface/RicfImportWellPaths.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicfImportWellPaths.h"
|
||||
|
||||
#include "WellPathCommands/RicWellPathsImportFileFeature.h"
|
||||
|
||||
#include "RimFileWellPath.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QStringList>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportWellPathsResult, "importWellPathsResult" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportWellPathsResult::RicfImportWellPathsResult()
|
||||
{
|
||||
CAF_PDM_InitObject( "well_path_result", "", "", "" );
|
||||
CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" );
|
||||
}
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RicfImportWellPaths, "importWellPaths" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicfImportWellPaths::RicfImportWellPaths()
|
||||
{
|
||||
RICF_InitFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" );
|
||||
RICF_InitFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" );
|
||||
}
|
||||
|
||||
RicfCommandResponse RicfImportWellPaths::execute()
|
||||
{
|
||||
QStringList errorMessages, warningMessages;
|
||||
QStringList wellPathFiles;
|
||||
|
||||
QDir wellPathFolder( m_wellPathFolder );
|
||||
|
||||
if ( wellPathFolder.exists() )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << RicWellPathsImportFileFeature::wellPathNameFilters();
|
||||
QStringList relativePaths = wellPathFolder.entryList( nameFilters, QDir::Files | QDir::NoDotAndDotDot );
|
||||
for ( QString relativePath : relativePaths )
|
||||
{
|
||||
wellPathFiles.push_back( wellPathFolder.absoluteFilePath( relativePath ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( m_wellPathFolder() + " does not exist" );
|
||||
}
|
||||
|
||||
for ( QString wellPathFile : m_wellPathFiles() )
|
||||
{
|
||||
if ( QFileInfo::exists( wellPathFile ) )
|
||||
{
|
||||
wellPathFiles.push_back( wellPathFile );
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessages << ( wellPathFile + " does not exist" );
|
||||
}
|
||||
}
|
||||
|
||||
RicfCommandResponse response;
|
||||
if ( !wellPathFiles.empty() )
|
||||
{
|
||||
std::vector<RimFileWellPath*> importedWellPaths = RicWellPathsImportFileFeature::importWellPaths( wellPathFiles,
|
||||
&warningMessages );
|
||||
if ( !importedWellPaths.empty() )
|
||||
{
|
||||
RicfImportWellPathsResult* wellPathsResult = new RicfImportWellPathsResult;
|
||||
for ( RimFileWellPath* wellPath : importedWellPaths )
|
||||
{
|
||||
wellPathsResult->wellPathNames.v().push_back( wellPath->name() );
|
||||
}
|
||||
|
||||
response.setResult( wellPathsResult );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
warningMessages << "No well paths found";
|
||||
}
|
||||
|
||||
for ( QString warningMessage : warningMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_WARNING, warningMessage );
|
||||
}
|
||||
|
||||
for ( QString errorMessage : errorMessages )
|
||||
{
|
||||
response.updateStatus( RicfCommandResponse::COMMAND_ERROR, errorMessage );
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
58
ApplicationCode/CommandFileInterface/RicfImportWellPaths.h
Normal file
58
ApplicationCode/CommandFileInterface/RicfImportWellPaths.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "RicfCommandObject.h"
|
||||
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicfImportWellPathsResult : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfImportWellPathsResult();
|
||||
|
||||
public:
|
||||
caf::PdmField<std::vector<QString>> wellPathNames;
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicfImportWellPaths : public RicfCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicfImportWellPaths();
|
||||
|
||||
RicfCommandResponse execute() override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellPathFolder;
|
||||
caf::PdmField<std::vector<QString>> m_wellPathFiles;
|
||||
};
|
||||
Reference in New Issue
Block a user