Enclosed are some scripts to process Landsat data. The idea being a framework to process data according to a host of different common analysis needs. The scripts are written in Python and are designed to be run from the command line.
Clone down the repo, and make sure that pipenv is installed. Then install the dependencies with:
pipenv installOnce completed, run the following command to enter the virtual environment:
pipenv shellThe scripts are designed to be run from the command line. The following is an example of how to run the landsat_processor.py script, there are currently four arguments that can be passed to the script:
input_folder: The path to the landsat data, organized in folders where each folder contains the data for a single scene.processing_method: The type of analysis to be performed on the data. Currently, surface temperature and NDVI calculations are available, and are able to be averaged yearly, or across all data.output_path: The path to the folder where the processed data will be saved.
-sor--suffix: A suffix to be appended to the output file names. This is useful for keeping track of the processing method used. The default is a trailing_, anything you specify will be added after.
See example commands here:
# Basic surface temp calculation
python landsat_processor.py ./landsat surface_temp_celsius ./outputs -s qgis_test
# NDVI averaged by year
python landsat_processor.py ./landsat averaged_yearly_ndvi ./outputs -s ndvi_test_3
# NDVI average across entire dataset
python landsat_processor.py ./landsat averaged_ndvi ./outputs -s ndvi_test_4The underlying data is organized by the default folder structure of the USGS bulk download tool. Inside of Earth Explorer, select Landsat > Landsat Collection 2 Level 2 data > Landsat 8-9 OLI/TIRS C2 L2, and use the bulk download tools to download relevant scenes. One scene is provided for reference in the landsat_example folder, change the name of the folder to landsat to use the example commands above.
There are a couple of helper scripts I used to debug my data, they are included here as compare_rasters.py and compare_metadata.py. The first script compares pixel values of two rasters and the second script compares some predetermined metadata (currently the stat summaries).
Both follow the following format:
python compare_rasters.py ./raster1.tif ./raster2.tifThese scripts come out of a project I'm working on as part of coursework at the NCSU Center for Geospatial Analytics. The idea is to create a framework that I can add to over time.