Home
Contents
xlandsat
Load Landsat remote sensing images into xarray
xlandsat is Python library for
loading Landsat scenes downloaded from
USGS EarthExplorer into
xarray.Dataset
containers.
We take care of reading the metadata from the *_MTL.txt
files provided by
EarthExplorer and organizing the bands into a single data structure for easier
manipulation, processing, and visualization.
Here’s a quick example:
import xlandsat as xls
# Download a cropped Landsat 8 scene from the Brumadinho dam disaster
# (Brazil). The function downloads it and returns the path to the .tar file
# containing the scene.
path = xls.datasets.fetch_brumadinho_after()
# Load the scene directly from the archive (no need to unpack it)
scene = xls.load_scene(path)
# Make an RGB composite and stretch the contrast
rgb = xls.composite(scene, rescale_to=[0.03, 0.2])
# Plot the composite
rgb.plot.imshow()
<matplotlib.image.AxesImage at 0x7f1e932f27a0>

Note
Only Landsat 8 and 9 Collection 2 Level 2 data products are supported at the moment.
xlandsat is ready for use but still changing
This means that we sometimes break backwards compatibility as we try to improve the software based on user experience, new ideas, better design decisions, etc. Please keep that in mind before you update xlandsat to a newer version.
We welcome feedback and ideas! This is a great time to bring new ideas on how we can improve the project. Submit issues on GitHub.
Looking for large-scale cloud-based processing?
Our goal is not to provide a solution for large-scale data processing. The target is smaller scale analysis done on individual computers (which is probably the main way EarthExplorer is used). For cloud-based data processing, see the Pangeo Project.