After completing this lesson, you will be able to:
- Practice your skills using Landsat data in Python.
import os from glob import glob # File manipulation import matplotlib.pyplot as plt import geopandas as gpd import rasterio as rio import earthpy as et import earthpy.spatial as es import earthpy.plot as ep # Download data and set working directory data = et.data.get_data('cold-springs-fire') os.chdir(os.path.join(et.io.HOME, 'earth-analytics', 'data'))
Challenge 1: Open And Crop Your Data
Above, you opened up the landsat scene in the directory:
LC080340322016072301T1-SC20180214145802. This data covers an area which a file occured near Nederland, Colorado. For this challenge, you will work with data that was collected before the fire for the same area. Do the following:
- Crop all of the bands (tif files with the word “band” in them, in the
LC080340322016070701T1-SC20180214145604directory using earthpy
- Next stack the cropped tif files using
- Finally plot the data using
Challenge 2 (Optional): Plot CIR and RGB Images Using Landsat
In this lesson which introduces working with Landsat data in open source Python, you learn how to plot both a color RGB and Color Infrared (CIR) images using landsat data. Create a figure below that has:
- A color RGB image of the landsat data collected post fire
- A CIR image of the landsat data collected post fire.
HINT: You will need to set the correct band combinations for your plots to turn our properly.
- For Regular color images use:
rgb=[3, 2, 1]
- For color infrared use:
rgb=[4, 3, 2]