IVICS and GSF Examples and HOWTOs

Instructions for converting L1B MODIS data to GSF format for IVICS  

The gsf_calibrate_modis program reads Level 1B MODIS HDF files and converts them to GSF format.  The program has many options.  In its simplest form you only need to worry about a few parameters.

Example 1, Standard single resolution GSF file:

To calibrate a 1km MODIS L1B file, type the following command:

gsf_calibrate_modis -i input_hdf_file -o output_gsf_file

This will convert the 1km MODIS file to GSF format.  The input file may be any of the resolutions, 1km, 500m or 250m. 

You may also create a GSF file containing all of the channels at their native resolution.  To do this you need to download all three of the original MODIS L1B files for a given scene.  When calibrating, one of the files may be specified as the default "base" resolution of the gsf file (if ommited, the first input file listed is the default).

Example 2, Multiple resolution GSF file:

gsf_calibrate_modis -i 250m_input_hdf_file  -i 500m_input_hdf_file -ib 1km_input_hdf_file -o output_gsf_file

This example will create a composite GSF file with the 250m channels first, then the 500m channels, ending with the 1km channels.  The channels are written in the order the input files are listed.  The "-ib" specifies that the 1km channel will be the default "base" resolution of the GSF file.

If a multiple-resolution composite is created, ivics will prompt the user for the file component to use for the base resolution.

There are many more options.  Type gsf_calibrate_modis or look at the following web site for more information:

http://www.nsstc.uah.edu/ivics/calibration.html


 Instructions for dumping MODIS channels from a GSF (IVICS) file

 The gsf_dump_channels program is used to extract individual channels from a GSF file and output them as binary arrays of data.  The program options can be found on the GSF Utilities Programs page.

Output options are available to scale the channels into unsigned character (1 byte), unsigned short (2 bytes) or signed floating point (4 byte) values

The channels to dump are specified as GSF channel indices, and may not correspond to the same channels as the original data.  You can use the gsf_info program to find out the GSF channel indices within a GSF file.  Just type:

 gsf_info filename

Here is an example of the output for a MODIS GSF file: 

Byte order is Little Endian

Major version 2 Minor version 1

GSFReadCompositeInfo: BaseFileIndex 0 numComponents 1

GSFReadCompositeInfo: offset 0 resolution 1000.000000 size 0

Byte order is Little Endian

Major version 2 Minor version 1

OpenReadOnlyFile: Numlines 2030

 

*******Header and Channel information*******

GSF lib version 2.1000

Maximum allowed channels 1000

 

GSF data header:

 

year: 2003

Julian day 275

Satellite Number 0

Pixels per line 1354

Number of lines 2030

DataType 7

DataComment Modis data

SpatialResolution (meters) 1000.000000

 

Channels defined in gsf file: :     NOTE: Channel definitions start here

 

GSF Channel Index: 0

Channel Label: 1 [0.6450µ]

Channel Comment: Reflectance scaled 0 to 1

Scale range Max: 1.000000 Min: 0.000000

Stored as two byte values

Wavelength (microns): 0.645000

Units: Reflectance

 

GSF Channel Index: 1

Channel Label: 2 [0.8580µ]

Channel Comment: Reflectance scaled 0 to 1

Scale range Max: 1.000000 Min: 0.000000

Stored as two byte values

Wavelength (microns): 0.858000

Units: Reflectance

 

GSF Channel Index: 2

Channel Label: 3 [0.4690µ]

Channel Comment: Reflectance scaled 0 to 1

Scale range Max: 1.000000 Min: 0.000000

Stored as two byte values

Wavelength (microns): 0.469000

Units: Reflectance

 

GSF Channel Index: 3

Channel Label: 4 [0.5550µ]

Channel Comment: Reflectance scaled 0 to 1

Scale range Max: 1.000000 Min: 0.000000

Stored as two byte values

Wavelength (microns): 0.555000

Units: Reflectance

 

This example shows the file header information along with three of the channel definitions within the GSF file.  GSF channel indices usually begin with zero.  The “Channel Label” denotes the MODIS channel label.  In this case channel 1 of the MODIS data is GSF channel 0, MODIS channel 2 is GSF channel 1, etc.  Be sure to check the GSF index for each channel you wish to extract.  Some of the MODIS channels have high and low gain versions which shifts the indices out of sequence for some of the channels.  You MUST use GSF channel indices to specify which channel to dump using gsf_dump_channel.

For example, If we want to extract MODIS channels 1, 3, and 4 into unsigned short integer fields, we would type the following:

gsf_dump_channel -i input_filename -o output_filename_base -cs 0 -cs 2 -cs 3

This will create the following set of output files:

Output_filename.0

Output_filename.0.hdr

Output_filename.2

Output_filename.2.hdr

Output_filename.3

Output_filename.3.hdr

The files with numeric extensions contain the scaled binary values for the specified GSF channel.  The files with the .hdr extension are text files containing information about the associated binary file.  Here is an example of a .hdr file:

File: Output_filename.0

Channel 1 [0.6450µ]

Lines 2030 Pixels 1354

Wavelength 0.645000

Units: Reflectance

Scale range Max 1.000000 Min 0.000000

Pixels written as unsigned short values:  Unscaling expression:

Value = 0.000000 + Pixel * (1.000000 - 0.000000)/65535.0

This information can be used to read the data into IDL or another program.  Depending upon which scaling option you selected, you may need to apply an equation to convert the binary values back into the original units.  The unscaling expression is provided as the last line of the .hdr file.

Latitude, longitude, and solar angles can each be dumped into separate files as float arrays using command line options.

Back to IVICS Home page