Overview
This is a sample Python script that utilizes Opticks and the Python Scripting Extension for Opticks. This script loads Landsat 5/7 data, freely available from USGS Glovis. Specifically, you can load the VNIR/SWIR, TIR and PAN into their own image. After loading the data, you can convert the VNIR/SWIR data into calibrated radiance or you can convert the VNIR/SWIR data into at sensor solar corrected reflectance. This script also includes the ability to convert the TIR data into temperature in Kelvin.
What Will I Learn?You will learn the following about the Python scripting extension for Opticks:
|
What Do I Need?
|
The Script
You can read the Python code with the following steps:
- Download the AEB and rename to have an extension of .zip.
- Extract the contents of the .zip file.
- Look for the script landsat.py in content/SupportFiles/site-packages.
- Edit landsat.py in your text editor of choice.
This script is intended to be used by example and therefore it will not be explained in detail.
Quick Start
- Download and install everything listed under "What Do I Need?"
- Download the Landsat script bundled into an Opticks extension and install it. See How To Install an Extension for details on installing.
- Start up Opticks and display the "Landsat" toolbar if it isn't already visible.
- To Load Landsat 5/7 data, click on "Landsat" and then "Open File - Load All" which will prompt you to locate the Landsat 5/7 file you wish to load. It will then load the VNIR/SWIR data into one window and the TIR data into another window. If you selected a Landsat 7 file, it will also load the PAN data into another window. If you only wish to load one of those types of data, click on one of the other "Open File" menu items.
- To convert VNIR/SWIR data into At Sensor Solar Corrected Reflectance, you must have already loaded the data and that window must be the active window. At this point, click on "Landsat" and then "Convert VNIR-SWIR data into At Sensor Reflectance".
- To convert VNIR/SWIR data into Calibrated Radiance, you must have already loaded the data and that window must be the active window. At this point, click on "Landsat" and then "Convert VNIR-SWIR data into Radiance".
- To convert TIR data into Temperature, you must have already loaded the data and that window must be the active window. At this point, click on "Landsat" and then "Convert TIR data into Temperature".
- You can find the Python script in "OPTICKS_INSTALL\SupportFiles\site-packages\landsat.py", assuming you installed the script as detailed in step 2.