              Specpr format, version 2.                                                                           Specpr format, version 3.  (DRAFT 1, PROPOSED)
                                                                                                    
Records are fixed format, 1536 bytes/record.                                                        Records are fixed format, 2048 bytes/record.
Record number counting starts at 0, data starts at record 1 (byte 1537 in the file)                 Record number counting starts at 0, data starts at record 1 (byte 2049 in the file)
                                                                                                    
Record 0 contains:                                                                                  Record 0 contains:
SPECPR_FS=2.0                                                                                       SPECPR_FS=3.0
RECORD_BYTES=1536                                                                                   RECORD_BYTES=2048
LABEL_RECORDS=1                                                                                     LABEL_RECORDS=1
                                                                                                    
Binary data are in IEEE format real numbers and non-byte swapped                                    Binary data are in INTEK format
    integers (compatible with all Sun Microsystems, and Hewlett                                         
    Packard workstations (Intel and some DEC machines are byte                                          
    swapped relative to Suns and HPs).                                                                  
                                                                                                    
Each record may contain different information according to the following scheme.                    Each record may contain different information according to the following scheme.
                                                                                                    
                   SPECtrum Processing Routines                                                                        SPECtrum Processing Routines
                            Data Format 2                                                                                       Data Format 3
                           3/4/1988 - 2017                                                                                      11/05/2017
                                                                                                    
                                                                                                    
                                                                      Length                                                                                              Length
Variable                  Description                                 (bytes)                       Variable                  Description                                 (bytes)
------------------------------------------------------------------------------                      ------------------------------------------------------------------------------
icflag          32 one-bit flags:                                         4                         icflag          32 one-bit flags:                                         4
                (low bit = 0, high bit = 31)                                                                        (low bit = 0, high bit = 31)
                bit 00 continuation data flag                                                                       bit 00 continuation data flag
                        =0 first record of a spectrum consists of:                                                          =0 first record of a spectrum consists of:
                                header then 256 data channels                                                                       header then 256 data channels
                        =1 continuation data record consisting of:                                                          =1 continuation data record consisting of:
                                bit flags followed by 1532 bytes of                                                                 bit flags followed by 1532 bytes of
                                real data (bit 1=0) (383 channels)                                                                  real data (bit 1=0) (383 channels)
                                or 1532 bytes of text (bit 1=1).                                                                    or 1532 bytes of text (bit 1=1).
                                A maximum of 12 continuation records                                                                A maximum of 12 continuation records
                                are allowed for a total of 4852                                                                     are allowed for a total of 4852
                                channels (limited by arrays of 4864)                                                                channels (limited by arrays of 4864)
                                or 19860 characters of text (bit 1=1).                                                              or 19860 characters of text (bit 1=1).
                bit 01 text/data flag:                                                                              bit 01 text/data flag:
                       =0 the data in the array "data" is data                                                             =0 the data in the array "data" is data
                       =1 the data in the array "data" is ASCII text                                                       =1 the data in the array "data" is ASCII text
                                as is most of the header info.                                                                      as is most of the header info.
                bit 02 flag to indicate whether or not the data for                                                 bit 02 flag to indicate whether or not the data for
                       the error bar (1 sigma standard deviation of                                                        the error bar (1 sigma standard deviation of
                       the mean) is in the next record set.                                                                the mean) is in the next record set.
                       =0: no errors, =1: errors in next record set.                                                       =0: no errors, =1: errors in next record set.
                bit 03 RA, Dec / Long., Lat flag:                                                                   bit 03 RA, Dec / Long., Lat flag:
                       =0 the array "ira" and "idec" corresponds to                                                        =0 the array "ira" and "idec" corresponds to
                          the right ascension and declination of an                                                           the right ascension and declination of an
                          astronomical object.                                                                                astronomical object.
                       =1 the array "ira" and "idec" correspond to                                                         =1 the array "ira" and "idec" correspond to
                          the longitude and latitude of a spot on a                                                           the longitude and latitude of a spot on a
                          planetary surface.                                                                                  planetary surface.
                bit 04 variable iscta universal time/civil time flag                                                bit 04 variable iscta universal time/civil time flag
                       =0 cta is civil time                                                                                =0 cta is civil time
                       =1 cta is universal time                                                                            =1 cta is universal time
                bit 05 variable isctb universal time/civil time flag                                                bit 05 variable isctb universal time/civil time flag
                       =0 ctb is civil time                                                                                =0 ctb is civil time
                       =1 ctb is universal time                                                                            =1 ctb is universal time
                bit 06 unused                                                                                       bit 06 unused
                bit 07 unused                                                                                       bit 07 unused
                bit 08 unused                                                                                       bit 08 unused
                bit 09 unused                                                                                       bit 09 unused
                bit 10 unused                                                                                       bit 10 compatibility flag for version 2 conversion to format 3.
                                                                                                                           =0 no compatibility mode
                                                                                                                           =1 data are packed into records to maintain history
                                                                                                                              (see below)
                bit 11 unused                                                                                       bit 11 unused
                bit 12 unused                                                                                       bit 12 unused
                bit 13 unused                                                                                       bit 13 unused
                bit 14 unused                                                                                       bit 14 unused
                bit 15 unused                                                                                       bit 15 unused
                bit 16 unused                                                                                       bit 16 unused
                bit 17 unused                                                                                       bit 17 unused
                bit 18 unused                                                                                       bit 18 unused
                bit 19 unused                                                                                       bit 19 unused
                bit 20 unused                                                                                       bit 20 unused
                bit 21 unused                                                                                       bit 21 unused
                bit 22 unused                                                                                       bit 22 unused
                bit 23 unused                                                                                       bit 23 unused
                bit 24 unused                                                                                       bit 24 unused
                bit 25 unused                                                                                       bit 25 unused
                bit 26 unused                                                                                       bit 26 unused
                bit 27 unused                                                                                       bit 27 unused
                bit 28 unused                                                                                       bit 28 unused
                bit 29 unused                                                                                       bit 29 unused
                bit 30 unused                                                                                       bit 30 unused
                bit 31 unused                                                                                       bit 31 unused
                bit 32 unused                                                                                       bit 32 unused
                                                                                                    
*************** case 1: bit 00 = 0, bit 01 = 0 ****************************                         *************** case 1: bit 00 = 0, bit 01 = 0, bit 10 = 0 or 1 ***********
               (256 bytes header, 1024 bytes of data: 256 channels)                                                 (512 bytes header, 1024 bytes of data: 256 channels)
                                                                                                    
Variable        Description                                           Bytes                         Variable        Description                                           Bytes

icflag          Bit flags: 32 bits, see above.                            4                         icflag          Bit flags: 32 bits, see above.                            4
                                                                                                    
ititl           40 character title which describes the                   40                         ititl           60 character title which describes the                   60
                data (ASCII, character*40).                                                                         data (ASCII, character*60).

                                                                                                    sampid          Sample ID (ASCII, character*20)                          20

                                                                                                    dkeywrd         Data keyword (e.g. specfind -e entries)                   8
                                                                                                                       (ASCII, character*8).
                                                                                                                    e.g. AREF, REFL, ABSCOEF, INDXREF, etc.

                                                                                                    sppcodes        Spectral purity codes                                    12
                                                                                                                       (ASCII, character*12).
                                                                                                                    e.g. W1R1Fa, W5R4Nbb_, etc.

                                                                                                    dlabel          Data label (ASCII, character*40)                         40
                                                                                                                    e.g. Reflectance, Wavelength (microns), Time (Seconds)
                                                                                                    
usernm          The name of the user that created the data record         8                         usernm          The name of the user that created the data record         8
                (ASCII, character*8).                                                                               (ASCII, character*8).
                                                                                                    
iscta           Civil or Universal time when data was                     4                         iscta           Civil or Universal time when data was                     4
                last processed (integer*4 in scaled seconds).                                                       last processed (integer*4 in scaled seconds).
                Scaled by 24000.  See flag #04.                                                                     Scaled by 24000.  See flag #04.
                                                                                                    
isctb           Civil or Universal time at the start of                   4                         isctb           Civil or Universal time at the start of                   4
                the spectral run (integer*4 in scaled seconds).                                                     the spectral run (integer*4 in scaled seconds).
                Scaled by 24000. See flag #05.                                                                      Scaled by 24000. See flag #05.
                                                                                                    
jdatea          Date when data was last processed                         4                         jdatea          Date when data was last processed                         4
                Stored as integer*4 Julian Day number *10                                                           Stored as integer*4 Julian Day number *10
                                                                                                    
jdateb          Date when the spectral run began                          4                         jdateb          Date when the spectral run began                          4
                Stored as integer*4 Julian Day number *10                                                           Stored as integer*4 Julian Day number *10
                                                                                                    
istb            Siderial time when the spectral run started.              4                         istb            Siderial time when the spectral run started.              4
                (integer*4 in scaled seconds).                                                                      (integer*4 in scaled seconds).
                Scaled by 24000. See flag #05.                                                                      Scaled by 24000. See flag #05.
                                                                                                    
isra            Right ascension coordinates of an astronomical            4                         isra            Right ascension coordinates of an astronomical            4
                object, or longitude on a planetary surface                                                         object, or longitude on a planetary surface
                (integer*4 numbers in seconds *1000)                                                                (integer*4 numbers in seconds *1000)
                (RA in RA seconds, Longitude in arc-seconds)                                                        (RA in RA seconds, Longitude in arc-seconds)
                See flag #06.                                                                                       See flag #06.
                                                                                                    
isdec           Declination coordinates of an astronomical                4                         isdec           Declination coordinates of an astronomical                4
                object, or latitude on a planetary                                                                  object, or latitude on a planetary
                surface (integer*4 number in arc-seconds *1000).                                                    surface (integer*4 number in arc-seconds *1000).
                See flag #06.                                                                                       See flag #06.
                                                                                                    
itchan          Total number of channels in the spectrum                  4                         itchan          Total number of channels in the spectrum                  4
                (integer*4 value from 1 to a value set at                                                           (integer*4 value from 1 to a value set at
                compile time, e.g. 32000, 69000)                                                                    compile time, e.g. 32000, 69000)
                                                                                                    
irmas           The equivalent atmospheric thickness through              4                         irmas           The equivalent atmospheric thickness through              4
                which the observation was obtained (=1.0                                                            which the observation was obtained (=1.0
                overhead scaled: airmass*1000; integer*4).                                                          overhead scaled: airmass*1000; integer*4).
                                                                                                    
revs            The number of independent spectral scans                  4                         revs            The number of independent spectral scans                  4
                which were added to make the spectrum                                                               which were added to make the spectrum
                (integer*4 number).                                                                                 (integer*4 number).
                                                                                                    
iband(2)        The channel numbers which define the band                 8                         iband(2)        The channel numbers which define the band                 8
                normalization (scaling to unity). (integers*4)                                                      normalization (scaling to unity). (integers*4)
                                                                                                    
irwav           The record number within the file where the               4                         irwav           The record number within the file where the               4
                wavelengths are found (integer*4).                                                                  wavelengths are found (integer*4).
                                                                                                    
irespt          The record pointer to where the resolution can            4                         irespt          The record pointer to where the resolution can            4
                be found (or horizontal error bar) (integer*4).                                                     be found (or horizontal error bar) (integer*4).
                                                                                                    
irecno          The record number within the file where the               4                         irecno          The record number within the file where the               4
                data are located (integer*4 number).                                                                data are located (integer*4 number).
                                                                                                    
itpntr          Text data record pointer. This pointer points             4                         itpntr          Text data record pointer. This pointer points             4
                to a data record where additional text describing                                                   to a data record where additional text describing
                the data may be found.  (32 bit integer)                                                            the data may be found.  (32 bit integer)
                                                                                                    
ihist           The program automatic 60 character history.              60                         ihist           The program automatic 80 character history.              80
                (ASCII, character*60)                                                                               (ASCII, character*60)
                                                                                                    
mhist           Manual history (4 lines of 74 characters                296                         mhist           Manual history                                          400
                each.  Program automatic for large history                                                          Program automatic for large history
                requirements (ASCII, character*296).                                                                requirements (ASCII, character*400).
                                                                                                    
nruns           The number of independent spectral runs                   4                         nruns           The number of independent spectral runs                   4
                which were summed or averaged to make this                                                          which were summed or averaged to make this
                spectrum (integer*4).                                                                               spectrum (integer*4).
                                                                                                    
siangl          The angle of incidence of illuminating                    4                         siangl          The angle of incidence of illuminating                    4
                radiation (Integer*4 number, in arc-seconds*6000).                                                  radiation (Integer*4 number, in arc-seconds*6000).
                (90 degrees=1944000000; -90 deg <= angle <= 90 deg)                                                 (90 degrees=1944000000; -90 deg <= angle <= 90 deg)
                integrating sphere = 2000000000                                                                     integrating sphere = 2000000000
                Geometric albedo   = 2000000001                                                                     Geometric albedo   = 2000000001

                                                                                                    siazim          The azimuth angle of the illuminating radiation           4
                                                                                                                    (Integer*4 number, in arc-seconds*1500).
                                                                                                    
seangl          The angle of emission of illuminating                     4                         seangl          The angle of emission of illuminating                     4
                radiation (Integer*4 number, in arc-seconds*6000).                                                  radiation (Integer*4 number, in arc-seconds*6000).
                (90 degrees=1944000000; -90 deg <= angle <= 90 deg)                                                 (90 degrees=1944000000; -90 deg <= angle <= 90 deg)
                integrating sphere = 2000000000                                                                     integrating sphere = 2000000000
                Geometric albedo   = 2000000001                                                                     Geometric albedo   = 2000000001

                                                                                                    seazim          The azimuth angle of the emitted radiation                4
                                                                                                                    (Integer*4 number, in arc-seconds*1500).

                                                                                                    azimdef         Azimuth angle definition of zero degrees                 20
                                                                                                                    character*20
                                                                                                    
sphase          The phase angle between iangl and eangl                   4                         sphase          The phase angle between iangl and eangl                   4
                (Integer*4 number, in arc-seconds*1500).                                                            (Integer*4 number, in arc-seconds*1500).
                (180 degrees=972000000; -180 deg <= phase <= 180 deg)                                               (180 degrees=972000000; -180 deg <= phase <= 180 deg)
                integrating sphere = 2000000000                                                                     integrating sphere = 2000000000
                                                                                                    
iwtrns          Weighted number of runs (the number of runs               4                         iwtrns          Weighted number of runs (the number of runs               4
                of the spectrum with the minimum runs which was                                                     of the spectrum with the minimum runs which was
                used in processing this spectrum, integer*4).                                                       used in processing this spectrum, integer*4).
                                                                                                    
itimch          The time observed in the sample beam for                  4                         itimch          The time observed in the sample beam for                  4
                each half chop in milliseconds (for chopping                                                        each half chop in milliseconds (for chopping
                spectrometers only). (integer*4)                                                                    spectrometers only). (integer*4)
                                                                                                    
xnrm            The band normalization factor. For data scaled            4                         xnrm            The band normalization factor. For data scaled            4
                to 1.0, multiply by this number to recover                                                          to 1.0, multiply by this number to recover
                photometric level (32 bit real number).                                                             photometric level (32 bit real number).
                                                                                                    
scatim          The time it takes to make one scan of the                 4                         scatim          The time it takes to make one scan of the                 4
                entire spectrum in seconds (32 bit real number).                                                    entire spectrum in seconds (32 bit real number).
                                                                                                    
timint          Total integration time (usually=scatime * nruns)          4                         timint          Total integration time (usually=scatime * nruns)          4
                (32 bit real number).                                                                               (32 bit real number).
                                                                                                    
tempd           Temperature in degrees Kelvin                             4                         tempd           Temperature in degrees Kelvin                             4
                (32 bit real number).                                                                               (32 bit real number).

                                                                                                    presstorr       Pressure in Torr                                          4
                                                                                                                    (32 bit real number).
                                                                                                    
data(256)       The spectral data (256 channels of 32 bit              1024                         data(256)       The spectral data (256 channels of 32 bit              1024
                real data numbers).                                                                                 real data numbers).
-----------------------------------------------------------------------------                       -----------------------------------------------------------------------------
        case 1: total (bytes):                                         1536                                 case 1: total (bytes):                                         2048
==============================================================================                      ==============================================================================
                                                                                                    
*************** case 2: bit 00 = 1, bit 01 = 0 ****************                                     *************** case 2: bit 00 = 1, bit 01 = 0 ****************
                                                                                                    
icflag          Flags: see case 1                                         4                         icflag          Flags: see case 1                                         4

                                                                                                    cdata(511)      The continuation of the data values (511 channels      2044 
                                                                                                                    of 32 bit real numbers),  If bit 10 =0
                                                                                                              or
cdata(383)      The continuation of the data values (383 channels      1532                         cdata(383)      The continuation of the data values (383 channels      2044
                of 32 bit real numbers).                                                                            of 32 bit real numbers).  If bit 10 =1, then
                                                                                                                    cdata(384) to cdata(511) = 0.0
                                                                                                                    This compatibility mode is used when converting
                                                                                                                    spedcpr format version to to version 3
------------------------------------------------------------------------------                      ------------------------------------------------------------------------------
        case 2: total (bytes):                                         1536                                 case 2: total (bytes):                                         2048
==============================================================================                      ==============================================================================
                                                                                                    
*************** case 3: bit 00 = 0, bit 01 = 1 ****************                                     *************** case 3: bit 00 = 0, bit 01 = 1 ****************
                                                                                                    
                                                                                                    
icflag          Flags: see case 1                                         4                         icflag          Flags: see case 1                                         4
                                                                                                    
ititle          40 character title which describes the                   40                         ititle          60 character title which describes the                   60
                data (ASCII, character*40).                                                                         data (ASCII, character*60).

                                                                                                    sampid          Sample ID (ASCII, character*20)                          20

                                                                                                    dkeywrd         Data keyword (e.g. specfind -e entries)                   8
                                                                                                                       (ASCII, character*8).
                                                                                                                       e.g. DESCRIPT
                                                                                                    
usernm          The name of the user that created the data record         8                         usernm          The name of the user that created the data record         8
                (ASCII, character*8).                                                                               (ASCII, character*8).
                                                                                                    
itxtpt          Text data record pointer. This pointer points             4                         itxtpt          Text data record pointer. This pointer points             4
                to a data record where additional text may be                                                       to a data record where additional text may be
                may be found.  (32 bit integer)                                                                     may be found.  (32 bit integer)
                                                                                                    
itxtch          The number of text characters (maximum= 19860).           4                         itxtch          The number of text characters (maximum= 19860).           4

                                                                                                    itext           1940 characters of text.  Text has embedded newlines   1940
                                                                                                                          If bit 10 =0
                                                                                                              or
itext           1476 characters of text.  Text has embedded newlines   1476                         itext           1476 characters of text.  Text has embedded newlines   1476 +464 blanks
                so the number of lines available is limited only                                                    so the number of lines available is limited only
                by the number of characters available.                                                              by the number of characters available. if bit 10 =1
                                                                                                                    then 1477-1940 = blanks
                                                                                                                    This compatibility mode is used when converting
                                                                                                                    spedcpr format version to to version 3
------------------------------------------------------------------------------                      ------------------------------------------------------------------------------
        case 3: total (bytes):                                         1536                                 case 3: total (bytes):                                         2048
==============================================================================                      ==============================================================================
                                                                                                    
*************** case 4: bit 00 = 1, bit 01 = 1 ******************                                   *************** case 4: bit 00 = 1, bit 01 = 1 ******************
                                                                                                    
icflag          Flags: see case 1                                         4                         icflag          Flags: see case 1                                         4

                                                                                                    tdata           2044 characters of text. if bit 10 =0                  2044
                                                                                                              or
tdata           1532 characters of text.                               1532                         tdata           1532 characters of text. if bit 10 =1                  1532 +512 blankc
                                                                                                                    then 1533-2044 = blanks
                                                                                                                    This compatibility mode is used when converting
                                                                                                                    spedcpr format version to to version 3
------------------------------------------------------------------------------                      ------------------------------------------------------------------------------
        case 4: total (bytes):                                         1536                                 case 4: total (bytes):                                         1536
==============================================================================                      ==============================================================================
