Howto

Using Visual Studio Code with OpendTect

In this post I show you how to set up and use the free Visual Studio Code editor with OpendTect for interactive computation using Python Jupyter Notebooks. If you have installed the OpendTect Machine Learning Python environments you can create and edit Python Jupyter Notebooks using Visual Studio Code without modifying the installed environment provided VS Code is run from within OpendTect. The approach described in this post might assist users in strictly controlled IT settings get up and running using Jupyter Notebooks.

Continue reading

Python External Attribute Tips & Tricks - Debugging

Introduction Because the Python [../plugins/ExternalAttrib] script is running in a process started by the OpendTect application most standard methods to examine the script as it runs, eg using the standard Python debugger pdb, are not available. A solution is to use the Web-PDB Python module which allows the Python script to be debugged remotely in a web-browser. Web-PDB Installation Web-PDB is not included by default in most Python installations but it can be easily added using pip:

Continue reading

Python External Attribute Tips & Tricks - Logging

Introduction It is possible to write information to the OpendTect logfile from inside a Python [../plugins/ExternalAttrib] script. The global variable xa.logH (assuming the extattrib module has been imported using import extattrib as xa) is a Python logger object. An Example On line 18 the Python logger is modified by adjusting the severity level of messages that will appear in the log file. By default only CRITICAL, ERROR and WARNING messages will be written.

Continue reading

Anatomy of a Python External Attribute

Introduction This article will review the structure of a simple Python [../plugins/ExternalAttrib] script, ex_dip.py, which converts inline and crossline dip to true dip and dip azimuth. It is an example of multi attribute, single trace input and output. Some basic understanding of Python and Numpy is assumed. Every Python attribute script has 5 sections. The Imports Imports Section This is where external modules/libraries required by the script are loaded. At a minimum the script must load:

Continue reading