Create a new SEGY file from a 3D array
    Create an structured SEGY file with defaulted headers from a 3-dimensional
    array. The file is inline-sorted. ilines, xlines and samples are inferred
    from the array. Structure-defining fields in the binary header and
    in the traceheaders are set accordingly. Such fields include, but are not
    limited to iline, xline and offset. The file also contains a defaulted
    textual header.

    The 3-dimensional array is interpreted as::

             xl0   xl1   xl2
            -----------------
         / | tr0 | tr1 | tr2 | il0
           -----------------
       | / | tr3 | tr4 | tr5 | il1
            -----------------
       | / | tr6 | tr7 | tr8 | il2
            -----------------
       | /      /     /     / n-samples
         ------------------

    ilines =  [1, len(axis(0) + 1]
    xlines =  [1, len(axis(1) + 1]
    samples = [0, len(axis(2)]

    Parameters
    ----------
    filename : string-like
        Path to new file
    data : 3-dimensional array-like
    iline : int or segyio.TraceField
        Inline number field in the trace headers. Defaults to 189 as per the
        SEG-Y rev1 specification
    xline : int or segyio.TraceField
        Crossline number field in the trace headers. Defaults to 193 as per the
        SEG-Y rev1 specification
    format : int or segyio.SegySampleFormat
        Sample format field in the trace header. Defaults to IBM float 4 byte
    dt : int-like
        sample interval
    delrt : int-like

    Notes
    -----
    .. versionadded:: 1.8

    Examples
    --------
    Create a file from a 3D array, open it and read an iline:

    >>> segyio.tools.from_array3D(path, array3d)
    >>> segyio.open(path, mode) as f:
    ...     iline = f.iline[0]
    ...

def from_array3D(filename, data, iline=189,
                                 xline=193,
                                 format=SegySampleFormat.IBM_FLOAT_4_BYTE,
                                 dt=4000,
                                 delrt=0):
    """ Create a new SEGY file from a 3D array
    Create an structured SEGY file with defaulted headers from a 3-dimensional
    array. The file is inline-sorted. ilines, xlines and samples are inferred
    from the array. Structure-defining fields in the binary header and
    in the traceheaders are set accordingly. Such fields include, but are not
    limited to iline, xline and offset. The file also contains a defaulted
    textual header.

    The 3-dimensional array is interpreted as::

             xl0   xl1   xl2
            -----------------
         / | tr0 | tr1 | tr2 | il0
           -----------------
       | / | tr3 | tr4 | tr5 | il1
            -----------------
       | / | tr6 | tr7 | tr8 | il2
            -----------------
       | /      /     /     / n-samples
         ------------------

    ilines =  [1, len(axis(0) + 1]
    xlines =  [1, len(axis(1) + 1]
    samples = [0, len(axis(2)]

    Parameters
    ----------
    filename : string-like
        Path to new file
    data : 3-dimensional array-like
    iline : int or segyio.TraceField
        Inline number field in the trace headers. Defaults to 189 as per the
        SEG-Y rev1 specification
    xline : int or segyio.TraceField
        Crossline number field in the trace headers. Defaults to 193 as per the
        SEG-Y rev1 specification
    format : int or segyio.SegySampleFormat
        Sample format field in the trace header. Defaults to IBM float 4 byte
    dt : int-like
        sample interval
    delrt : int-like

    Notes
    -----
    .. versionadded:: 1.8

    Examples
    --------
    Create a file from a 3D array, open it and read an iline:

    >>> segyio.tools.from_array3D(path, array3d)
    >>> segyio.open(path, mode) as f:
    ...     iline = f.iline[0]
    ...
    """

    data = np.asarray(data)
    dimensions = len(data.shape)

    if dimensions != 3:
        problem = "Expected 3 dimensions, {} was given".format(dimensions)
        raise ValueError(problem)

    from_array(filename, data, iline=iline, xline=xline, format=format,
                                                         dt=dt,
                                                         delrt=delrt)