GAMMA DIFF/GEO Software: Reference Manual

Swap Byte Order of a List of Data Files 

Perl script:  swap_bytes_all

NAME 
swap_bytes_all  - Swap byte-order of a list of data files and store the swapped output in a specified directory

SYNOPSIS
swap_bytes_all <data_tab> <out_dir> <bpv>

<data_tab> (input) single column list of data files to swap byte order (little endian <--> big endian)
<out_dir> directory to contain output byte-swapped binary files
<bpv> bytes per value, either 2 or 4
    SHORT:    2
    SCOMPLEX: 2
    FLOAT:    4
    FCOMPLEX: 4

EXAMPLE

swap_bytes cs_tab Cascade_swap 4

each of the files in the list cs_tab are byte-swapped and stored in the directory Cascade_swap. The files in the output directory have the same name as the input directory. Each value in the input data files is 4-byte float, either real, or float complex format with real and imaginary components (fcomplex format).

DESCRIPTION

swap_bytes_all calls the program swap_bytes for each of the files contained in a single column list of files. That list of files can be created using the script mk_tab.  The program swap_bytes requires the number of bytes for each value of the data. In the case of data that are complex, the number of bytes for each value is the size of the individual real and imaginary components.

The script is useful when performing byte-swapping of data from the UAVSAR. These data are provided in little-endian format, while the Gamma Software operates with big-endian format. Using mk_tab to generate a list of the MLC data products that are within a UAVSAR data set:

mk_tab Cascade mlc - cs_tab

This will generate a single column list of all the data files with mlc extension within the directory named Cascade.  Let the output directory be called Cascade_swap. Then use swap_bytes_all to successively call swap_bytes and write the byte-swapped files to the Cascade_swap directory. The script will generate an error message and exit  if you attempt to overwrite the input file.  The script creates the output directory if it does not yet exist.

Programs such as MATLAB and ENVI can read data that are either big-endian or little-endian byte order, but it must be specified by the user.

SEE ALSO

swap_bytesmk_tab, par_UAVSAR_SLC,  par_UAVSAR_geo
© Copyrights for Documentation, Users Guide and Reference Manual by Gamma Remote Sensing, 2012.
CW last change 16-Nov-2012.