odbind.seismic3d

Module Contents

Classes

SliceType

Generic enumeration.

Seismic3D

A class for an OpendTect seismic volume

Trace3D

All the operations on a read-only sequence.

Slice3D

All the operations on a read-only sequence.

Volume3D

class odbind.seismic3d.SliceType

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

Inline = 0
Crossline = 1
ZSlice = 2
class odbind.seismic3d.Seismic3D(survey: odbind.survey.Survey, name: str)

Bases: odbind.survey._SurveyObject

A class for an OpendTect seismic volume

property bin_count: int

int : Number of bins within the extent of this seismic volume, number_of_bins>=number_of_traces

property comp_names: list[str]

list[str]: Names of components in this seismic volume (readonly)

property trace

Return object for trace mode access to the OpendTect seismc volume.

Returns

Trace3Dan object providing [trace_number], [inline, crossline], [trace_number slice] or [inline slice, crossline slice] indexing

into an OpendTect 3D seismic volume.

property volume

Return object for volume mode access to the OpendTect seismc volume.

Returns

Volume3Dan object providing [inline slice, crossline slice, zsample slice] indexing

into an OpendTect 3D seismic volume.

property iline

Return object for inline mode access to the OpendTect seismc volume.

Returns

Slice3Dan object providing [inline_number] and [inline_slice] indexing

into an OpendTect 3D seismic volume.

property xline

Return object for crossline mode access to the OpendTect seismc volume.

Returns

Slice3Dobject providing [crossline_number] and [crossline_slice] indexing

into an OpendTect 3D seismic volume.

property zslice

Return object for Z slice mode access to the OpendTect seismc volume.

Returns

Slice3Dan object providing [zslice_number] and [zslice_slice] indexing

into an OpendTect 3D seismic volume.

property trace_count: int

int : Expected number of traces in this seismic volume.

property ranges: collections.namedtuple

namedtuple[inlrg, crlrg, zrg]: inline, crossline and z range of 3D seismic volume (readonly)

classmethod _initbindings(bindnm)
classmethod create(survey: odbind.survey.Survey, name: str, inl_rg: list[int], crl_rg: list[int], z_rg: list[float], components: list[str] = ['Component 1'], fmt: str = 'CBVS', zistime: bool = True, overwrite: bool = False)

Create a new OpendTect 3D seismic volume object

Parameters

surveySurvey

An OpendTect survey object

namestr

OpendTect 3D seismic volume name

inl_rg : list[int] crl_rg : list[int] z_rg : list[float] compnames : list[str] = [‘Component 1’]

Output component names

formatstr=’CBVS’

Output format type string, either ‘CBVS’ or ‘SEGYDirect’

zistimebool=True

Flag to indicate the Z domain of the new volume

overwritebool=False

Flag to indicate if the new volume can replace an existing volume of the same name

Returns

A Seismic3D object

__enter__()
__exit__(type, value, traceback)
close()
z_index(zval: float) int

Return the z index for a given z value in this seismic volume

A returned index of -1 corresponds to a zval outside the dataset

Parameters

zvalfloat

the z value.

Returns

int : the corresponding z index or -1 if the z value is outside the seismic volume

z_value(zidx: int) float

Return the z value for a given z index in this seismic volume

if zidx is outside the datset returns NaN

Parameters

zidxint

the z index.

Returns

float : the corresponding z value or NaN if the z index is outside the seismic volume

trace_index(inline: int, crossline: int) int

Return the trace index for a given inline, crossline location in this seismic volume.

The first trace has an index of 0, the last trace has an index of number_of_traces-1. An index of -1 corresponds to an invalid inline,crline location.

Parameters

inlineint

the inline number.

crosslineint

the crossline number.

Returns

int : the corresponding trace number or -1 if the inline, crossline location is not within the seismic volume

bin(trace_index: int) tuple[int]

Return a tuple with the inline and crossline of the trace_index’th trace in this seismic volume

Parameters

trace_indexint

the trace index (first trace has an index of 0, last trace has an idex of number_of_traces-1)

Returns

tuple[int] : with the corresponding inline and crossline location

getdata(inlrg: list[int], crlrg: list[int], zrg: list[float]) tuple

Read a rectangular block of data from the 3D seismic volume

Reads all components and various supporting data and returns a tuple of: - a Python dict with information about the data - a numpy array for each seismic component

The information dict has the following keys and data: - ‘comp’: list[str] of the seismic component names - ‘iline’: int | list[int] with the inline start, stop and step - ‘xline’: int | list[int] with the crossline start, stop and step - ‘x’: double | np.ndarray(double) with the x coordinates of the traces - ‘y’: double | np.ndarray(double) with the y coordinates of the traces - ‘twt’ | ‘depth’: float | list[float] with the Z start, stop and step (in display units) - ‘dims’: list[str] dimensions of the trace data

Parameters

inlrglist[int]

Inline start, stop and step to read

crlrglist[int]

Crossline start, stop and step to read

zrglist[float]

Z start, stop and step to read (in display units)

Returns

tuple : info dict and list[np.ndarrays], one array per seismic component

putdata(data: list[numpy.ndarray], info: dict)

Write a data block to a 3D seismic volume

Note: - assumes components in ‘data’ list are in same order as returned by comp_names property - if len(data)>len(comp_names), extra data items are ignored - if len<data)<len(comp_names), missing data items are zero filled - raises ValueError if geometry in info dict is incompatible with data shape - only data compatible with the ranges specified in the seismic volume creation call (ie inside and on the sample grid) are saved

Parameters

datalist[np.ndarray]

seismic data for each of the components, in iline, xline, z axis order

infodict

as returned by the _getdata_byrange method, at minimum require ‘iline, ‘xline’ and ‘twt|depth’ fields

putdata_byrange(data, inlrg: list[int], crlrg: list[int], zrg: list[float])

Write a rectangular block of data to a 3D seismic volume

See notes of _putdata method

Parameters

data : list|tuple[np.ndarray(float)] inlrg : list[int]

Inline start, stop and step of the data

crlrglist[int]

Crossline start, stop and step of the data

zrglist[float]

Z start, stop and step of the data (in display units)

as_xarray(data: list[numpy.ndarray], info: dict)

Convert data returned by _getdata_byrange method to Xarray Dataset

Parameters

datalist[np.ndarray]

seismic data for each of the components, in iline, xline, z axis order

infodict

as returned by the _getdata_byrange method, at minimum require ‘iline, ‘xline’ and ‘twt|depth’ fields

Returns

Xarray.Dataset

is_seisdata(data: tuple[list[numpy.ndarray], dict]) bool
class odbind.seismic3d.Trace3D(seis: Seismic3D)

Bases: collections.abc.Sequence

All the operations on a read-only sequence.

Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.

property seis3d: Seismic3D
wrapindex(i)
is_tracedata(data: tuple[list[numpy.ndarray], dict]) bool
__getitem__(idx)

Either trace[trace_number], trace[inl, crl], trace[trace_number_slice] or trace[inline_slice, crossline_slice]

[trace_number] returns a single trace, negative indices wrap around. [inl, crl] return the single trace at the given iln, crl location. Negatice indices don’t wrap. An Index Error exception is raised if the given inl, crl pair are outside the volume . [slice] return a generator for a range of trace numbers. [slice, slice] return a generator for all traces in a rectangular subvolume where the 2 slices specify the inline and crossline ranges.

Reads all components and various supporting data and returns a tuple of: - a Python dict with information about the data - a numpy array for each seismic component

The information dict has the following keys and data: - ‘comp’: list[str] of the seismic component names - ‘iline’: int - ‘xline’: int - ‘x’: double - ‘y’: double - ‘twt’ | ‘depth’: float | list[float] with the Z start, stop and step - ‘dims’: [‘twt|depth’]

It should be noted that: - the full trace length and all components in the volume is returned in all cases. - the slice ranges are inclusive of both ends. This is consistent with the definition of ranges in OpendTect but not Python where slices normally exclude the end index. - for trace number indices and slices negative indices wrap around. - negative inline/crossline indices and slices are allowed but don’t cause wrap around. - OpendTect 3D seismic data is generally stored for fast access along inlines (ie crossline number changes more rapidly). Incremental access to traces by trace number will therefore access the data so that the crossline number changes most rapidly.

Examples:

[200] return the 200th trace in the volume [-1] return the last trace in the volume [300, 400] return the trace at inline 300 and crossline 400 [200:200, :] returns a generator for all traces on inline 200 [:, 300:300] returns a generator for all traces on crossline 300 [200:300,400:450] returns a generator for all traces in a subvolume of 101 inlines, 51 crosslines.

Parameters

idx : int | (int, int) | slice | (slice, slice)

Returns

tuple : info dict and list[np.ndarrays], one array per seismic component or generator of tuple of info dict and list[np.ndarrays]

__setitem__(idx, trc)

Write trace data to the associated OpendTect 3D seismic volume, either trace[trace_number], trace[inline, crossline], trace[trace_number_slice] or trace[:,:].

Note the following indexing modes make it possible to override the actual inline, crossline of the ouput trace. The input data can be either tuple[list[np.ndarray], dict] (as returned by __getitem__ and Seismic3D.getdata), numpy ndarray or list/tuple[np.ndarray]: [trace_number] write a single trace at the specified position. [inl, crl] writes a single trace at the given inline,crossline location. [slice] writes a sequence of traces at the locations specified by the slice.

The following index mode ensures the output trace has the same (inline,crossline) as the input. It requires the input data to be tuple[list[np.ndarray], dict] as returned by __getitem__ and Seismic3D.getdata: [:,:] writes traces at the inline, crossline location in the associated info dict.

