Skip to main content

Analyze Landsat remote sensing images using xarray

Project description

xlandsat

Analyze Landsat remote sensing images using xarray

Documentation (latest)Contributing (how you can help)CompGeoLab

Latest version on PyPI Latest version on conda-forge Test coverage status Compatible Python versions. DOI used for citations

About

xlandsat is Python library for loading and analyzing Landsat scenes downloaded from USGS EarthExplorer with the power of xarray. We take care of reading the metadata from the *_MTL.txt files provided by EarthExplorer and organizing the bands into a single xarray.Dataset data structure for easier manipulation, processing, and visualization.

Example

Here's a quick example of loading and plotting this Landsat 9 scene from the city of Manaus, Brazil, which is where the Solimões (brown water) and Negro (black water) rivers merge to form the Amazon river:

import xlandsat as xls
import matplotlib.pyplot as plt

# Download a sample Landsat 9 scene in EarthExplorer format
path_to_scene_file = xls.datasets.fetch_manaus()

# Load the data from the file into an xarray.Dataset
scene = xls.load_scene(path_to_scene_file)

# Make an RGB composite as an xarray.DataArray
rgb = xls.composite(scene, rescale_to=[0.02, 0.2])

# Plot the composite using xarray's plotting machinery
rgb.plot.imshow()

# Annotate the plot with the rich metadata xlandsat adds to the scene
plt.title(f"{rgb.attrs['title']}\n{rgb.attrs['long_name']}")
plt.axis("scaled")
plt.show()
RGB image showing the city on the left and the black waters of the Negro river merging with the brown waters of the Solimões river

Project goals

  • Loading single scenes in the EarthExplorer format.
  • Provide some calculation, like composites, but leave most of the rest to the user and xarray.

Our goal is not to provide a solution for large-scale data processing. Instead, our target is smaller scale analysis done on individual computers.

  • For cloud-based data processing, see the Pangeo Project.
  • For other satellites and more powerful features, use Satpy.

Project status

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.

License

This is free software: you can redistribute it and/or modify it under the terms of the MIT License. A copy of this license is provided in LICENSE.txt.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlandsat-0.5.0.tar.gz (20.1 kB view hashes)

Uploaded Source

Built Distribution

xlandsat-0.5.0-py3-none-any.whl (22.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page