Read a Raster Band into Memory
Using GDAL's Python Bindings
#!/usr/bin/env python
import gdal
def read_raster(filepath):
dataset = gdal.Open(filepath)
band = dataset.GetRasterBand(1)
array = band.ReadAsArray()
ds = None
return array
a = read_raster('path/to/file.tif')
Using RasterIO's rio insp
Command Line Tool
$ pip install rasterio
$ rio insp path/to/file.tif
>>> src.meta # raster metadata
>>> a = src.read(1)