Hexagon Geospatial
MENU

Spatial Modeler Tutorials

Learn more about our products, find answers, get the latest updates, and connect with other Hexagon Geospatial product users, or get support from our professional service team.
Showing results for 
Search instead for 
Do you mean 

Commandline Iterator - Extract Landsat TarGz Files in Batch

by angelamanchester on ‎10-27-2016 11:56 AM (2,873 Views)

Download

 

Description

 

This model was designed to work with downloadable USGS Landsat files(.tar.gz). It will automatically unzip the original .tar.gz into a newly created folder, without changing any naming conventions. As such it emulates the initial steps of the USGS Landsat importers provided in ERDAS IMAGINE. However it is important to note that this model does not attempt to create multispectral layerstacks from the unpacked files - it simply unpacks the archive.

 

When the model is run, the .tar.gz is first unpacked to a new folder within the containing directory with the suffix .tar.  The second step of this model is to unpack the .tar file. This will have the same root naming convention as the input .tar.gz without that extension. Once the .tar extraction is completed, the intermediate .tar directory is deleted. The original input .tar.gz file will remain as is and all files extracted into a directory with the same root name as the .tar.gz.

 

Using the ERDAS IMAGINE 2016 Flow Control improvements, additional session log messages are added during key steps in the model. For example once a file extraction is complete a custom session log message is added using the pattern: “Extraction FROM $INPUT TO $OUTPUT COMPLETE”. Likewise, when all files have been extracted the intermediate .tar directory is deleted and reported in the session log as: “Deleting Directory: $INPUT”

 

An additional benefit of this model is to work as a template for many other Command Line operations.

 

 

Key Assumptions

 

  • Input Directory contains at least one .tar.gz file
  • All files in the .tar.gz will be extracted
  • Naming of the files contained within the.tar.gz file will be maintained
  • Assumes USGS Landsat .tar.gz structure, containing only one .tar file within each .tar.gz
  • User has read and write permissions to the Input Directory
  • By default, it is assumed sub-directories are to be included. If not, this can be changed when launching the model
  • Assumes ERDAS IMAGINE 2016 (or later) is installed and 7za.exe is contained in the directory: C:\Program Files\Hexagon\ERDAS IMAGINE 2016\bin\Win32Release (which it is by default)

 

Input Parameters

 

Input Directory: User defined input directory. Assumes this directory contains at least one .tar.gz file

Include sub-directories?: True or False option. By default this is set as True. If True, the model will parse through all sub-directories of the input directory and include any .tar.gz files within these in the model. If this is set to false, no .tar.gz files under any sub-directories of the input directory will be used in the model.

 

 

Extract TarGz GUI.PNG

 

 

 Extract_TarGz_v16-0-2.gmdx
 Extract TarGZ Main Model
 Iterator sub-model
 Extract Targz SubModel.PNG

 

Extract TarGz Commandline Syntax.PNG

 

Output example:

 

C:\Data\Landsat8.tar.gz > All files will be extracted into the folder C:\Data\Landsat8 Folder.

With sub-directories set to true, all sub-directories containing .tar.gz files will also be parsed through the model.  For example a directory input of C:\Data\  will also run on a .tar.gz contained in a sub-directory such as C:\Data\Temp\Landsat8.tar.gz.

 

While the intermediate .tar file is deleted, the original input .tar.gz file will remain.

 

Creating Multispectral Images

 

As mentioned above, this model does not attempt to create multispectral layerstacks from the unpacked files. Such functionality could be easily added within the Iterator using something like this:

 

 L8_Stack.PNG

 

 

 

Comments
by c.h
on ‎04-30-2018 12:35 PM

Is there any solution to make it work on ERDAS2015 or any possible alternative to use in ERDAS2015?

 

Thanks.

Courses