Landsat raster file I/O
Project description
ESPA Tools
An open-source Python package for simple loading of Landsat imagery as NumPy arrays
Install
espatools
is available from PyPI:
$ pip install espatools
Usage
We think espatools
is easy to use; give it a try and let us know what you think!
See this Jupyter Notebook for a demonstration of some simple plotting after reading Landsat imagery.
# Import the espatools module for raster I/O
import espatools
# Use matplotlib for simple plotting
import matplotlib.pyplot as plt
# Set the XML metadata file
xmlfile = 'LC081210652018073101RT-SC20180802013328/LC08_L1TP_121065_20180731_20180731_01_RT.xml'
# Set up the reader
reader = espatools.RasterSetReader(filename=xmlfile)
# Perfrom the read!
raster = reader.Read()
That's it! you just read in a set of Landsat imagery and each band is accessible by name as a 2D NumPy array:
# Get the bands dictionary
bands = raster.bands
# Grab a band by name
aer = bands.get('sr_aerosol')
# Plot this band up!
plt.imshow(aer.data)
plt.title(aer.name)
plt.show()
The above code results in an image like below:
# Maybe you want the RGB bands as a 3D NumPy array
color = raster.GetRGB()
# You could plot this up:
plt.figure()
plt.imshow(color)
plt.title('color')
plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
espatools-0.0.2.tar.gz
(5.7 kB
view details)
File details
Details for the file espatools-0.0.2.tar.gz
.
File metadata
- Download URL: espatools-0.0.2.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a63d8723a7c5a51c9bfdeeaeb232942e0ce2cd96f1e018d63bfbd6c797a35aa2 |
|
MD5 | f10618a0a9f43a2dd79a16f3fbe910d2 |
|
BLAKE2b-256 | ebe54108d3f2a6ff58cdfd4760a0ef629b548c051b77511a9aa57908784e0942 |