odbind.seismic3d
Classes
Enum where members are also (and must be) ints |
|
Enum where members are also (and must be) ints |
|
A class for an OpendTect seismic volume |
|
All the operations on a read-only sequence. |
|
All the operations on a read-only sequence. |
|
All the operations on a read-only sequence. |
Module Contents
- class odbind.seismic3d.SliceType
Bases:
enum.IntEnumEnum where members are also (and must be) ints
- Inline = 0
- Crossline = 1
- ZSlice = 2
- class odbind.seismic3d.MergeMode
Bases:
enum.IntEnumEnum where members are also (and must be) ints
- Average = 0
- Crop = 1
- Blend = 2
- class odbind.seismic3d.Seismic3D(survey: odbind.survey.Survey, name: str)
Bases:
odbind.survey._SurveyObjectA class for an OpendTect seismic volume
- classmethod _initbindings(bindnm)
- _trace
- _volume
- _iline
- _xline
- _zslice
- _chunk
- property bin_count: int
int : Number of bins within the extent of this seismic volume, number_of_bins>=number_of_traces
- 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 chunk
Return object for chunk mode access to the OpendTect seismc volume.
Returns
- Chunks3Dan object providing [chunk_idx] 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 shape: tuple[int, int, int]
tuple[nriln, nrcrl, nrz]: number of inlines, crosslines and z samples of 3D seismic volume (readonly)
- property ranges: collections.namedtuple
namedtuple[inlrg, crlrg, zrg]: inline, crossline and z range of 3D seismic volume (readonly)
- 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])
Read a rectangular block of data from the 3D seismic volume
Reads all components and various supporting data. Return format determined by current setting of Seismic3D.use_xarray.
- For Seismic3D.use_xarray == True:
The data is returned as an Xarray.Dataset with a data variable for each seismic
component. - The axes of the data variables will depend on the dimensionality of the data:
Single Trace: 1D Xarray Dataarray, with z sample index as the single axis.
Inline/Crossline Slice: 2D Xarray Dataarray, with first axis of crossline
number for Inline Slices and inline number for Crossline Slices. The second (last) axis is the z sample index. - Z Slice: 2D Xarray Dataarray, with inline number as the first axis and crossline number as the second axis. - Subvolume: 3D Xarray Dataarray, with inline number as the first axis, crossline number as the second axis and z sample index as the third (last) axis.
- The coordinates defined in the Xarray dataset are:
iline: inline number
xline: crossline number
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 Seismic3D.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
‘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(list[np.ndarray], dict) | Xarray.Datatset
see above for details
- putdata(indata)
Write a 3D seismic volume from either a tuple or Xarray.Dataset of 3D seismic data
See Seismic3D.getdata for details of the input formats. Note: - assumes components in ‘data’ list are in 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 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
- indatatuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for details
- infodict
at minimum require ‘iline, ‘xline’ and ‘twt|depth’ fields
- putblock(indata)
Write a 3D seismic chunk from either a tuple or Xarray.Dataset of 3D seismic data with averaging, blending or cropping of any overlap of chunks.
Note chunks should be written out in inline order
See Seismic3D.getdata for details of the input formats. Note: - only first components is saved - 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
- indatatuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for details
- infodict
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)
- to_xarray(data: list[numpy.ndarray], info: dict)
Convert 3D seismic data in simple list+dict format to an Xarray Dataset
See Seismic3D.getdata for details of the input and output formats.
Parameters
- datalist[np.ndarray]
seismic data for each of the components, in iline, xline, z axis order
- infodict
at minimum require ‘iline, ‘xline’ and ‘twt|depth’ fields
Returns
Xarray.Dataset
- from_xarray(xrdata) tuple
Convert 3D seismic data in Xarray.Dataset to simple list+dict format
See Seismic3D.getdata for details of the input and output formats. Note: - only coordinates iline, xline and twt|depth need to be present in the dataset
Parameters
xrdata : Xarray.Dataset
Returns
data : list[np.ndarrays], one array per seismic component info : dict
- class odbind.seismic3d.Trace3D(seis: Seismic3D)
Bases:
collections.abc.SequenceAll the operations on a read-only sequence.
Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.
- _seis3d
- wrapindex(i)
- __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. Raises an IndexError exception if the inl, crl location is 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.
Note: - slice ranges are inclusive of both ends (unlike Python ranges which 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(list[np.ndarray], dict) | Xarray.Datatset | generator
see Seismic3D.getdata for output format details
- __setitem__(idx, data)
Write trace data to the associated OpendTect 3D seismic volume. Only supports index mode trace[:].
Parameters
idx : [:] data: tuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for details
- __len__()
x.__len__() <==> len(x)
- class odbind.seismic3d.Slice3D(seis: Seismic3D, slice_type: SliceType)
Bases:
collections.abc.SequenceAll the operations on a read-only sequence.
Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.
- _seis3d
- _slicetype
- __len__()
x.__len__() <==> len(x)
- __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.
Note: - slice ranges are inclusive of both ends (unlike Python ranges which normally exclude the end index). - negative inline/crossline indices and slices are allowed but don’t cause wrap around.
- 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.ndarray], dict) | Xarray.Datatset | generator
see Seismic3D.getdata for output format details
- class odbind.seismic3d.Volume3D(seis: Seismic3D)
- _seis3d
- __getitem__(idx)
Get a rectangular subvolume using either volume(inline_slice, crossline_slice, Z_range_list) or volume(inline_slice, crossline_slice, zsample_slice)
[slice, slice, slice] return a volume based on inline, crossline and z sample index [slice, slice, [start, stop, step]] return a volume based on inline, crossline and z range
Note: - the slice ranges are inclusive of both ends (unlike Python ranges which normally exclude the end index). - The returned data 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.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for output format details
- class odbind.seismic3d.Chunks3D(seis: Seismic3D)
Bases:
collections.abc.SequenceAll the operations on a read-only sequence.
Concrete subclasses must override __new__ or __init__, __getitem__, and __len__.
- _seis3d
- property chunkshape
- property overlap
- property mergemode
- property ranges
namedtuple[inlrg, crlrg, zrg]: inline, crossline and z range of the 3D seismic volume to chunk (readonly)
- property shape: tuple[int, int, int]
tuple[nriln, nrcrl, nrz]: number of inlines, crosslines and z samples of 3D seismic volume being chunked (readonly)
- set_chunkpars(volume=([], [], []), chunkshape=(100, 100, 100), overlap=(0, 0, 0), mergemode=MergeMode.Blend)
Set chunking parameters
Parameters:
- volumetuple[list[inlstart, inlstop, inlstep], list[crlstart,crlstop, crlstep], listzstart, zstop, zstep]
the subvolume to source chunks from, default is the entire volume
- chunkshapetuple[int]
the chunk dimensions as (inline, crossline, zsamples)
- overlaptuple[int]
the overlap between chunks as (inline_overlap, crossline_overlap, zsample_overlap)
- mergemodeMergeMode
how to handle data in the overlap, options are MergeMode.Average, MergeMode.Clip and MergeMode.Blend Average is just a simple mean of the overlapping chunks Clip is just discard the outer half of the overlap for each chunk (like a splice join halfway through the overlap) Blend is a cosine taper each chunk in the overlap and average
- __getitem__(idx)
Get the chunk at the given index
Parameters
- idxint
chunk index between 0 and len(chunks)
Returns
- tuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for output format details
- __setitem__(idx, vol)
Write the chunk to the seismic volume. Only supports index mode volume[:].
Parameters
idx : [:] vol : tuple(list[np.ndarray], dict) | Xarray.Datatset
see Seismic3D.getdata for output format details
- _compute_number_of_chunks()
Recompute the number of chunks
- subvol(idx)
Return the inline, crossline and zsample ranges of the chunk at the given index
Chunks are ordered so the zsample ranges change the fastest and inline ranges te slowest
Parameters:
- idxint
the chunk index. Negative indicies are wrapped
Returns:
- tuple[list[int], list[int], list[int]]
(inline range, crossline range, zsample range)