An open-source Python package for simple loading of Landsat imagery as NumPy arrays.
When downloading Landsat imagery from USGS Earth Explorer, the datasets contain
many bands (
.tif files) and a few metadata files (
espatools is built to parse the
.xml metadata file to read all of the bands
for that dataset and provide a convenient and intuitive means of accessing that
metadata along side the raw data in a Python environment.
espatools can be found on GitHub and PyPI.
- The package heavily uses properties for the creation of strongly typed objects in a consistent, declarative way.
- This package implements a way to convert these datasets to a PyVista dataset (
- PVGeo has implemented an interface for
espatoolsto read Landsat imagery via XML metadata files. Check out PVGeo’s Landsat Reader for more details.
espatools is available from PyPI
$ pip install espatools
We think espatools is easy to use; give it a try and let us know what you think as this is just the alpha-release!
- First, checkout this Jupyter Notebook for a demonstration of some simple plotting after reading Landsat imagery in a Python environment.
Example False Color¶
import espatools import matplotlib.pyplot as plt # Create the reader to manage I/O reader = espatools.RasterSetReader(filename='metadata.xml') # Perform the read and yield a raster set raster = reader.read() # Get an RGB color scheme color = raster.get_rgb('false_a') # Now plot the false color image plt.imshow(color)
The results of the above code yield the following false color image:
You can also view the dataset in 3D using PyVista:
mesh = raster.to_pyvista() mesh.plot(scalars='false_a', rgb=True, cpos='xy')