ResInsight/ApplicationCode/GrpcInterface/Python/rips/plot.py
Gaute Lindkvist 11117383db
#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
2019-10-09 09:21:28 +02:00

73 lines
3.9 KiB
Python

"""
ResInsight 2d plot module
"""
import rips.generated.Commands_pb2 as Cmd
from rips.pdmobject import PdmObject
class Plot(PdmObject):
"""ResInsight plot class
Attributes:
view_id(int): View Id corresponding to the View Id in ResInsight project.
"""
def __init__(self, pdm_object):
PdmObject.__init__(self, pdm_object.pb2_object(), pdm_object.channel())
self.view_id = pdm_object.get_value("ViewId")
def export_snapshot(self, export_folder='', file_prefix='', ):
""" Export snapshot for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
prefix (str): Exported file name prefix
"""
return self._execute_command(
exportSnapshots=Cmd.ExportSnapshotsRequest(type='PLOTS',
prefix=file_prefix,
viewId=self.view_id,
exportFolder=export_folder))
def export_data_as_las(self, export_folder, file_prefix='', export_tvdrkb=False, capitalize_file_names=False, resample_interval=0.0):
""" Export LAS file(s) for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
file_prefix (str): Exported file name prefix
export_tvdrkb(bool): Export in TVD-RKB format
capitalize_file_names(bool): Make all file names upper case
resample_interval(double): if > 0.0 the files will be resampled
Returns:
A list of files exported
"""
res = self._execute_command(exportWellLogPlotData=Cmd.ExportWellLogPlotDataRequest(exportFormat='LAS',
viewId=self.view_id,
exportFolder=export_folder,
filePrefix=file_prefix,
exportTvdRkb=export_tvdrkb,
capitalizeFileNames=capitalize_file_names,
resampleInterval=resample_interval))
return res.exportWellLogPlotDataResult.exportedFiles
def export_data_as_ascii(self, export_folder, file_prefix='', capitalize_file_names=False):
""" Export LAS file(s) for the current plot
Arguments:
export_folder(str): The path to export to. By default will use the global export folder
file_prefix (str): Exported file name prefix
capitalize_file_names(bool): Make all file names upper case
Returns:
A list of files exported
"""
res = self._execute_command(exportWellLogPlotData=Cmd.ExportWellLogPlotDataRequest(exportFormat='ASCII',
viewId=self.view_id,
exportFolder=export_folder,
filePrefix=file_prefix,
exportTvdRkb=False,
capitalizeFileNames=capitalize_file_names,
resampleInterval=0.0))
return res.exportWellLogPlotDataResult.exportedFiles