greenwich/raster.py
def open(path, mode=gdalconst.GA_ReadOnly):
    """Returns a Raster instance.

    Arguments:
    path -- local or remote path as str or file-like object
    Keyword args:
    mode -- gdal constant representing access mode
    """
    path = getattr(path, 'name', path)
    try:
        return Raster(vsiprefix(path), mode)
    except AttributeError:
        try:
            imgdata = path.read()
        except AttributeError:
            raise TypeError('Not a file-like object providing read()')
        else:
            imgio = MemFileIO(delete=False)
            gdal.FileFromMemBuffer(imgio.name, imgdata)
            return Raster(imgio, mode)
    raise ValueError('Failed to open raster from "%r"' % path)
def open(path, mode=gdalconst.GA_ReadOnly):
    path = getattr(path, 'name', path)
    try:
        return Raster(vsiprefix(path), mode)
    except AttributeError:
        try:
            imgdata = path.read()
        except AttributeError:
            raise TypeError('Not a file-like object providing read()')
        else:
            imgio = MemFileIO(delete=False)
            gdal.FileFromMemBuffer(imgio.name, imgdata)
            return Raster(imgio, mode)
    raise ValueError('Failed to open raster from "%r"' % path)
def open ( path , mode = gdalconst . GA_ReadOnly ) : path = getattr ( path , 'name' , path ) try : return Raster ( vsiprefix ( path ) , mode ) except AttributeError : try : imgdata = path . read ( ) except AttributeError : raise TypeError ( 'Not a file-like object providing read()' ) else : imgio = MemFileIO ( delete = False ) gdal . FileFromMemBuffer ( imgio . name , imgdata ) return Raster ( imgio , mode ) raise ValueError ( 'Failed to open raster from "%r"' % path )
Returns a Raster instance.

    Arguments:
    path -- local or remote path as str or file-like object
    Keyword args:
    mode -- gdal constant representing access mode
Returns a Raster instance .