nodes: 0, module; 1, function_definition; 2, function_name:from_array3D; 3, parameters; 4, block; 5, identifier:filename; 6, identifier:data; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, if_statement; 16, expression_statement; 17, identifier:iline; 18, integer:189; 19, identifier:xline; 20, integer:193; 21, identifier:format; 22, attribute; 23, identifier:dt; 24, integer:4000; 25, identifier:delrt; 26, integer:0; 27, comment:""" 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]
      ...
      """; 28, assignment; 29, assignment; 30, comparison_operator:dimensions != 3; 31, block; 32, call; 33, identifier:SegySampleFormat; 34, identifier:IBM_FLOAT_4_BYTE; 35, identifier:data; 36, call; 37, identifier:dimensions; 38, call; 39, identifier:dimensions; 40, integer:3; 41, expression_statement; 42, raise_statement; 43, identifier:from_array; 44, argument_list; 45, attribute; 46, argument_list; 47, identifier:len; 48, argument_list; 49, assignment; 50, call; 51, identifier:filename; 52, identifier:data; 53, keyword_argument; 54, keyword_argument; 55, keyword_argument; 56, keyword_argument; 57, keyword_argument; 58, identifier:np; 59, identifier:asarray; 60, identifier:data; 61, attribute; 62, identifier:problem; 63, call; 64, identifier:ValueError; 65, argument_list; 66, identifier:iline; 67, identifier:iline; 68, identifier:xline; 69, identifier:xline; 70, identifier:format; 71, identifier:format; 72, identifier:dt; 73, identifier:dt; 74, identifier:delrt; 75, identifier:delrt; 76, identifier:data; 77, identifier:shape; 78, attribute; 79, argument_list; 80, identifier:problem; 81, string:"Expected 3 dimensions, {} was given"; 82, identifier:format; 83, identifier:dimensions
code: 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)