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
import pooch # for downloading sample data
# Download a cropped scene from the Brumadinho dam (Brazil)
path = pooch.retrieve(
"doi:10.6084/m9.figshare.21665630.v1/cropped-after.tar.gz",
known_hash="md5:4ae61a2d7a8b853c727c0c433680cece",
)
# Load the scene directly from the archive (no need to unpack it)
scene = xls.load_scene(path)
# Make an RGB composite and add it to the scene Dataset
scene = scene.assign(rgb=xls.composite(scene, rescale_to=[0, 0.2]))
# Plot the composite
scene.rgb.plot.imshow()
<matplotlib.image.AxesImage at 0x7f3f5cd9e170>

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.