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,720 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 kansy
on ‎10-04-2017 03:59 AM

Dear Community Members,

 

Please where can I download the Commandline Iterator for extracting landsat TarGz Fikes in Batch?

 

Thanks

 
by mvardovs
‎10-04-2017 04:06 AM - edited ‎10-04-2017 04:09 AM

@kansy

 

Click on Download under all Labels of this article. 

 

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support

by kansy
on ‎10-04-2017 04:12 AM

Oh dear Mvardovs,

 

I just clicked and it downloaded the Command line . I guess I will have to extract it as i did with teh spatial modeler you created for me the last time and drag it to the 2D view. isnt it?

 

Meanwhile , I have also sent you a short question seeking your professional input on how to usue Spatial Modeler or Standard tools ( and please what do you mena by standard tools) to create a thematic raster image after creating a Mean NDVI Image

 

See Link to the question:  http://community.hexagongeospatial.com/t5/Support-ERDAS-IMAGINE/Mean-NDVI-value-calculation/m-p/1686...

 

Thanks

 

Kansy

by mvardovs
on ‎10-04-2017 04:13 AM

Kansy,

 

Yes,  you are right.

 

I will have a look at your question.

 

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support

by kansy
on ‎10-04-2017 04:19 AM

 

 

Dear Mvardovs,

 

Thanks

 

This is what I get when i doubled clicked on the input directory to slect the landsat tar.gz file

 

How can I possibly proceed from here?

 

Thanks

 

 

 

command line iterator.PNG

Courses