A.1 Surface Temperature and Ice Cover Data Format

The surface temperature and ice cover data are stored in direct access files 
with 1 header record, 2 pixel location records, 2 bathymetry records, and 365 
image records.  The record length is different for all lakes' data bases and 
is stored in the header record.  To open the data base file, open the file 
with an arbitrary record length of 2 or more bytes.  Read the record length 
from record 1 to an I*2 variable, close the data base, and open it again with 
the correct record length.

The header record contains the following information:

Bytes        Type         Variable
 1- 2	     I*2	  Record length of data base in byte
 3- 4	     I*2	  Number of data points
 5- 6	     I*2	  Number of image rows ("n")
 7- 8	     I*2	  Number of image columns ("m")
 9-10	     I*2	  Data type of image data where:
                          1 = unsigned byte    2 = unsigned Integer*2
                          3 = not used         4 = signed Integer*4
                          5 = Real*4           6 = signed byte
                          7 = signed Integer*2
 11- 12	     I*2	  Number of images in data base ( here: 365 )
 13- 14	     I*2	  Number of bathymetry records ( here: 2)
 15- 16	     I*2	  Number of bytes reserved for 2nd (Ice) data base (here: 10)
 17- 18	     I*2	  Start row of image in CoastWatch synoptical scene
 19- 20	     I*2	  Start column of image in CoastWatch synoptical scene
 21- 22	     I*2	  End row of image in CoastWatch synoptical scene
 23- 24	     I*2	  End column of image in CoastWatch synoptical scene
 25- 28	     R*4	  Lower default value for main y-axis ( temperature-axis )
 29- 32	     R*4	  Upper default value for main y-axis ( temperature-axis )
 33- 34	     I*2	  Number of characters in title string ( max.:50 )
 35- 84	     A50	  Title
 85- 86      I*2          Number of characters in subtitle string ( max.:30 )
 87- 116     A30          Subtitle
 117- 118    I*2          Number of characters in legend text string ( max.:20 )
 119- 138    A20          Legend text string


To maintain the record length defined by the shortest possible data type (I*1),
the location and bathymetry data are split into two records each.

Records 2 and 3 contain the location of the lake grid points in a 
two-dimensional array with "n" rows and "m" columns as defined in the header, 
where the location is defined as the grid point number and all grid points 
are sequentially numbered from the upper left to the lower right corner in 
row-major order.  The number that you read from the database is the grid point
number, which can be used along with the starting row and column in the 
CoastWatch scene to compute the actual latitude and longitude of the point.
This computation is illustrated in the program RDTMPICE.FOR which is included 
with the databases.

To read the location data, use the following program sequence:

    integer*1 locbuf(26000)
    integer*2 location(13000), recordlength, datapoints
    equivalence (locbuf, location)

    read (unit=inputunit, rec=1) recordlength, datapoints
    read (unit=inputunit, rec=2)(locbuf(I), I=1, recordlength)
    read (unit=inputunit, rec=3)(locbuf(I), I=recordlength+1, 2*datapoints)


Records 4 and 5 contain statistics of the bathymetry and the bathymetry data 
as I*2 data in 1-meter steps.  The bathymetry values correspond to the grid 
point locations defined in records 2 and 3.  To read the bathymetry data, use 
the following program sequence :

    character*48  lineheader
    integer*1 bthbuf(26000)
    integer*2 bathymetry(13000), recordlength, datapoints
    equivalence(bthbuf, bathymetry)
	
    read (unit=inputunit, rec=1) recordlength, datapoints
    read (unit=inputunit, rec=4) lineheader,
   &                            (bthbuf(I), I=1, datapoints)
    read (unit=inputunit, rec=5)(bthbuf(I), I=datapoints+1, datapoints*2)


The line header for record 4 and records 6 through 370 contains date, 
statistical and scaling information:

Bytes          Type                              Variable
 1- 1	    I*1		Day of the image ( not used for bathymetry )
 2- 2	    I*1		Month of the image ( not used for bathymetry )
 3- 4	    I*2		Year of the image ( not used )
 5- 6	    I*2		Time as HHMM ( not used )    
 7- 8 	    I*2		Number of Observations ( not used )
 9- 12	    R*4		Mean
 13- 16	    R*4		Standard deviation
 17- 20     R*4		Minimum
 21- 24	    R*4		Maximum
 25- 28	    R*4		Scaling factor
 29- 32	    R*4		Scaling summand
 33- 48			not used

Records 6 through 370 contain the image records.  The image data is stored 
in I*1; byte values 1-10 ( see bytes 15 and 16 in record 1) contain ice 
information and byte values 11- 255 contain surface temperature information.  
As with the bathymetry data, the first data value corresponds to the first 
location grid point, the second value to the second grid point, etc.

To unpack the ice values, use the following lookup table : 

	Byte Value           Ice Cover
	        1		  100%
	        2	           90%
	        3	           80%
	       ..  	           ..
 	       ..	           ..
	        9	           20%
	       10	           10%


To unpack the surface temperature ( all byte values must be > 10 ), use the 
following scaling formula :

    Temperature = ( Unsigned Byte Value - Scaling Summand ) / Scaling Factor