Contents - Index


Lookup File Formats

 

A Lookup file is a two-dimensional table of data that has been stored in a disk file.  A name and display format for each column of data may also be stored, depending on the file format.  Lookup files can be accessed by the Differentiate, Interpolate, Lookup, LookupCol, and LookupRow , SumLookup, AvgLookup, MinLookup, MaxLookup, and StdDevLookup commands in the same manner as for Lookup tables.  The only difference is that the name of the file (with the file name extension) is provided to the command instead of the name of the table. EES recognizes both binary and ASCII forms for Lookup files.  In addition, EES can read and write EXCEL files.  Binary files are identified with a .LKT filename extension.  ASCII Lookup files can have a .TXT,  .CSV, or .DAT filename extension.  Each file format has advantages and disadvantages.  The binary form is read in more quickly and it requires smaller file sizes.  The ASCII form is easier to edit and it can be read and written by spreadsheet or other applications.  Details for each file type follow:

 

Binary Lookup files (.LKT and .LKT64)

Binary Lookup files store all of the information that appears in a Lookup Table window in a binary file on disk, including the data, and the column name, units, and display format for each file type.  A binary Lookup file is created using the Save Lookup Table command or with the $SaveTable directive.  Once created, the Lookup file can be opened into the Lookup Table window using the Open Lookup Table menu command, the $OPENLOOK directive, or a Link button (type 6) on the Diagram window.   However, it is not necessary to open the file in order to access the data in the file.  The file is opened internally (without needing the Lookup table) when commands such as Interpolate, Lookup etc. are provided with the name of the file.  The .LKT file format can be read or written by both the 32-bit and 64-bit versions of EES.  The .LKT64 file format can only be read or written by the 64-bit license of EES.

 

EXCEL Lookup files (.XLSX and .XLS)

EES can read EXCEL .XLSX or .XLS files.  If the first row in the file contains string information, EES will interpret that row to be the name of the columns that appear in the Lookup table header.  If the second row contains string information, it will be interpreted as the units for the data.  EES can save a Lookup table in .XLSX format.  The first row in the save file will contain the names of columns and the second row will contain the units.  If units are not specified, the second row will contain blanks.  Data begin on the third row, as shown below.

 

 

NOTE:  If the EXCEL Lookup File contains columns with string information, the data must begin on the third row.

 

ASCII Lookup files (.TXT)

There are several variations for the .TXT Lookup file format.  In the basic form, the first line of the file contains the number of rows and columns in the table.  Each following line provides the data for one row with the value for each column separated by one or more spaces or a tab character.  The basic form does not provide a means of specifying the names, units, or display format for the data.  EES assigns the names "COLUMN1', 'COLUMN2', etc. and these column names should be used when the file is used with the Interpolate or Differentiate commands.  Automatic formatting is used to display the data if the file is read into the Lookup Table with the Open Lookup Table command.  The following example shows the .TXT data needed for a Lookup file with five rows and three columns, with no column header information.  

 

5  3

1 11 111

2 22 222

3 33 333

4 44 444

5 55 555

 

If the number of rows is a negative number, EES will determine the number of rows of data in the file.

 

If the number of columns is a negative number, EES will expect to find the format specification.  A format specification consists of one or two characters.  The first character is the type of format and the second character is the number of digits provided for this format.  Valid format specifications are:

 

A               {auto format.  A followed by a number, e.g., A3, is accepted but the number is ignored.}

F#             {fixed decimal format with # digits after the decimal point, e.g., F3}

E#             {exponential format with # digits after the decimal point or #+1 significant figures, e.g., E2}

N#             {N significant figure format with  # being the number of significant figures, e.g., N4}

G#             {engineering format with # significant figures, e.g., G4}

T#       {Time format;  if # is 0, the default format is used; if # is 1, the format is hours:minutes:seconds;  if # is 2, the format is hours:minutes}

D#             {Date format;  # must be between 0 and 9 representing different date formats.  0 is the default format}

d#       {DateTime format;  # must be between 0 and 9 representing different date formats.  0 is the default format}

S               {string format.  S followed by a number, e.g., S0, is accepted but the number is ignored.}

 

The format specification is followed by one or more spaces and then the column heading and units for each column.  If a column contains string data, then the format specification must be S (or S#) and the string data must be contained in single quotes.  Units are optional but if supplied, they must be enclosed in square brackets with a least one space separating them from the column name.  The following lines contain the .TXT data for each row, separated by one or more spaces or a tab.  The example below would create a table with 2 rows and 3 columns.  The columns would be formatted with E4, F1, and S format specifications and the column names will be ColA, ColB, and Name.

 

2  -3

E4 ColA [Btu]

F0 ColB 

S Name

1.23E-12 2.2 'A'

2.34E-11 4.8 'B'

 

The $SaveTable directive provides a way to save a Lookup table as a .txt file including the column header information. 

 

ASCII Lookup files (.CSV)

The .CSV file provides only data without any information concerning the column names or data format.  The number of values in the first row of the file determines the number of columns in the table.  The number of rows in the table is equal to the number of rows of data.  Values on each row are separated with the list separator character.  Each row ends with a linefeed - carriage return.  

 

ASCII Lookup files (.DAT)

Like the .CSV file, files with this filename extension provide only data without any information concerning the column names or data format.  The number of values in the first row of the file determines the number of columns in the table.  The number of rows in the table is equal to the number of rows of data.  Values on each row are separated with a tab character.  Each row ends with a linefeed - carriage return.  

 

Files having filename extensions other than .TXT, .LKT, .LKT64, .CSV, or .DAT can be read provided that they are ASCII files with numerical values separated by a space or comma.

 

Lookup files with ASCII data may be read in with specifications provided by a FORMAT file.