Wayne Mogg´s External Attribute

155 views
Skip to first unread message

Magnus Lidgren

unread,
Feb 14, 2024, 4:07:15 AMFeb 14
to us...@opendtect.org
Hi All,

Today I often use OpenDtect together with Wayne Mogg´s External Attribute to calculate "homemade" python written seismic attributes which are then delivered directly back into OpenDtect. This works extremely well.

To the Python script I have recently added a module that generates and popolates a PDF with some data statistics and graphs from the seismic attribute result. This also works as intended, but with some minor info backdraws.

I would like the script  to be able to put some basic info into the PDF like:
1, Name of Survey
2, Seismic input data name
3. Pathway to where the the survey is located

As OpenDtect keeps track of all names etc, External Attribute does not have to store names as the normal way the External Attribute works is to just recieve seismic data from OpenDtect and then deliver back the result.

So, I don´t know how to make the script to ask for these names, infos etc.

Could the new odbind Python module introduced in 7.0.3 be a way to get the script to catch and  incorporate basic Survey Info in the PDF.

Would be most grateful for any ideas.

Best Regards
Magnus Lidgren

 

wayne.mogg

unread,
Feb 15, 2024, 2:45:20 AMFeb 15
to OpendTect Users, Magnus Lidgren
Hi Magnus,
You are correct that the information you are after is not currently available in the External Attribute script but I think it would be pretty easy to add. The simplest solution would be to add this type of information to the attribute script parameters. I'd envisage you would then access the information in the doCompute method by:
xa.params['Survey']
xa.params['SurveyDiskLocation']
xa.params['Input Names']

Note the last input would be a Python list because, in general, there can be more than 1 input. Also keep in mind that the input to an attribute can be another attribute so the names in this item may not refer to a dataset on disk. Might also be good to have access to the name of the attribute set containing the attribute but I'll need to dig a bit further to see if I can find that out.

Without actually knowing what you are doing, I'd also think it would be possible to use the new odbind module to achieve your objective provided you are prepared to manage the data input, output and attribute calculation from Python. Although you can import odbind into your External Attribute script it won't know any more about where the data has come from.

Regards,
Wayne Mogg

Arnaud Huck

unread,
Feb 16, 2024, 8:07:30 AMFeb 16
to us...@opendtect.org, Magnus Lidgren

Dear Magnus, OpendTect users,

There is no doubt that you can fetch all this information and much more from the odbind python module:

Use the Survey class to get a list of your surveys (odbind.Survey.names()), or information on a specific survey (location, coordinates, lat/long). See the corresponding examples.
Use the Seismic3D or Seismic2D classes to get the list of seismic datasets in a survey, and then dataset specific information: odbind.Seismic3D.infos() is the starting point (example).

Whilst you can probably use odbind in a script that is intended to be run from the ExternalAttrib OpendTect attribute, I think that you could more directly make a python script dedicated to the production of such PDF files, with the odbind module. It would not need to run from within OpendTect, but like a normal python script.

In any case, we would welcome your contribution if you would be willing to share such a script with the community. It would be hosted within the OpendTect github repository along with the other examples for odbind. Thus if any user has produced scripts using the odbind module, and is willing to share them, please contact us.

Best regards,

Arnaud Huck, MSc.
Chief Technical Officer

dGB Earth Sciences
-----------------------------------------------------------------------------------------------------------------------  
dGB Earth Sciences
Phone:+31 53 4315155
E-mail:arnau...@dgbes.com
Internet:dgbes.com 
-----------------------------------------------------------------------------------------------------------------------


--
You received this message because you are subscribed to the Google Groups "OpendTect Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@opendtect.org.
To view this discussion on the web visit https://groups.google.com/a/opendtect.org/d/msgid/users/b701d47d-f665-4106-8a16-db6fb2459f39n%40opendtect.org.

magnus.lidgren

unread,
Feb 17, 2024, 7:10:30 AMFeb 17
to OpendTect Users, Arnaud Huck, Magnus Lidgren, wayne...@gmail.com
Hi Arnaud
and
Hi Wayne

Thank you both for your rapid reply regarding my External Attribute questions. As I explained in the original question, my interest is to be able to populate an output PDF with some essential basic survey input_names/output_names etc. when I run my home-made python script using External Attribute.  
I think that adding information to the External Attribute script parameters (is not currently available) as suggested by Wayne would do most of the trick, i.e. what I am looking for, thus high up on my wish list for future versions of External Attribute like:
xa.params['Survey']
xa.params['SurveyDiskLocation']
xa.params['Input Names']    and perhaps more……
and if possible also something like
xa.params['Input your own text string here to be part of title']

