Astronomical Data Center

[ADC

FORTRAN Format Descriptors in ADC Documents

The CDS/ADC standard document structure uses FORTRAN format descriptors as a compact way to describe a data line. There are a dozen or so FORTRAN format descriptors, but only a few are commonly used in the standard documents:

Descriptor Meaning
Aw Interpret the next w characters as a text string.
Iw Interpret the next w characters to an INTEGER value.
Fw.d Interpret the next w characters as a REAL number.
If no decimal point is included, the final
d digits are the fractional part.
Ew.d Interpret the next w characters as a REAL number
in exponential notation.
 Where:
                    w  = positive integer specifying FIELD WIDTH
                    d  = non-negative integer specifying number of
                           digits to display to right of decimal.

The A format descriptor

A-fields are used for the description of textual material, in the form of character strings. Most catalog data fields containing a mix of alphanumeric characters are assigned a 'A' descriptor.

The I format descriptor

I-fields are used for the description of numeric data in the form of integers, and consist of a succession of decimal digits possibly preceded by a + or - sign. The sign character may be omitted, when the integer is assumed to be positive. Its form is Iw, where w is an unsigned integer indicating the number of characters to be read (the width of the field). These characters must consist of decimal digits and/or spaces, which are interpreted as zeroes, with an optional + or - sign before the first digit.

The F format descriptor

F-fields are used for the description of floating point numbers. They are as I-fields except that a `decimal point' character may appear to the right of the sign character. It has the form Fw.d, where w is an unsigned integer representing the width of the field and d is an unsigned integer representing the number of digits in the fractional part.

The corresponding input item must consist of decimal digits and/or spaces, with an optional sign anywhere before the first digit and an optional decimal point. As with the I format descriptor, spaces are interpreted as zeroes. If there is no decimal point in the item, the number of fractional digits is indicated by d.

The E format descriptor

This is used for the description of real numbers in exponential notation. It has a similar form to the F format descriptor. A real number can be written in exponential notation as a real or integer number followed by an exponent in the form of the letter 'E' followed by the power of 10 by which the number is to be multiplied.

Repeat count

The I, F and E format descriptors may be repeated by preceding them by a number indicating the number of repetitions. For example:
       4I6
The format 4I6 describes a line consisting of 4 successive I6 fields. When no integer (n) appears before a letter code, it implies that the repeat count is one (n=1).

NOTES ON DESCRIPTORS:

  1. Values for I, F, and E descriptors will be right justified.
  2. The field width w must include enough space for a negative sign in the field width for I, E, F, and for decimal point for E, F and for exponent for E.
  3. When using the E descriptor, the number will be NORMALIZED. This means the number is shifted over so that the first digit is in the tenths position. A leading zero and decimal are always present and a minus sign, if needed. The exponent always requires 4 spaces; E, the sign and 2 digits.

EXAMPLE OF DESCRIPTORS IN A BYTE-BY-BYTE TABLE:

The following table with its format specifications descrbes a data file of the form shown in the sample records that follow the table.
Byte-by-byte Description of file: uv.dat
--------------------------------------------------------------------------------
   Bytes     Format   Units     Label     Explanations
--------------------------------------------------------------------------------
   1-  3      I3      ---       ID        Lanning number
       4      A1      ---       rem       "*" indicates a note in notes.dat
   6-  7      I2      h         RAh       Hours of Right Ascension (J2000)
   9- 10      I2      min       RAm       Minutes of Right Ascension (J2000)
  12- 16      F5.2    s         RAs       Seconds of Right Ascension (J2000)
      18      A1      ---       DE-       Sign of declination
  19- 20      I2      deg       DEd       Degrees of declination (J2000)
  22- 23      I2      arcmin    DEm       Minutes of declination (J2000)
  25- 29      F5.2    arcsec    DEs       Seconds of declination (J2000)
  32- 36      F5.2    mag       B         ? Approximate blue magnitude
      37      A1      ---       u_B       : indicates B is uncertain
  39- 42      F4.1    mag       U-B       ? Approximate U-B
      43      A1      ---       u_U-B     : indicates U-B is uncertain
--------------------------------------------------------------------------------
Sample data records described by above:
 15* 16 58 01.43 +34 43 28.55  18.5
 16* 18 20 35.4  -16 10 48.64
 17* 18 23 00.39 -04 37 09.6   20.
 18* 18 47 39.12 +01 57 39.09  12.
 19  19 33 49.94 +18 52 03.12  15.5
 20  19 43 31.19 +18 24 35.22  12.



Author: Jame E. Gass / Raytheon ITSS /
Last Revised: 26 March 1998 [GLS]