odbind.seismic2d
Classes
A class for an OpendTect 2D seismic dataset |
Module Contents
- class odbind.seismic2d.Seismic2D(survey: odbind.survey.Survey, name: str)
Bases:
odbind.survey._SurveyObjectA class for an OpendTect 2D seismic dataset
- classmethod _initbindings(bindnm)
- classmethod create(survey: odbind.survey.Survey, name: str, components: list[str] = ['Comp1'], fmt: str = 'CBVS', zistime: bool = True, overwrite: bool = False)
Create a new OpendTect 2D seismic dataset object
Parameters
- surveySurvey
An OpendTect survey object
- namestr
OpendTect 2D seismic dataset name
- compnameslist[str] = [‘Comp1’]
Output component names
- formatstr=’CBVS’
Output format type string, either ‘CBVS’ or ‘SEGYDirect’
- zistimebool=True
Flag to indicate the Z domain of the new dataset
- overwritebool=False
Flag to indicate if the new dataset can replace an existing dataset of the same name
Returns
A Seismic2D object
- __enter__()
- __exit__(type, value, traceback)
- close()
- line_info(forlinenms: list[str] = [])
Return basic information for all or a subset of lines in this 2D dataset.
Parameters
- forlinenmslist[str]=[]
(Optional) a list of line names to use. For an empty list information for all lines in the dataset is provided.
Returns
dict or Pandas DataFrame depending on the value of Seismic2D.use_dataframe
- getdata(linenm: str)
Return the 2D seismic data for the given linenm
Reads all components and various supporting data. Return format determined by current setting of Seismic2D.use_xarray.
- For Seismic2D.use_xarray == True:
The data is returned as an Xarray.Dataset with a data variable for each seismic
component. - Each data variable will be a 2D Xarray Dataarray with trace number as the first axis of trace number and z sample index as the second (last) axis. - The coordinates defined in the Xarray dataset are:
line: the line name
trc: the trace numbers
ref: the source/shot point number at the trace location
x: Trace easting in the survey CRS
y: Trace northing in the survey CRS
twt/depth: Trace z samples in milliseconds for twt and m/ft for depth
The OpendTect data object name, survey CRS and units are added to the Xarray Dataset
as attributes.
- For Seismic2D.use_xarray == False:
- The data is returned as a tuple of:
a list of numpy arrays, one for each seismic component
a Python dict with information about the data
- The information dict has the following keys and data:
‘comp’: list[str] of the seismic component names
‘line’: str of the line name
‘trc’: np.ndarray(int) with the trace numbers
‘ref’: np.ndarray(float) with the SP numbers
‘x’: np.ndarray(double) with the x coordinates of the traces
‘y’: np.ndarray(double) with the y coordinates of the traces
‘twt’ | ‘depth’: list[float] with the Z start, stop and step (in display units)
‘dims’: list[str] dimensions of the trace data
Parameters
- linenmstr
line name to read
Returns
tuple : list[np.ndarrays], one array per seismic component and info dict or Xarray.Dataset depending on the value of Seismic2D.use_xarray
- to_xarray(data: list, info: dict)
Convert 2D seismic data in simple list+dict format to an Xarray Dataset
See Seismic2D.getdata for details of the input and output formats.
Parameters
data : list[np.ndarrays], one array per seismic component info : dict
Returns
Xarray.Dataset
- from_xarray(xrdata) tuple
Convert 2D seismic data in Xarray.Dataset to tuple format
See Seismic2D.getdata for details of the input and output formats.
Parameters
xrdata : Xarray.Dataset
Returns
data : list[np.ndarrays], one array per seismic component info : dict
- putdata(linenm: str, indata, creategeom: bool, overwrite: bool)
Write a 2D seismic line from either a tuple or Xarray.Dataset of 2D seismic data
See Seismic2D.getdata for details of the input formats. Note: - assumes components are in the same order as returned by comp_names property - if number of components>len(comp_names), extra data items are ignored - if number of components<len(comp_names), missing data items are zero filled - raises ValueError if geometry is incompatible with data shape - if creategeom=False only traces in the defined geometry are saved
Parameters
- linenmstr
2D line name
- indatatuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic2D.getdata for details
- creategeom: bool
if True and info contains the required information (‘trc’, ‘ref’, ‘x’, ‘y’ and ‘twt|depth’ fields) the 2D line geometry is created/overwritten
- overwrite: bool
if True and the line name already exists in the dataset it is replaced