#6878 Export Completion: Make subset of settings available from Python

Python code linting changes detected by black
This commit is contained in:
Magne Sjaastad 2021-05-03 13:21:36 +02:00
parent 69a03df9da
commit 010e964ea8
13 changed files with 1780 additions and 130 deletions

View File

@ -38,7 +38,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfNewWellBoreStabilityPlotFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.h
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.h
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.h
${CMAKE_CURRENT_LIST_DIR}/RicfEnableDataSourceAsComment.h
)
set (SOURCE_GROUP_SOURCE_FILES
@ -80,7 +79,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RicfCreateWellBoreStabilityPlotFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfImportWellLogFiles.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfImportFormationNames.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfExportWellLogPlotData.cpp
${CMAKE_CURRENT_LIST_DIR}/RicfEnableDataSourceAsComment.cpp
)
list(APPEND CODE_HEADER_FILES

View File

@ -150,22 +150,6 @@ QString RicfCommandFileExecutor::getLastProjectPath() const
return m_lastProjectPath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicfCommandFileExecutor::setExportDataSouceAsComment( bool enable )
{
m_exportDataSourceAsComment = enable;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicfCommandFileExecutor::exportDataSouceAsComment() const
{
return m_exportDataSourceAsComment;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -57,9 +57,6 @@ public:
void setLastProjectPath( const QString& path );
QString getLastProjectPath() const;
void setExportDataSouceAsComment( bool enable );
bool exportDataSouceAsComment() const;
static RicfCommandFileExecutor* instance();
static std::vector<RicfCommandObject*>

View File

@ -1,52 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 "RicfEnableDataSourceAsComment.h"
#include "RiaLogging.h"
#include "cafPdmFieldScriptingCapability.h"
#include <QDir>
CAF_PDM_SOURCE_INIT( RicfEnableDataSourceAsComment, "enableDataSourceAsComment" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RicfEnableDataSourceAsComment::RicfEnableDataSourceAsComment()
{
CAF_PDM_InitScriptableField( &m_enableDataSourceAsComment,
"enableDataSourceAsComment",
true,
"Enable Data Source as Comment",
"",
"",
"" );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmScriptResponse RicfEnableDataSourceAsComment::execute()
{
RicfCommandFileExecutor* executor = RicfCommandFileExecutor::instance();
executor->setExportDataSouceAsComment( m_enableDataSourceAsComment );
return caf::PdmScriptResponse();
}

View File

@ -1,43 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2021 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 "RicfCommandFileExecutor.h"
#include "cafPdmField.h"
//==================================================================================================
//
//
//
//==================================================================================================
class RicfEnableDataSourceAsComment : public RicfCommandObject
{
CAF_PDM_HEADER_INIT;
public:
RicfEnableDataSourceAsComment();
caf::PdmScriptResponse execute() override;
private:
caf::PdmField<bool> m_enableDataSourceAsComment;
};

View File

@ -85,7 +85,7 @@ caf::PdmScriptResponse RicfExportSimWellFractureCompletions::execute()
exportSettings.timeStep = m_timeStep;
exportSettings.fileSplit = m_fileSplit;
exportSettings.compdatExport = m_compdatExport;
exportSettings.setExportDataSourceAsComment( RicfCommandFileExecutor::instance()->exportDataSouceAsComment() );
exportSettings.setExportDataSourceAsComment( true );
{
auto eclipseCase = TOOLS::caseFromId( m_caseId() );

View File

@ -112,14 +112,14 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions()
"",
"" );
CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword", "", "", "" );
CAF_PDM_InitScriptableField( &m_completionWelspecAfterMainBore,
"completionWelspecAfterMainBore",
false,
"WELSEGS per Completion Type",
CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments,
"exportComments",
true,
"Export Data Source as Comments",
"",
"",
"" );
CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword", "", "", "" );
CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename", "", "", "" );
}
@ -143,7 +143,6 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
exportSettings.fileSplit = m_fileSplit;
exportSettings.compdatExport = m_compdatExport;
exportSettings.setExportDataSourceAsComment( RicfCommandFileExecutor::instance()->exportDataSouceAsComment() );
exportSettings.performTransScaling = m_performTransScaling;
exportSettings.transScalingTimeStep = m_transScalingTimeStep;
@ -159,8 +158,8 @@ caf::PdmScriptResponse RicfExportWellPathCompletions::execute()
exportSettings.setCombinationMode( m_combinationMode() );
exportSettings.setExportDataSourceAsComment( m_exportDataSourceAsComments );
exportSettings.setExportWelspec( m_exportWelspec );
exportSettings.setExportCompletionWelspecAfterMainBore( m_completionWelspecAfterMainBore );
exportSettings.setCustomFileName( m_customFileName );
{

View File

@ -60,10 +60,7 @@ private:
caf::PdmField<bool> m_includeFractures;
caf::PdmField<bool> m_excludeMainBoreForFishbones;
// This is handeled by RicfCommandFileExecutor::exportDataSouceAsComment()
// caf::PdmField<bool> m_exportDataSourceAsComment;
caf::PdmField<bool> m_exportDataSourceAsComments;
caf::PdmField<bool> m_exportWelspec;
caf::PdmField<bool> m_completionWelspecAfterMainBore;
caf::PdmField<QString> m_customFileName;
};

View File

@ -112,12 +112,12 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi()
"",
"" );
CAF_PDM_InitField( &m_exportDataSourceAsComment, "ExportDataSourceAsComment", true, "Comment", "", "", "" );
CAF_PDM_InitField( &m_exportDataSourceAsComment, "ExportDataSourceAsComment", true, "Comments", "", "", "" );
CAF_PDM_InitField( &m_exportWelspec, "ExportWelspec", true, "WELSPEC keyword", "", "", "" );
CAF_PDM_InitField( &m_completionWelspecAfterMainBore,
"CompletionWelspecAfterMainBore",
false,
true,
"WELSEGS per Completion Type",
"",
"",

View File

@ -116,6 +116,9 @@ message ExportWellPathCompRequest
bool includeFishbones = 7;
bool excludeMainBoreForFishbones = 8;
CompdatCombinationMode combinationMode = 9;
string customFileName = 10;
bool exportComments = 11;
bool exportWelspec = 12;
}
message ExportSimWellPathFracRequest

View File

@ -376,6 +376,9 @@ def export_well_path_completions(
include_fishbones=True,
fishbones_exclude_main_bore=True,
combination_mode="INDIVIDUALLY",
export_welspec=True,
export_comments=True,
custom_file_name="",
):
"""
Export well path completions for the current case to file
@ -392,6 +395,9 @@ def export_well_path_completions(
include_fishbones | Export fishbones? | bool
fishbones_exclude_main_bore | Exclude main bore when exporting fishbones? | bool
combination_mode | Settings for multiple completions in same cell | String Enum
export_welspec | Export WELSPEC keyword | bool
export_comments | Export completion data source as comment | bool
custom_file_name | Custom filename when file_split is "UNIFIED_FILE"| String
**Enum file_split**::
@ -429,6 +435,9 @@ def export_well_path_completions(
includeFishbones=include_fishbones,
excludeMainBoreForFishbones=fishbones_exclude_main_bore,
combinationMode=combination_mode,
exportWelspec=export_welspec,
exportComments=export_comments,
customFileName=custom_file_name,
)
)

View File

@ -0,0 +1,27 @@
import sys
import os
import tempfile
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
import rips
import dataroot
def test_10k(rips_instance, initialize_test):
case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC"
project_path = case_root_path + "/well_completions_pytest.rsp"
project = rips_instance.project.open(path=project_path)
export_folder = tempfile.gettempdir()
# export_folder = "e:/temp/msj"
rips_instance.set_export_folder(export_type="COMPLETIONS", path=export_folder)
case = project.cases()[0]
case.export_well_path_completions(
time_step=1,
well_path_names=["Well-1"],
file_split="UNIFIED_FILE",
custom_file_name="msj.jadda",
)

File diff suppressed because it is too large Load Diff