DEFINE HEADER

###
DEFINE HEADER

            [SIC\]DEFINE HEADER Var1 File1 Key1 [Var2 File2 Key2 [...]]
                        [/GLOBAL] [/TRIM [Rank]] [/LIKE OtherVar]

        Define  variables  associated to the HEADER of the GILDAS images located
        in the files specified by File1, File2, etc...  The keywords Key1, Key2,
        etc... must be either READ or WRITE.

        FileJ  can  be  * to define a virtual header. In this case, KeyJ must be
        IMAGE or UVDATA. VarJ must include the dimensions, or the  /LIKE  option
        should be present to derive them from an existing image.

        The following variables are defined:

           ! General section
           VAR%GENE       Integer        Length of section
           VAR%NDIM       Integer        Number of dimensions (ReadOnly)
           VAR%DIM        Integer[7]     Dimensions           (ReadOnly)
           VAR%CONVERT    Double[3,7]    Conversion formulae for the 7 axes:
                                         Reference pixel,
                                         Value at reference pixel,
                                         Increment

           ! Blanking section
           VAR%BLAN       Integer        Length of section
           VAR%BLANK      Real[2]        Blanking and tolerance

           ! Extrema section
           VAR%EXTREMA    Integer        Length of section
           VAR%MAX        Real           Maximum of data
           VAR%MIN        Real           Minimum of data
           VAR%MINLOC     Integer[7]     Position of min
           VAR%MAXLOC     Integer[7]     Position of max

           ! Units and coordinates system section
           VAR%DESC       Integer        Length of section
           VAR%UNIT       Char*12        Image unit
           VAR%UNIT1      Char*12        First axis type
           VAR%UNIT2      Char*12        Second axis type
           VAR%UNIT3      Char*12        Third axis type
           VAR%UNIT4      Char*12        Fourth axis type
           VAR%SYSTEM     Char*12        Coordinate system

           ! Position section
           VAR%POSI       Integer        Length of section
           VAR%SOURCE     Char*12        Source name
           VAR%RA         Double         Right Ascension
           VAR%DEC        Double         Declination
           VAR%LII        Double         Galactic longitude
           VAR%BII        Double         Galactic latitude
           VAR%EQUINOX    Real           Equinox of coordinates

           ! Projection section
           VAR%PROJ       Integer        Length of section
           VAR%PTYPE      Integer        Projection type (code)
           VAR%A0         Double         First coordinate of projection center
           VAR%D0         Double         Second coordinate of projection center
           VAR%ANGLE      Double         Position angle of projection
           VAR%X_AXIS     Integer        First projected axis
           VAR%Y_AXIS     Integer        Second projected axis

           ! Spectroscopy section
           VAR%SPEC       Integer        Length of section
           VAR%LINE       Char*12        Line name
           VAR%FREQRES    Double         Frequency resolution
           VAR%IMAGFRE    Double         Image Frequency
           VAR%RESTFRE    Double         Rest Frequency
           VAR%VELRES     Real           Velocity resolution
           VAR%VELOFF     Real           Velocity offset
           VAR%F_AXIS     Integer        Frequency/Velocity axis
           VAR%DOPPLER    Real           Doppler factor
           VAR%VTYPE      Integer        Velocity type (code)

           ! Beam section
           VAR%BEAM       Integer        Length of section
           VAR%MAJOR      Real           Major axis of beam
           VAR%MINOR      Real           Minor axis of beam
           VAR%PA         Real           Position angle of beam

           ! Noise section
           VAR%SIGMA      Integer        Length of section
           VAR%NOISE      Real           Theoretical noise
           VAR%RMS        Real           Actual noise

           ! Proper motion section
           VAR%PROPER     Integer        Length of section
           VAR%MU         Real[2]        Along RA,DEC in mas/year
           VAR%PARALLAX   Real           Parallax in mas

           ! Telescope section
           VAR%TELE_SEC   Integer        Length of section
           VAR%NTEL       Integer        Number of telescopes
           ! For each telescope i=1 to NTEL:
           VAR%TELi%LON   Double         Telescope longitude
           VAR%TELi%LAT   Double         Telescope latitude
           VAR%TELi%ALT   Real           Telescope altitude [m]
           VAR%TELi%DIAM  Real           Telescope diameter [m]
           VAR%TELi%NAME  Char*12        Telescope name

        where  VAR  is the specified variable name for the header. VAR becomes a
        dummy variable of type header, which can only be referenced in a further
        DELETE /VARIABLE  command, in structure assignments through command LET,
        or in the HEADER command. The VAR%item variables  are  ReadOnly  if  the
        keyword  Key  is  READ, ReadWrite otherwise (including of course virtual
        headers), except for the dimension variables which cannot be modified.