def open_image(file):
    """
    Locates & opens the specified hyperspectral image.

    Arguments:

        file (str):
            Name of the file to open.

    Returns:

        SpyFile object to access the file.

    Raises:

        IOError.

    This function attempts to determine the associated file type and open the
    file. If the specified file is not found in the current directory, all
    directories listed in the :const:`SPECTRAL_DATA` environment variable will
    be searched until the file is found.  If the file being opened is an ENVI
    file, the `file` argument should be the name of the header file.
    """
    from . import io
    pathname = io.spyfile.find_file_path(file)
    try:
        return io.envi.open(pathname)
    except io.envi.FileNotAnEnviHeader:
        pass
    except:
        raise
    try:
        return io.erdas.open(pathname)
    except:
        pass
    try:
        return io.aviris.open(pathname)
    except:
        pass
    raise IOError('Unable to determine file type or type not supported.')