Notes: - raises an IndexError if the location implied by the indices is outside the seismic volume definition. - in the case of [in, crl] and [inline_slice, crossline_slice] indices incompatible data is ignored.

Parameters

idx : int, tuple[int,int], slice, tuple[:,:]

trc: tuple[list[np.ndarrays], dict] for tuple[:,:]

tuple[list[np.ndarrays], dict], tuple|list[np.ndarray] or np.ndarray

__len__()

x.__len__() <==> len(x)

class odbind.seismic3d.Slice3D(seis: Seismic3D, slice_type: SliceType)

Bases: collections.abc.Sequence

All the operations on a read-only sequence.

Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.

property seis3d: Seismic3D
__len__()

x.__len__() <==> len(x)

is_slicedata(data: tuple[list[numpy.ndarray], dict]) bool
slicerg_for(idx: int) tuple[list]
__getitem__(idx)

Either [number] or [number_slice] for slice types of inline, crossline or zsclice.

[number] returns a single inline, crossline or zslice depending on the slice type. [number_slice] return a generator for a range of inline, crossline or zslice numbers depending on the slice type. For Z slices the index is the sample index.

Reads all samples, all components and various supporting data for the slice and returns 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 - ‘iline’: int (for inline slice) or list[int] with the inline start, stop and step - ‘xline’: int (for crossline slice) or list[int] with the crossline start, stop and step - ‘x’: double | np.ndarray(double) with the x coordinates of the traces - ‘y’: double | np.ndarray(double) with the y coordinates of the traces - ‘twt’ | ‘depth’: float (for z slice) or list[float] with the Z start, stop and step - ‘dims’: [‘iline|xline’, ‘twt|depth’] for inline or crossline slices or [‘iline’, ‘zline’] for z slices

Note the ranges are inclusive of both ends. This is consistent with the definition of ranges in OpendTect but not Python where slices normally exclude the end index.

The returned numpy arrays will have axes ordered as inline, crossline, z.

Examples:

[200] return inline, crossline or zslice 200 from the seismic volume. [400:500] returns a generator for inlines, crosslines or zslices 400 to 500 [400:500:5] returns a generator for inlines 400, 405, 410,…, 495, 500

Parameters

idx : int | slice

Returns

tuple[list[np.ndarrays], dict] or generator of tuple[list[np.ndarrays], dict]

__setitem__(idx, data)

Write a slice to the associated OpendTect 3D seismic volume. Only supports index mode iline|xline|zslice[:].

class odbind.seismic3d.Volume3D(seis: Seismic3D)
property seis3d: Seismic3D
is_volumedata(data: tuple[list[numpy.ndarray], dict]) bool
__getitem__(idx)

Get a rectangular subvolume using either volume(inline_slice, crossline_slice, Z_range_list) or volume(inline_slice, crossline_slice, zsample_slice)

Reads all components and various supporting data and returns a tuple of: - a Python dict with information about the data - a numpy array for each seismic component

The information dict has the following keys and data: - ‘comp’: list[str] of the seismic component names - ‘iline’: int | list[int] with the inline start, stop and step - ‘xline’: int | list[int] with the crossline start, stop and step - ‘x’: double | np.ndarray(double) with the x coordinates of the traces - ‘y’: double | np.ndarray(double) with the y coordinates of the traces - ‘twt’ | ‘depth’: float | list[float] with the Z start, stop and step - ‘dims’: [list[str] dimensions of the trace data

It should be noted that: - the full trace length and all components in the volume is returned in all cases. - the slice ranges are inclusive of both ends. This is consistent with the definition of ranges in OpendTect but not Python where slices normally exclude the end index. - OpendTect 3D seismic data is generally stored for fast access along inlines (ie crossline number changes more rapidly). The returned numpy array will have axes ordered inline, crossline, z.

Examples: - [200:300,400:450,[200,800,4]] returns a subvolume of 101 inlines, 51 crosslines and 151 z samples between 200 and 800 ms/m depending

on the Z domain.

  • [200:300,400:450,50:200:1] returns a subvolume of 101 inlines, 51 crosslines and 151 z samples. The Z range will depend on the data z sampling. Assuming it is a twt volume, z sampling starts at 0 and the sampling step is 4ms, the Z range of the subvolume would be 200 to 800ms.

Parameters

idx : (slice,slice,list) or (slice, slice, slice)

Returns

tuple[list[np.ndarrays], dict]

__setitem__(idx, vol)

Write a rectangular subvolume to the associated OpendTect 3D seismic volume. Only supports index mode volume[:].

Note only supports input data in the tuple[list[np.ndarray], info dict] as returned by __getitem__ and Seismic3D.getdata). The info dict must contain the ‘iline’, ‘xline’ and ‘twt/depth’ keys that describe the data volume. Data will be saved to the output volume accordingly. Data outside the output volume definition is ignored.

Parameters

idx : [:]

vol: tuple[list[np.ndarrays], info dict]