I use the External Attribute regularly as normally as it is intended, i.e. as the bridge between OpenDtect and “home-made” python scripts.  From within Opendtect - Seismic as input – my attribute as output. This works very well.
I also do some single trace in-depth analysis/statistics at multiple “interesting” locations within the seismic cube/survey I am working with. This I do by a python script (using Anaconda Spyder), using single trace data exported from OpenDtect as Ascii-text. Somewhat time consuming but works OK. I have however concluded that this script would be much better of as an External Attribute script.  I have now tested to do this and I find it much more smooth to work from inside OpenDtect. But, I lack to, directly within OpenDtect, be able to provide the PDF output file with the seismic input name, output PDF directory name etc. So, this is the reason for my “extra special need” now as described above.

But, experimenting, I have found an interim solution which I find OK but not optimal, goes like this:

1. I begin setting up things uniquely for the survey I´m presently working with. I copy the extattrib.py, extlib.py, extnumba.py
together with my Home-made_external_attribute.py the script folder of the survey i.e. C:\storage\400 - New Survey\001 - F3 Demo\F3_Demo\Scripts. Inside this folder I also create a subfolder \PDFs

2. I then edit the name of my home-made script to reflect the name of the seismic input I´m presently working with, i.e. Homemade_input_4 Dip steered median filter.py.

3. Inside the home-made script I also have to edit two lines (that will be printed on the PDF front page)  :

output_dir = 'C:/storage/400 - New Serveys/001 - F3 Demo/F3_Demo/Scripts/PDFs'
title = "4 Dip steered median filter"

That´s it – Survey-seismic set up done - ready to produce PDFs with desired frontpage info.

I am sure, and as you can see,  this may be done smarter…..

Best Regards
Magnus




Below just example of the essential scripting part for producing the PDF from External Attribute:

import numpy as np
from scipy.interpolate import interp1d
from scipy.interpolate import interp2d
import traceback
import tempfile
import random, string
import copy
import sys, os
import extattrib as xa
import matplotlib.pyplot as plt
from matplotlib import gridspec
import matplotlib
from matplotlib.backends.backend_pdf import PdfPages
matplotlib.rcParams.update({'font.size': 6})
import warnings
warnings.filterwarnings("ignore")
# Directory to generate output PDFs.
# Format: Use '/' instead of '\' for directories, e.g. 'C:/your/path/here'
#         A tilde '~' always points to the current user's home folder. On
#         Windows, this is usually something like 'C:/Users/{username}', and on
#         Linux this is usually '/home/{username}'. See the default output directory
#         above for an example.

output_dir = 'C:/storage/400 - New Serveys/001 - F3 Demo/F3_Demo/Scripts/PDFs'

