Get Started With EarthPy¶
EarthPy is a python package devoted to working with spatial and remote sensing data. EarthPy also contains an IO module that supports downloading data for the Earth Lab earth analytics courses.
- Spatial: Various functions for loading, manipulating, and displaying raster data
create_raster_stack: generates a single multi-band raster from separate raster TIFs, such as a collection of single-band TIFs from Landsat -
normalized_diff: calculate a normalized difference for two bands of a multi-band raster -
hillshade: create a hillshade array from image elevation data -
crop_image: crop raster data to a polygon - Custom plotting shortcuts, such as
colorbarfor appropriately sized legends,
create_legendfor legends showing a color for each class of a raster,
plot_bandsfor creating a grid of images showing each individual band of a raster, and
plot_rgbfor quickly generating composite images or false color images from raster bands.
- IO: Handles data search and retrieval from EarthLab, supporting analytics courses available here.
- Utils: Handles path fixes for EarthLab image retrieval – new utils module forthcoming
Earthpy has several Python package dependencies including :
rasterio, geopandas, numpy.
To install earthpy, use pip.
--upgrade is optional but it ensures that the package
overwrites when you install and you have the current version. If you don’t have
the package yet you can still use the
pip install --upgrade git+https://github.com/earthlab/earthpy.git
Then import it into python.
>>> import earthpy as et
To import the spatial module use:
>>> import earthpy.spatial as es