LogViewer¶
-
class
petropy.
LogViewer
(log, template_xml_path=None, template_defaults=None, top=None, height=None)[source]¶ Uses matplotlib to create a figure and axes to display log data. XML templates are required to diplay curve data, with a few defaults provided.
-
log
¶ Log – The Log class with data updated from any edits performed within LogViewer
-
fig
¶ Figure – The matplotlib Figure object
-
axes
¶ ndarray – numpy ndarray of AxesSubplot objects where each axes is a curve track
Parameters: - log (Log) – A Log object with curve data to display in the LogViewer
- template_xml_path (str (default None)) – Path to xml template.
- template_defaults (str) – Name of default template options. Uses prebuilt template to display data
- top (float (default None)) – Setting to set initial top of graph
- height (float (default None)) – Setting to set amout of feet to display
Note
template_defaults string must be from these options
raw multimin_oil multimin_gas multimin_oil_sum multimin_gas_sum
Examples
>>> import petropy as ptr # create LogViewer with default triple-combo template and display # # Load sample wolfcamp log >>> log = ptr.log_data('WFMP') # create LogViewer with 'raw' template >>> viewer = ptr.LogViewer(log, template_defaults = 'raw') >>> viewer.show() # diplay log data
>>> import petropy as ptr # create LogViewer for 11 x 17 paper # with default triple-combo template and save # # Load sample wolfcamp log >>> log = ptr.log_data('WFMP') # create LogViewer with 'raw' template (default) >>> viewer = ptr.LogViewer(log) # use fig attribute to change size to 17 x 11 >>> viewer.fig.set_size_inches(17, 11) # file path for image file >>> s = 'path/to/save/wfmp_log.png' # saves matplotlib figure >>> viewer.fig.savefig(s)
>>> import petropy as ptr # create LogViewer with custom template and save # # Load sample wolfcamp log >>> log = ptr.log_data('WFMP') # specify path to template file >>> t = 'path/to/my/custom/template.xml' # create log view with template >>> viewer = ptr.LogViewer(log, template_xml_path = t) # define path to save the log picture >>> s = 'path/to/save/figure.png' # save figure using matplotlib savefig method >>> viewer.fig.savefig(s)
>>> import petropy as ptr # create LogViewer with default triple-combo template, # make graphical edits, then save log changes # # Load sample wolfcamp log >>> log = ptr.log_data('WFMP') >>> viewer = ptr.LogViewer(log) # diplay log data and graphically edit >>> viewer.show(edit_mode = True) # define path to save the updated log data >>> file_path = 'path/to/save/wfmp_edits.las' # write updated log to new las file. # Executed after figures are closed. >>> viewer.log.write(file_path)
Raises: ValueError
– If template_defaults parameter is not in key of dictionary itemsValueError
– If template_xml_path are both specifiedValueError
– tick spacing must be specified in depth trackValueError
– number spacing must be specified in depth trackValueError
– left and right values for each curve must be specified in xml templateValueError
– curve must be in logValueError
– curve display_name must be specified in xml templateValueError
– curve curve_name must be specified in xml templateValueError
– curve fill_color must be specified for cumulative tracks
-
show
(edit_mode=False, window_location=(10, 30))[source]¶ Calls matplotlib.pyplot.show() to display log viewer. If edit_mode == True, it includes options to graphically edit curve data, and stores these changes within the LogViewer object. After editing is finished, access the updated
petropy.Log
data with the .log property.Parameters: Example
>>> import petropy as ptr >>> log = ptr.log_data('WFMP') # sample Wolfcamp log >>> viewer = ptr.LogViewer(log) # default triple-combo template >>> viewer.show() # display graphs
>>> import petropy as ptr >>> log = ptr.log_data('WFMP') # sample Wolfcamp log >>> viewer = ptr.LogViewer(log) # display graphs with editing option >>> viewer.show(edit_mode = True) >>> file_path = 'path/to/new_file.las' # writes changed data to new las file >>> viewer.log.write(file_path)
-