odbind.horizon3d ================ .. py:module:: odbind.horizon3d Classes ------- .. autoapisummary:: odbind.horizon3d.Horizon3D Module Contents --------------- .. py:class:: Horizon3D(survey: Survey, name: str) Bases: :py:obj:`odbind.survey._SurveyObject` A class for an OpendTect 3D horizon .. py:method:: _initbindings(bindnm) :classmethod: .. py:property:: attribnames :type: list[str] list[str]: Names of attributes attached to this 3D horizon (readonly) .. py:property:: ranges :type: collections.namedtuple namedtuple[inlrg, crlrg, zrg]: inline and crossline of the 3D horizon (readonly) .. py:method:: create(survey: odbind.survey.Survey, name: str, inl_rg: list[int], crl_rg: list[int], overwrite: bool = False) :classmethod: Create a new OpendTect 3D horizon object Parameters ---------- survey : Survey An OpendTect survey object name : str OpendTect 3D horizon name inl_rg : list[int] The inline range (start, stop and step) for the horizon crl_rg : list[int] The crossline range (start, stop and step) for the horizon overwrite : bool=False Flag to indicate if the new horizon can replace an existing horizon of the same name Returns ------- A Horizon3D object .. py:method:: __enter__() .. py:method:: __exit__(type, value, traceback) .. py:method:: get_z() Get the 3D horizon Z values as a Numpy array Returns ------- Numpy 2D array with the horizon Z values .. py:method:: get_xy() Get the 3D horizon X,Y values as Numpy arrays Returns ------- Tuple of Numpy 2D arrays with the horizon X, Y values .. py:method:: get_attrib(attribname: str) Get a 3D horizon attribute as a Numpy array Parameters ---------- attribname : str The attribute to get Returns ------- Numpy 2D array with the horizon attribute values .. py:method:: 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 ---------- attribs : list[str] = [] list of attributes to include, default is none Returns ------- tuple(list[np.ndarray], dict) | Xarray.Datatset see above for details .. py:method:: 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 ---------- data : list[np.ndarray] Z and any included horizon data, in iline, xline axis order info : dict at minimum require 'comp', 'iline, and 'xline' fields Returns ------- Xarray.Dataset .. py:method:: 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 .. py:method:: 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