Skip to main content

Load Landsat remote sensing images into 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.4.0.tar.gz (19.3 kB view details)

Uploaded Source

Built Distribution

xlandsat-0.4.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file xlandsat-0.4.0.tar.gz.

File metadata

  • Download URL: xlandsat-0.4.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for xlandsat-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3873b037c8bb78efed73757535506eb0afbd85163619c8681b31758648d54d4e
MD5 5bc2c016656e5ad531e401d417b7352b
BLAKE2b-256 36374ed53577b11a9869ba3ec2ecff95174aea4af249cf3ca804883f4851be72

See more details on using hashes here.

File details

Details for the file xlandsat-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: xlandsat-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for xlandsat-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7381ae96b7472214af860b20916a016fb4d83c993381869f79fd5dd6026f992b
MD5 fece52d4f355205408be43a03876cffc
BLAKE2b-256 e32fdebfed472d0af7fa136d5501806381d023f1e771e05846dd24c8de2cb683

See more details on using hashes here.

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