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,733 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 mvardovs
on ‎10-04-2017 04:22 AM

Kansy,

 

To Run the model you need to go to Spatial Modeler tab and click Run. There you can select your input file.

 

Kind Regards,
Marina Vardovska
Hexagon Geospatial Support

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

Dear Mvardovs

 

Thank you for this lead

 

And on how to add thematic colouurs to NDVI grey scale image? what are steps?

 

With kind regards

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

Dear MVardovs,

 

These are the steps I followed and the output, I have attached as a Picture to thsi message

 

1.  I extratced the modeler and dragged in to the 2D view

2. I clicked on Run where

3. I specified the input directory

4. I accepted value as TRUE

5. I got a new folder with extratced .TIFF files

 

 

Is this all? or did I miss any step?

 

Will be happy to read a confirmation from you on the steps taken

 

ThanksOutput of commnadline iterator.PNG

by mvardovs
on ‎10-04-2017 05:02 AM

Kansy,

 

Yes. This is all.

by kansy
on ‎10-04-2017 05:21 AM

Oh that is reassuring to hear Mvardovs

 

and the NDVI question please?

 

Thanks

Courses