Skip to content

AbnormalDistributions/landsat8_scene_calculator

Repository files navigation

./new_orleans.png

Landsat8 Scene Calculator

Introduction

This program can download the landsat8 images and other files from Amazon Web Services. The 11 bands can be downloaded on demand depending upon which type of scene you would like to generate. Any files required for scene generation will be downloaded. Scenes will be generated once files have been saved to local disk. Bands can be downloaded independently or automatically depending on what bands are needed for the specific calculation/composite.

This program creates GeoTIFF files of the following:

  • Normalized Difference Vegetation Index Calculation
  • Soil Adjusted Vegetation Index Calculation
  • Visible Spectrum (Natural Color) Composite
  • Short-Wave Infrared Composite
  • Agriculture Composite
  • Geology Composite
  • Bathymetric Composite

Important Notes

  • ./data/index.gz is index for available data, which is downloaded if not present, do not delete it.
  • ./data/defaults.json is user’s last input for prompts in the program. It is safe to delete, but you will need to reinput previous values at prompt.
  • If download is interrupted because of any problems the program will exit. On the next run, the downloaded file can resume download as long the incomplete ‘.part’ file is not deleted.

Usage

To use this program the scene with which you would like to work is required.

  1. Find the scene you would like at RemotePixel.ca.
  2. Note the WRS path/row number of the image (written inside blue circle at the center of each scene) or the string of the scene.

Both landsat8.py and main.py can be run interactively or from command line arguments:

  • Pass ‘-h’ to see the command line uses
  • Pass ‘-i’ to run interactively.
  • You can also run interactive with defaults input with ‘-a’, which will retrace the previous interactive session. (Useful if your downloads were interrupted.)

To Use as Scene Calculator

  1. Run the ‘main.py’ script.
  2. If you do not have the scene string, the script allows for browing available scenes data. Enter path number and row number. If you have the scene string, input as prompted. (Input yes to use last used most recently used scene.)
  3. Details of scene you selected will be displayed. Confirm the scene selected. (It’s also a good idea to remember or note the scene string for future reference. The scene string is in the index ‘productId’.)
  4. After selecting the scene with which you would like to work, choose the calculation/composite you would like to to create. The program will automatically download any necessary bands for that image and generate the scene. Bands and generated images will be saved in ‘./data/PPPRRR/SCENE_STR/’ directory where PPP and RRR are path and row numbers.

Example uses:

  • Generates RGB image for scene. LC08_L1TP_141041_20190324_20190403_01_T1
python main.py --scene LC08_L1TP_141041_20190324_20190403_01_T1 --image RGB
  • Generates NIR and RGB images for scene you choose interactively after entering this command.
python main.py --image NIR RGB

See Other Resources below for more information on the GeoTIFFs calculated with this script.

To Use as Raw GeoTIFF Downloader

If you only want to download bands for calculating scenes, the program will download those automatically. To download files independently of scene generation:

  1. Run the ‘landsat8.py’ script.
  2. Enter the scene string or WRS path/row like in Image Creator.
  3. Details of scene you selected will be displayed. Confirm the scene selected.
  4. A list of available files will be displayed. Choose the files to download.

Example uses:

  • Downloads band 11 file TIF.ovr from wrs 141/41, asks for scene selection because scene string is not provided.
python landsat8.py --wrs-path 141 --wrs-row 41 --bands-no 11 --file-type TIF.ovr
  • Downloads RED, GREEN and BLUE bands .TIF file from scene LC08_L1TP_141041_20190324_20190403_01_T1
python landsat8.py --scene LC08_L1TP_141041_20190324_20190403_01_T1 --bands RED GREEN BLUE

Scene Locator Resource

The RemotePixel.ca displays available scenes in WRS global notation. The numbers on top of any box is the path/row. The scene string can also be found out if in the URL of the image shown on the right when scene is selected. Since this script can search for all scenes for a specific WRS path/row interactively it is not necessary, but using RemotePixel.ca to locate the scene string may make locating the area of interest easier.

Other Resources

Note (for those using PyCharm and IntelliJ IDEA):

This code may require enabling a hidden option in the IDE. They apparently don’t work well with os.get_terminal_size() out of the box.

To enable:

  1. Click Help > Edit Custom VM Options
  2. Add: -Drun.processes.with.pty=true
  3. Save the file.

Licensing

Code licensed under MIT License

Contributors

Original Repository:

Forks

There are many forks of this repository. For example:

  • This fork is created and maintained by Gaurav Atreya. For any developing features which aren’t merge please look into it to avoid working on same features.

About

Creates NDVI, SAVI, RBG, NIR, short wave infrared, agriculture, geology, and bathymetric GeoTIFF files using Landsat8 imagery.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages