odbind.horizon3d

Classes

Horizon3D

A class for an OpendTect 3D horizon

Module Contents

class odbind.horizon3d.Horizon3D(survey: Survey, name: str)

Bases: odbind.survey._SurveyObject

A class for an OpendTect 3D horizon

classmethod _initbindings(bindnm)
property attribnames: list[str]

list[str]: Names of attributes attached to this 3D horizon (readonly)

property ranges: collections.namedtuple

namedtuple[inlrg, crlrg, zrg]: inline and crossline of the 3D horizon (readonly)

classmethod create(survey: odbind.survey.Survey, name: str, inl_rg: list[int], crl_rg: list[int], overwrite: bool = False)

Create a new OpendTect 3D horizon object

Parameters

surveySurvey

An OpendTect survey object

namestr

OpendTect 3D horizon name

inl_rglist[int]

The inline range (start, stop and step) for the horizon

crl_rglist[int]

The crossline range (start, stop and step) for the horizon

overwritebool=False

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

Returns

A Horizon3D object

__enter__()
__exit__(type, value, traceback)
get_z()

Get the 3D horizon Z values as a Numpy array

Returns

Numpy 2D array with the horizon Z values

get_xy()

Get the 3D horizon X,Y values as Numpy arrays

Returns

Tuple of Numpy 2D arrays with the horizon X, Y values

get_attrib(attribname: str)

Get a 3D horizon attribute as a Numpy array

Parameters

attribnamestr

The attribute to get

Returns

Numpy 2D array with the horizon attribute values

getdata(attribnms: list[str] = [])

Return the 3D horizon data

Return format determined by current setting of Horizon3D.use_xarray.

For Horizon3D.use_xarray == True:
  • The data is returned as a 2D Xarray.Dataset with the z values and horizon data as data variables.

  • The axes of the data variables are inline number (first) and crossline (second).

  • 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

  • The OpendTect data object name, survey CRS and z value units are included as attributes.

For Horizon3D.use_xarray == False:
  • The data is returned as a tuple of:
    • a list of numpy arrays (length of the list must be the same as the length of the ‘comp’ info dict item)

    • a Python dict with information about the data

  • The information dict has the following keys and data:
    • ‘comp’: list[str] names of data components as they are present in the data array, at minumum “z”

    • ‘iline’: list[int] with the inline start, stop and step

    • ‘xline’: 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

Parameters

attribslist[str] = []

list of attributes to include, default is none

Returns

tuple(list[np.ndarray], dict) | Xarray.Datatset

see above for details

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

Convert 3D horizon data in simple list+dict format to an Xarray Dataset

See Horizon3D.getdata for details of the input and output formats.

Parameters

datalist[np.ndarray]

Z and any included horizon data, in iline, xline axis order

infodict

at minimum require ‘comp’, ‘iline, and ‘xline’ fields

Returns

Xarray.Dataset

from_xarray(xrdata) tuple

Convert 3D horizon data in Xarray.Dataset to simple list+dict format

See Horizon3D.getdata for details of the input and output formats. Note: - only coordinates iline, xline need to be present in the dataset

Parameters

xrdata : Xarray.Dataset

Returns

data : list[np.ndarrays], one array per “Z” and horizon data info : dict

putdata(indata)

Write 3D horizon data from either simple list+dict format or Xarray.Dataset

See Horizon3D.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 Horizon3D.getdata for details

put_z(data, inlrg: list[int], crlrg: list[int])

Save the 3D horizon Z values from the data Numpy 2D array

Parameters

datanumpy.ndarray

Horizon Z values

inlrglist[int]

Inline start, stop and step

crlrglist[int]

Crossline start, stop and step

put_auxdata(name: str, data, inlrg: list[int], crlrg: list[int])

Save the 3D horizon attribute data from a numpy 2D array

Parameters

namestr

Horizon attribute name

datanumpy.ndarray

Horizon sttribute values

inlrglist[int]

Inline start, stop and step

crlrglist[int]

Crossline start, stop and step

delete_attribs(attribnms: list[str] = [])

Delete the listed attributes from the 3D horizon

Parameters

attribnmslist[str]

list of attribute names to be deleted

Returns

bool : True/False indicating success/failure