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:
@@ -29,6 +29,8 @@
|
||||
#include "RigWellLogCurveData.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogPlot.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@@ -38,6 +40,73 @@
|
||||
|
||||
CAF_CMD_SOURCE_INIT( RicExportToLasFileFeature, "RicExportToLasFileFeature" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
|
||||
const QString& exportPrefix,
|
||||
const RimWellLogPlot* plot,
|
||||
bool exportTvdRkb,
|
||||
bool capitalizeFileNames,
|
||||
double resampleInterval )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
std::vector<RimWellLogTrack*> tracks = plot->visibleTracks();
|
||||
|
||||
for ( RimWellLogTrack* track : tracks )
|
||||
{
|
||||
std::vector<RimWellLogCurve*> curves = track->visibleCurvesVector();
|
||||
allCurves.insert( allCurves.end(), curves.begin(), curves.end() );
|
||||
}
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
{
|
||||
RigLasFileExporter lasExporter( allCurves );
|
||||
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
|
||||
|
||||
return exportToLasFiles( exportFolder,
|
||||
exportPrefix,
|
||||
allCurves,
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
capitalizeFileNames,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<QString> RicExportToLasFileFeature::exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
std::vector<RimWellLogCurve*> curves,
|
||||
const std::vector<QString>& wellNames,
|
||||
const std::vector<double>& rkbDiffs,
|
||||
bool capitalizeFileNames,
|
||||
double resampleInterval )
|
||||
{
|
||||
RigLasFileExporter lasExporter( curves );
|
||||
|
||||
std::vector<QString> writtenFiles;
|
||||
|
||||
if ( resampleInterval > 0.0 )
|
||||
{
|
||||
lasExporter.setResamplingInterval( resampleInterval );
|
||||
}
|
||||
|
||||
if ( !rkbDiffs.empty() )
|
||||
{
|
||||
lasExporter.setRkbDiffs( wellNames, rkbDiffs );
|
||||
}
|
||||
|
||||
writtenFiles = lasExporter.writeToFolder( exportFolder, filePrefix, capitalizeFileNames );
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", exportFolder );
|
||||
return writtenFiles;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -89,28 +158,33 @@ void RicExportToLasFileFeature::onActionTriggered( bool isChecked )
|
||||
RicExportFeatureImpl::configureForExport( propertyDialog.dialogButtonBox() );
|
||||
propertyDialog.resize( QSize( 400, 330 ) );
|
||||
|
||||
std::vector<QString> writtenFiles;
|
||||
|
||||
if ( propertyDialog.exec() == QDialog::Accepted && !featureUi.exportFolder().isEmpty() )
|
||||
{
|
||||
double resampleInterval = 0.0;
|
||||
if ( featureUi.activateResample )
|
||||
{
|
||||
lasExporter.setResamplingInterval( featureUi.resampleInterval() );
|
||||
resampleInterval = featureUi.resampleInterval();
|
||||
}
|
||||
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
if ( featureUi.exportTvdrkb )
|
||||
{
|
||||
std::vector<QString> wellNames;
|
||||
std::vector<double> rkbDiffs;
|
||||
lasExporter.wellPathsAndRkbDiff( &wellNames, &rkbDiffs );
|
||||
|
||||
std::vector<double> userDefRkbDiff;
|
||||
featureUi.tvdrkbDiffForWellPaths( &userDefRkbDiff );
|
||||
lasExporter.setRkbDiffs( wellNames, userDefRkbDiff );
|
||||
rkbDiffs = userDefRkbDiff;
|
||||
}
|
||||
|
||||
lasExporter.writeToFolder( featureUi.exportFolder(), featureUi.filePrefix(), featureUi.capitalizeFileName() );
|
||||
|
||||
// Remember the path to next time
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory( "WELL_LOGS_DIR", featureUi.exportFolder() );
|
||||
exportToLasFiles( featureUi.exportFolder(),
|
||||
featureUi.filePrefix(),
|
||||
curves,
|
||||
wellNames,
|
||||
rkbDiffs,
|
||||
featureUi.capitalizeFileName,
|
||||
resampleInterval );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellLogCurve;
|
||||
class RimWellLogPlot;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -32,6 +35,22 @@ class RicExportToLasFileFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
const RimWellLogPlot* plot,
|
||||
bool exportTvdRkb = false,
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
|
||||
static std::vector<QString> exportToLasFiles( const QString& exportFolder,
|
||||
const QString& filePrefix,
|
||||
std::vector<RimWellLogCurve*> curves,
|
||||
const std::vector<QString>& wellNames = std::vector<QString>(),
|
||||
const std::vector<double>& rkbDiffs = std::vector<double>(),
|
||||
bool capitalizeFileNames = false,
|
||||
double resampleInterval = 0.0 );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
bool isCommandEnabled() override;
|
||||
|
||||
@@ -57,7 +57,7 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
// Save images in snapshot catalog relative to project directory
|
||||
QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath( "snapshots" );
|
||||
|
||||
exportSnapshotOfAllPlotsIntoFolder( snapshotFolderName );
|
||||
exportSnapshotOfPlotsIntoFolder( snapshotFolderName );
|
||||
|
||||
QString text = QString( "Exported snapshots to folder : \n%1" ).arg( snapshotFolderName );
|
||||
RiaLogging::info( text );
|
||||
@@ -66,8 +66,9 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix )
|
||||
void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix,
|
||||
int viewId )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@@ -87,7 +88,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfAllPlotsIntoFolder( const
|
||||
|
||||
for ( auto viewWindow : viewWindows )
|
||||
{
|
||||
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() )
|
||||
if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) )
|
||||
{
|
||||
QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow );
|
||||
if ( !prefix.isEmpty() )
|
||||
|
||||
@@ -32,7 +32,9 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature
|
||||
public:
|
||||
static void saveAllPlots();
|
||||
|
||||
static void exportSnapshotOfAllPlotsIntoFolder( const QString& snapshotFolderName, const QString& prefix = "" );
|
||||
static void exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName,
|
||||
const QString& prefix = "",
|
||||
int viewId = -1 );
|
||||
|
||||
protected:
|
||||
// Overrides
|
||||
|
||||
Reference in New Issue
Block a user