This document briefly describes how to convert a standard BYU .SIR file to a GEOTIFF file using the sir2geotiff family of programs. The BYU-MERS "sir" image format was developed by the Brigham Young University (BYU) Microwave Earth Remote Sensing (MERS) research group in the early 1990's to store images of the earth along with the information required to easily earth-locate the image pixels. The binary SIR file includes a header with all the information to geolocate each pixel in the image. The origin of the .SIR file image is in the lower left corner. The earth location of a pixel is identified with its lower-left corner. Most sir files are in either polar stereographic or Lambert equal-area projections, though some EASE grid images are regularly produced. sir2geotiff does note support EASE grid images. A C-language utility sir2geotiff.c designed for linux use can simplify conversion of SIR files to geotiff images. Source code is available on this ftp site ftp://ftp.scp.byu.edu/software/sir2geotiff/ Three programs are available sir2geotiff.c sir2geotiff2.c sir2geotiff_gdal.c The first two are self-contained (but link to the BYU sir library), while the last (sir2geotiff_gdal.c) requires use of the separate gdal_translate program available as part of the GDAL package http://www.gdal.org/ and enables TIFF compression. Each of these programs are described below. The recommended approach is to use sir2geotiff2.c For convenience, the complete code needed to compile and sir2geotiff2.c is contained in the zip file sir2geotiff2_all.zip and the subdirectory sir2geotiff2_all Note that you may need to manually modify sir3.h if the byte order in your machine is not little-endian (e.g., linux, windows). Instructions for sir2geotiff.c and sir2geotiff2.c These programs are self-contained and should compile on most platforms. sir2geotiff.c supports only greyscale images while sir2geotiff2.c supports color tables and additional options. Note that both programs only support geotiff creation from polar stereographic or Lambert equal area projection files; otherwise, the output images are conventional tiff images. Both programs require specification of the input .SIR file. Optionally, you can specify the output file name and the max/min scaling parameters. Internally, the SIR values are clipped to the max and min values, then converted to 8 bit values spanning this range. The sir2geotiff2 program can include a color table specified by an external file. Optional parameters specify if the color table file is in binary or ascii format, that a tiff should be generated instead of a geotiff, and is the lowest value of the color scale should be reserved for the no-data flag used in the SIR file. Usage: sir2geotiff input_filename > converts a polar stereographic .sir file to geotiff file input_filename : input BYU .sir file output_name : name of output geotiff file [def=filename.tif] min,max : min,max [def=from sir header] Usage: sir2geotiff2 <-b -q -t -n -h> input_filename > >> Converts a BYU .sir file to geotiff or tiff file input_filename : input BYU .sir file output_name : name of output geotiff file [def=filename.tif] min,max : min,max [def=from sir header] coltabfile : ascii color table file [def=grayscale] Optional arguments -b : binary color table file [def=ascii] -q : quiet [def=verbose] -t : output only standard TIFF file not a geotiff file [def=geotiff] -n : only no-data pixels at lowest output value [def=no-data flag ignored] These programs require the c SIR libraries ftp://ftp.scp.byu.edu/software/c/ Be sure to set the SWAP value in sir3.h To link sir2geotiff use something like cc -O -I ./ -o sir2geotiff sir2geotiff.c sir_io.c sir_geom.c sir_ez.c A simple make file is contained in the subdirectory sir2geotiff2_all Instructions for sir2geotiff_gdal.c The general algorithm used by sir2geotiff.c is to: 1. extract projection information from SIR file header and generate a proj4 information string to control gdal_translate 2. generate a temporary 8 bit GIF file by scaling and clipping the SIR file floating point array. 3. use a system call to execute gdal_translate to create geotiff file from the temporary gif file. 4. delete temporary gif file This same algorithm can be used manually. The gdal_translate program is a utility to convert images to GeoTIFF (or other formats) and is one of the GDAL transformation library utility programs. These programs can be run on Unix/Linux platforms or Windows. GDAL: http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries This page talks about how to download of the GDAL software for various platforms. Download and install as per instructions to allow the execution of GDAL commands as part of the path available to the system call used by sir2geotiff. Once gdal_translate is installed one can execute the following command in the command shell to convert SIR images to a geotiff (or other fomrat). A simple general approach to create a geotiff image, is to first create a full scale GIF or BMP image from the SIR file. Use a one-to-one pixel version. This can be done with sir2gif, sir2bmp, or sir_util. [Source code for sir2gif, sir2bmp, and sir_util can be compiled for most platforms and sir_util.exe is available as a precompiled windows executable.] Then, using the GIF or BMP file as input, run gdal_translate to create a .tif file that has the geotiff header. You will have to input the the corner coordinates (in meters) of the SIR image and the projection information. The required gdal_translate projection parameters and corners can be determined using the sir_util tool or from the sir2geotiff utility described. Consider conversion of a QuickSAT slice Arctic image (qush-a-ArcYY-ddd-ddd.sir). Examining the .SIR file header, the .SIR image is in polar stereographic projection with reference latitude 70 deg and vertical longitude -45 deg. The image corner coordinates are at -3400000 3406275 3406275 -3400000 km. (While all q*s*-*-Arc* have the same header, images of other areas will have different corners and projections). In this example a full scale .gif image is first created using sir2gif or sir_util, then gdal_translate is run with the image file as input, i.e. (see the gdal_translate man page for details of the its arguments) gdal_translate -a_srs "+datum=wgs84 +proj=stere +lat_0=90.000000 +lat_ts=70.000000 +lon_0=-45.000000 +k=1 +units=m +no_defs +x_0=0 +y_0=0 +a=6378273.000 +b=6356889.449" -a_ullr -3400000.000 3408499.000 3408499.000 -3400000.000 -of GTiff -co compress=LZW INPUT.gif OUTPUT.tif where -a_srs (assigned Spatial Reference System, followed by proj4 params in a string) +datum (wgs84) +proj=stere (projection method, polar stere0=stere, lambert=laea) +lat_ts (latitude of true scale 1:1) +lat_0 (the latitude of origin) +lon_0 (the longitude of the origin) -a ullr (the projected coordinates of the upper left and lower right) -of GTiff (geotiff output format) -co (conversion options relevant to output format, e.g. compress=LZW) The command for generating a geotiff from the ASCAT image file of Greenland mnfa-a-Grn09-201-204.sir (from which INPUT.gif is first made) is gdal_translate -a_srs "+datum=wgs84 +proj=laea +lat_0=71.750000 +lon_0=-42.500000 +k=1 +x_0=0 +y_0=0 +a=6378135.000 +rf=50000000.000 +units=m +no_defs" -a_ullr -1800000.000 1526000.000 1804500.000 -1500000.000 -of GTiff -co compress=LZW IN.gif OUTPUT.tif Compiling sir2geotiff.c requires routines from the sirclib available from the Scatterometer Climate Record Pathfinder software site, see ftp.scp.byu.edu/software/c. Compilation requires sir3.h and sir_ez.h be in the path. A typical compile command is cc -O2 -I./ sir2geotiff.c sir_geom.c sir_io.c sir_ez.c -o sir2geotiff.c To run the code, use sir2geotiff input_filename output_name work_dir min max (if you run it from the output directory, only the first argument is really required, but if you want temporary files to be created/destroyed in a temporary directory you have to specify all the arguments. Note that by specifying the max/min values you can improve the image contrast compared to the default values.) The program uses the min and max values to create a temporary .gif file, which sis written to the work_dir. The code then makes a system call to execute the gdal_command using the temporary file as input. The temporary file is deleted afterword. The code produces a lot of informational output, which can be ignored. It prints out the command line for the gdal_translate after the call. To work correctly, gdal_translate must be in the path of the subproces system call. Usage: sir2geotiff_gdal input_filename >> converts a polar stereographic .sir file to geotiff file input_filename : input BYU .sir file output_name : name of output geotiff file [def=filename.tif] work_dir : location of working directory [def=current] min,max : min,max [def=from sir header] coltabfile : ascii color table file [def=grayscale]