# Title to display on the info page in the generated PDF and in the PDF name.
# Could be e.g. the name of the seismic data.
# Example: If title='Seismic', then the generated PDF will have the name
#       EnTrace-{title}_...-v{VERSION}.pdf
# and will have Seismic prominently displayed in the info page.
# title = "Seismic"
title = "4 Dip steered median filter"
# The attribute parameters
#
xa.params = {
    'Inputs': ['Input'],
    'Output': ['Trace',
    'Parallel' : False
}
#
# Define your compute function
#
def doCompute():

    # Create an output PDF file to write to.
    file_out_name = f"Trace-{title}_IL{int(IL)}_XL{int(XL)} .pdf'
    output_dir_path = os.path.expanduser(output_dir)
    outpath = os.path.join(output_dir_path, file_out_name)

with PdfPages(outpath) as pp_1:  # safer error handling, i'm told
        log(f"Created PDF to fill with plots. Path:\n\t{outpath}")
        log("Creating front page...")
        plt.figure(0, figsize=(11, 6))
        plt.axis('off')
        plt.text(-0.1, 1.05, f'Trace v{VERSION}', va='center', size=9)
        plt.text(0.1, 1.05, 'ExternalAttribute version', va='center', size=9, color='gray')
        plt.text(0.5,0.95,f'Seismic Input =  {title}', ha='center', va='center', size=11)
        plt.text(0.35,0.8,f'IL: {int(IL)}', ha='right', size=13)
        plt.text(0.65,0.8,f'XL: {int(XL)}', size=13)
        plt.text(-0.1, 0.0,f'Generated at: {output_dir_path}', size=9, color='gray')
        pp_1.savefig()
        plt.close()

wayne.mogg

unread,
Feb 22, 2024, 2:46:42 AMFeb 22
to OpendTect Users, magnus.lidgren, Arnaud Huck, wayne...@gmail.com
Hi Magnus,

The next release of the External Attribute plugin (due out with OpendTect 7.0.5 towards the end of March) will have:
  • xa.params['Survey'], xa.params['SurveyDiskLocation'],  xa.params['Input Names'] metadata available
  • a new input field for text
  • a modified file selection field with a Mode specification determining if the file selection is for an input file, output file or folder
This is what the scripts xa.params dictionary can look like in 7.0.5. The new and changed fields are highlighted in yellow.
xa.params = {
'Inputs': ['Input'],
'Output': ['Out'],
'ZSampMargin' : {'Value': [-30,30], 'Minimum': [-1,1], 'Symmetric': True, 'Hidden': False},
'StepOut' : {'Value': [1,1], 'Minimum': [1,1], 'Hidden': False},
'File Input' : {'Type': 'File', 'Mode':'FileIn', 'Value': 'Seismics/*.wvlt'},
'File Output' : {'Type': 'File', 'Mode':'FileOut', 'Value': 'Seismics/*.wvlt'},
'Dir' : {'Type': 'File', 'Mode':'Dir', 'Value': '*'},

'Number Input'  : {'Type': 'Number', 'Value': 1},
'String Input' : {'Type': 'Text', 'Value': 'Bla bla bla'},
'Another Number Input'  : {'Type': 'Number', 'Value': 10},
'New Selection' : {'Type': 'Select', 'Options':['New First','New Second','New Third'], 'Value':'New Second'},
'Another String Input' : {'Type': 'Text', 'Value': 'Some stuff'},
'Parallel' : False,
'Help'  : xa.HelpRoot
}

Magnus Lidgren

unread,
Feb 22, 2024, 2:46:50 AMFeb 22
to wayne.mogg, OpendTect Users, Arnaud Huck
Hi Wayne,

Thanks!
Very exciting. This will really make things much easier. Looking forward to the next release of the External Attribute plugin.

Best Regards
Magnus

Christopher Ross

unread,
Feb 22, 2024, 10:17:31 AMFeb 22
to us...@opendtect.org

Hi Magnus,

 

I’ve been following your email exchanges and wanted to ask you what are your scripts doing in OpendTect?  I am curious what statistics you are extracting and how you might use them.  Is this something you would share?

 

Thanx

 

Chris

 

 

Christopher P. Ross – 505.216.6525/505.989.4000

Cross Quantitative Interpretation, L.P.

--

You received this message because you are subscribed to the Google Groups "OpendTect Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to users+un...@opendtect.org.

Magnus Lidgren

unread,
Feb 28, 2024, 3:21:35 AMFeb 28
to us...@opendtect.org, cr...@crossqi.com
Hi Chris,

The software I am using is part of a company proprietary Direct Hydrocarbon Indicator algorithms system. As an employee in the company, the deep details of this system are unfortunately not mine to share. Only a brief description as below:

Primarily the “system” is a multi-attribute seismic analytical tool which as the main part studies dispersion and resonance events in conventional seismic data through a high-resolution spectral decomposition engine.
I,e, a strong dispersion signal may provide information about the likelihood of fluid type such as liquid hydrocarbons. Weak dispersion signatures in the seismic data for a target location correlates with a “tight rock” i.e. a rock without moveable liquid.
The result is used as complementary oil exploration de-risking info together with conventional G&G.

About the interaction with OpenDtect/External Attribute:
From a normal input single component 3D-SGY-cube we need to be able to calculate and store a multicomponent output cube.
 
OpenDtect together with Wayne Mogg´s External Attribute gives us the freedom to do this, thus we may comfortably transport seismic data to and from our own software/analysis tool and store the result in an essay accessible way. The External Attribute function has been proven for us to be the optimal seismic data I/O transport bridge.
 
When the result is calculated and returned to OpenDtect we then use OpenDtect as the Display Software as it has all the store, display and print out functions needed.
 
A “special case” is the in-depth single-trace analysis where a detailed “external” PDF report with graphs etc is generated. In this case no calculated result is returned to OpenDtect, only a “place marker” showing the trace and job ID and when and by whom the job has been done.
 
Upcoming update from Wayne Mogg of the External Attribute will make generating this PDF report even easier.

Best Regards
Magnus

Reply all
Reply to author
Forward
0 new messages