   Specifications of AGRA format version of 2004.12.29
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   AGRA format is for describing time series of Stokes coefficients
of the development of the geopotential into the spherical harmonics.

   A file in AGRA format consists of records of variable length 
in ASCII coding. The records are separated by a character with decimal 
code 13. The records are grouped into sections. Sections follow
in this order:

1) Header record -- the first record should have a signature: 
                    AGRA Format version of 2004.12.29
                    
                    The header record allows to distinguish a valid 
                    file in the AGRA format from files in other 
                    formats.

2) P-records section
   P-record  has letter P in the first field. It defines the number 
             of records of each type, the number of epochs and 
             the maximum degree of the development.

3) T-records section
   T-record  has letter T in the first field. It defines a time epoch 
             of the beginning of the range, a time epoch of the end 
             of the range and duration of the sampling interval. 
             Time epochs and a sampling interval cannot be defined 
             more than once.


4) D-records section
   D-record  has letter D in the first field. It defines the cosine 
             and sine component of the Stokes coefficient for
             a given order, given degree and given time epoch.
             The time epoch should be within the epochs range defined 
             in the preceding T-records. The Stokes coefficient 
             for a given order, given degree and given epoch cannot 
             be defined more than once.

5) Trailer record -- the last record is the same as the header record.

Records which start from # character are considered as comments.

Format of a P-record:
---------------------

Field  1:1   A1    -- Record ID: letter "P".
field  2:2   a1       delimiter: blank.
Field  3:3   A1    -- Field ID:  letter "T".
field  4:4   a1       delimiter: blank.
Filed  5:5   I1    -- The number of T-records (always 3).
field  6:6   a1       delimiter: blank.
Field  7:7   A1    -- Field ID:  letter "M".
field  8:8   a1       delimiter: blank.
Field  9:11  I3    -- The maximal degree of the development
field 12:13  a2       delimiter: blank.
Field 14:14  A1    -- Field ID:  letter "E".
field 15:15  a1       delimiter: blank.
Field 16:20  I5    -- The total number of epochs.
field 21:21  a1       delimiter: blank.
Field 22:22  A1    -- Field ID:  letter "D"
field 23:23  a1       delimiter: blank.
Field 24:30  I7    -- The total number of D-records.

Format of a T-record:
---------------------

Field 1-8 A8 -- Record identifier. Three record identifiers are 
                supported: "T begin ", "T end   ", "T sample".
                Therefore, there are three types of T-records.
                A valid file in AGRA format should have one 
                T-record of each type.

If the record ID is "T begin ", then the record defines the first 
epoch of the interval. Format:

   Field  1:8   A8     -- Record ID. Should be "T begin ".
   field  9:10  a2        delimiter: blanks.
   Field 11:15  I5     -- Integer modified Julian date at the midnight 
                          of the first epoch.
   field 16:16  a1        delimiter: blanks.
   Field 17:23  F7.1   -- Time elapsed from the midnight of the first 
                          epoch in TAI, in seconds.
   field 24:25  a2        delimiter: blank.
   Field 26:44  A19    -- Date and time in YYYY.MM.DD-hh:mm:ss format.
                          This field is for information only. 
                          Parsing software MUST ignore it.

If the record ID is "T end   ", then the record defines the last epoch
of the range. Format:

   Field  1:8   A8     -- Record ID. Should be "T end   ".
   field  9:10  a2        delimiter: blanks.
   field 11:15  I5     -- Integer modified Julian date at the midnight
                          of the last epoch.
   field 16:16  a1        delimiter: blanks.
   field 17:23  F7.1   -- Time elapsed from the midnight of the last
                          epoch in TAI, in seconds.
   field 24:25  a2        delimiter: blank.
   field 26:44  A19    -- Date and time in YYYY.MM.DD-hh:mm:ss format.
                          This field is for information only. 
                          Parsing software MUST ignore it. 

If the record ID is "T sample ", then the record defines duration of
the sampling interval: the interval between two consecutive time epochs.
Format:

   Field  1:8   A8     -- Record ID. Should be "T sample".
   field  9:10  a2        delimiter: blanks.
   field 11:26  F16.11 -- Sampling interval in days.


Format of a D-record:
---------------------

Field  1:1   A1    -- Record ID. Should be letter D (decimal code 68).
field  2:2   a1       delimiter: blanks.
Field  3:7   I5    -- Epoch index. Epoch index 1 corresponds to the 
                      beginning of the epochs range. Therefore, the 
                      epoch of a D-record is 
                      (MJD,TAI) + (K-1)*Sample_interval
                      where MJD,TAI -- the epoch of the first epoch 
                      defined in the T-record and K is the epoch index.
field  8:9   a2       delimiter: blanks.
Field 10:14  I5    -- Integer modified Julian date at the midnight of
                      the epoch. This field is for information only. 
                      Parsing software MUST ignore it.
field 15:15  a1       delimiter: blank.
Field 16:22  F7.1  -- Time elapsed from the midnight of the epoch 
                      in TAI, in seconds. This field is for 
                      information only. Parsing software MUST ignore it.
field 23:24  a2       delimiter: blanks.
Field 25:43  A19   -- Epoch date and time (TAI) in YYYY.MM.DD-hh:mm:ss 
                      format. This field is for information only. 
                      Parsing software MUST ignore it.
field 44:45  a2       delimiter: blanks.
Field 46:48  I3    -- Degree of the harmonic in range [1, MAX_ORDER]
field 49:49  a1       delimiter: blank.
Field 50:52  I3    -- Order of the harmonic in range [1, MAX_ORDER]
field 53:54  a2       delimiter: blank.
Field 55:66  D12.5 -- Cosine Stokes coefficient, dimensionless
field 67:67  a1       delimiter: blank.
Field 68:79  D12.5 -- Sine Stokes coefficient, dimensionless


Comments:
---------

  
  1. Gaps in time series of Stokes coefficients are not allowed. 
     Coefficients for all consecutive epochs within the range 
     should be defined. In the case if there was the gap in the 
     data the "MISSING VALUE", 1.000D20 is inserted.

  2. D-records must be sorted in the order of increasing time epochs.
