import struct


def get_fileheader(f):
    """
    Unpack file header parameters into list.

    Reads the 32-byte file header from file and unpacks into a list.  Endiness
    is corrected as needed.

    Returned list contents:

    =   =========   ======================================
    N   Variable    Description 
    =   =========   ======================================
    0   nblocks     data blocks in file    
    1   ntraces     traces per block  
    2   np          elements per trace
    3   ebytes      bytes per element
    4   tbytes      bytes per trace
    5   bbytes      bytes per block
    6   vers_id     software version, file_id status bits
    7   status      status of whole file
    8   nbheaders   number of block headers per block (1)
    =   =========   ======================================

    """
    # header is packed big-endian as 6 longs, 2 shorts, 1 long
    return struct.unpack('>6lhhl',f.read(32))