; SETAN
;---------------------------------------------------------------
;! Reads an ANtenna file info from a text file
;# Task UV
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 1997, 2008
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  This program is free software; you can redistribute it and/or
;;  modify it under the terms of the GNU General Public License as
;;  published by the Free Software Foundation; either version 2 of
;;  the License, or (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU General Public License for more details.
;;
;;  You should have received a copy of the GNU General Public
;;  License along with this program; if not, write to the Free
;;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
SETAN     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SETAN     Task to read antenna file info from a text file
INTEXT                             Input file name (Non-AIPS)
OUTNAME                            Output file name (name)
OUTCLASS                           Output file name (class)
OUTSEQ           -1.0     9999.0   Output file name (seq. #)
OUTVER           -1.0     9999.0   Output AN table version.
OUTDISK           0.0        9.0   Output file disk unit #.
----------------------------------------------------------------
SETAN
Task:  Task to read an Antenna file info from a text file.
       SETAN will either create a new AN table or replace values
       in an extant table.
Adverbs:
  INTEXT.....A file external to the AIPS system from which the
             antenna info can be read.  Use of INTEXT depends on
             the host operating system.
  OUTNAME....Output UVfile name (name).     Standard behavior
             with. File must exist.
  OUTCLASS...Output file name (class).    Standard defaults.
  OUTSEQ.....Output file name (seq. #).   0 => highest unique.
  OUTVER.....Output AN table version number.
  OUTDISK....Disk drive # of output file.
----------------------------------------------------------------
SETAN:  Task reads an external, formatted file containing
        Antenna, subarray and time info.
DOCUMENTOR: W. D. Cotton, NRAO.
RELATED PROGRAMS: AIPS, All AIPS uv tasks.

                          PURPOSE

     SETAN reads and external text file and writes the
information to an antenna (AN) table.  If the specified AN table
does not exist then it is created; if it does exist then the
values read from the text file will replace the previous values
in the table.

                        COMMENTS

INTEXT:
     The user must supply a text file containing the antenna
information.  The file contains two parts both in free field
format; a header section giving AN table header info and the
table section.  The header section of the input file contains a
series of keyword-value pairs describing the array or giving
timing information. Following this is the antenna information
given one antenna per line.  The input file can be specified as
follows shown in the following examples:
         INTEXT='disk$res:[username]antenna.dat'     (VMS)
         INTEXT='myarea:antenna.dat'                 (Unix)
            where MYAREA is an environment variable set before
            starting AIPS e.g.:
            %setenv MYAREA /mnt/username
            Note also: in UNIX all files whose names are passed
            to AIPS should have names containing only upper case
            characters.

   The header portion of the antenna file contains a number of
keyword-value pairs in free format and in arbitrary order
terminating with a '/' character.  Keywords which are recognized
are:

     ARRNAM = 'array name'   (array name)
     ARRAYX = xxx.xxd0       (X coordinate of array center)
     ARRAYY = xxx.xxd0       (Y coordinate of array center)
     ARRAYZ = xxx.xxd0       (Z coordinate of array center)
     GSTIAT = xxx.xxxd0      (GST at IAT=0 in Deg.)
     DEGPDY = xxx.xxxd0      (Earth rotation rate deg/IAT day
     FREQ = xxx.xxxd0        (Subarray reference frequency Hz)
     RDATE = 'dd/mm/yy'      (Subarray reference date)
     RDATE = 'yyyymmdd'      (Subarray reference date preferred)
     POLARX = xxx.xxx        (X component of polar position m)
     POLARY = xxx.xxx        (Y component of polar position m)
     UT1UTC = xxx.xxx        ( UT1 - UTC correction in sec.)
     IATUTC = xxx.xxx        (IAT - UTC correction in sec.)

   The header section is terminated by a '/'.  Comments may be
included preceded by a '!'.  None of the keyword value pairs is
required but tasks using the AN table may use some of this
information, especially the time and frequency items.
   Following this, is the antenna data one antenna at a time in
order: antenna number, X offset from center (m), Y offset, Z
offset and antenna name (in single quotes).  Comments are not
supported in this section of the file.

Example:

! Reset antenna coordinates
ARRNAM = 'MYARRAY'
! earth centered coordinates
ARRAYX = 0.0
ARRAYY = 0.0
ARRAYZ = 0.0
GSTIAT = 1.23
FREQ = 1000.0D6
RDATE = '19990101'
 /
 1 1.0 2.0 3.0 'ANT1'
 2 4.0 5.0 6.0 'ANT2'
 3 7.0 8.0 9.0 'ANT3'
