Load a numpy binary file or archive created by tabular.io.savebinary.
    
    Load a numpy binary file (``.npy``) or archive (``.npz``) created by 
    :func:`tabular.io.savebinary`.

    The data and associated data type (e.g. `dtype`, including if given, column 
    names) are loaded and reconstituted.

    If `fname` is a numpy archive, it may contain additional data giving 
    hierarchical column-oriented structure (e.g. `coloring`).  See 
    :func:`tabular.tab.tabarray.__new__` for more information about coloring.

    The ``.npz`` file is a zipped archive created using :func:`numpy.savez` and 
    containing one or more ``.npy`` files, which are NumPy binary files created 
    by :func:`numpy.save`.

    **Parameters**

        **fname** : string or file-like object

            File name or open numpy binary file (``.npy``) or archive 
            (``.npz``) created by :func:`tabular.io.savebinary`.

            * When `fname` is a ``.npy`` binary file, it is reconstituted as a 
              flat ndarray of data, with structured dtype.

            * When `fname` is a ``.npz`` archive, it contains at least one 
              ``.npy`` binary file and optionally another:

            * ``data.npy`` must be in the archive, and is reconstituted as `X`, 
              a flat ndarray of data, with structured dtype, `dtype`.

            * ``coloring.npy``, if present is reconstitued as `coloring`, a 
              dictionary.

    **Returns**

        **X** : numpy ndarray with structured dtype

            The data, where each column is named and is of a uniform NumPy data 
            type.

        **dtype** :  numpy dtype object

            The data type of `X`, e.g. `X.dtype`.

        **coloring** :  dictionary, or None

            Hierarchical structure on the columns given in the header of the 
            file; an attribute of tabarrays.

        See :func:`tabular.tab.tabarray.__new__` for more information about 
        coloring.

    **See Also:**

        :func:`tabular.io.savebinary`, :func:`numpy.load`, 
        :func:`numpy.save`, :func:`numpy.savez`

def loadbinary(fname):
    """
    Load a numpy binary file or archive created by tabular.io.savebinary.
    
    Load a numpy binary file (``.npy``) or archive (``.npz``) created by 
    :func:`tabular.io.savebinary`.

    The data and associated data type (e.g. `dtype`, including if given, column 
    names) are loaded and reconstituted.

    If `fname` is a numpy archive, it may contain additional data giving 
    hierarchical column-oriented structure (e.g. `coloring`).  See 
    :func:`tabular.tab.tabarray.__new__` for more information about coloring.

    The ``.npz`` file is a zipped archive created using :func:`numpy.savez` and 
    containing one or more ``.npy`` files, which are NumPy binary files created 
    by :func:`numpy.save`.

    **Parameters**

        **fname** : string or file-like object

            File name or open numpy binary file (``.npy``) or archive 
            (``.npz``) created by :func:`tabular.io.savebinary`.

            * When `fname` is a ``.npy`` binary file, it is reconstituted as a 
              flat ndarray of data, with structured dtype.

            * When `fname` is a ``.npz`` archive, it contains at least one 
              ``.npy`` binary file and optionally another:

            * ``data.npy`` must be in the archive, and is reconstituted as `X`, 
              a flat ndarray of data, with structured dtype, `dtype`.

            * ``coloring.npy``, if present is reconstitued as `coloring`, a 
              dictionary.

    **Returns**

        **X** : numpy ndarray with structured dtype

            The data, where each column is named and is of a uniform NumPy data 
            type.

        **dtype** :  numpy dtype object

            The data type of `X`, e.g. `X.dtype`.

        **coloring** :  dictionary, or None

            Hierarchical structure on the columns given in the header of the 
            file; an attribute of tabarrays.

        See :func:`tabular.tab.tabarray.__new__` for more information about 
        coloring.

    **See Also:**

        :func:`tabular.io.savebinary`, :func:`numpy.load`, 
        :func:`numpy.save`, :func:`numpy.savez`

    """

    X = np.load(fname)
    if isinstance(X, np.lib.npyio.NpzFile):
        if 'coloring' in X.files:
            coloring = X['coloring'].tolist()
        else:
            coloring = None
        if 'data' in X.files:
            return [X['data'], X['data'].dtype, coloring]
        else:
            return [None, None, coloring]
    else:
        return [X, X.dtype, None]