A CSV (Comma Separated Variables) or spread-sheet format is defined to be one where:
♦ There is one record per origin row containing n elements for each of n columns plus, optionally row and/or zone names; see below.
♦ Each cell value is separated by a ‘,’ from the next value.
♦ Cell values may be written as integers or with a variable number of decimal places (see 10.15.2).
♦ No blanks (but see below).
Essentially the spreadsheet format is free format with commas rather than fixed columns used to distinguish individual cell values. It is the format regularly used by Windows programs such as EXCEL and therefore it is frequently used by SATURN users to transfer files to and from EXCEL.
(N.B. Fixed column input files may be processed as CSV files as long as there is at least one space between successive values, or both commas and/or spaces may be used. However there may be certain instances where spaces are not recognised as CSV-compatible so that the use of “pure” CSV formats is recommended.)
Note that zero cell values must be included as must rows which are all zeros. However, an input record may have fewer cells than the standard number of columns, in which case the missing cells “on the right” default to zero.
If desired each record may contain either n+1 or n+2 elements by including the sequential row number and/or the “name” of the zone at the start of each record to assist in the identification of each row.
The choice of whether or not row sequential numbers and/or row names are included may be set interactively prior to reading a data file or, if the CSV data is being input under the “batch procedure” MXM1 (see 4.1), by the Namelist parameters KP_ROW or KP_NAM (see 10.5.2).
One potential technical problem with spreadsheet style formats is that, with all elements per row held in a single record, the record length may become too long. It is partly for this reason that, as discussed further in Section 10.15, a spreadsheet file may contain only a subset of the columns which limits the size of each record. In such cases the transfer of matrix data to and from external programs must take place in stages, a necessary evil to overcome the problem of record lengths.
Stacked Matrices
Stacked matrix files may also be input using the CSV format (post 10.8), in which case the user must first interactively define the number of rows, columns and levels (where the number of columns equals the number of zones and the product of columns/zones times levels should equal the number of rows). The presumption is that the first Nr records contain the first level, the second Nr records contain the second level, etc. etc.
If “zone names” are explicitly included on stacked CSV records they should be identical within each level although, strictly speaking, they are ignored after the first level has been read in. On the other hand sequential row numbers, if contained, should go right the way through from 1 to the total number of rows.
N.B. CSV formats may also be used as inputs to MXM1; see Section 4.4.