; OBTAB
;---------------------------------------------------------------
;! Recalculate orbit parameters and other spacecraft info
;# TASK Coordinates Table
;-----------------------------------------------------------------------
;;  Copyright (C) 1998
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
OBTAB     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
OBTAB     Task to calculate various orbital information
INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK            0.0        9.0   Input UV file disk unit #
INVERS            0.0     9999.0   Input OB table version
                                   0 => last
SUBARRAY                           Subarray number; 0 => 1
ANTENNAS                           List of antenna to update
                                    All 0 => update all
                                    antennae with mount type
                                    set to orbiting
APARM                              Orbital parameters
                                    1: semi-major axis in meters
                                    2: eccentricity
                                    3: inclination (deg)
                                    4: RA of ascending node
                                       (deg)
                                    5: argument of perigee (deg)
                                    6: mean anomaly at 0h on
                                       the observing date (deg)
                                    APARM(1) < 6.37812E6 =>
                                    calculate elements from OB
                                    table.
----------------------------------------------------------------
OBTAB
Type:  Task
Use:   Use OBTAB to add the orbital elements for orbiting
       antennae to an AN table.  The elements may be supplied
       explicitly as APARMs or may be calculated automatically
       from an orbit (OB) table if one is present.  The
       recommended method is to calculate the orbit from the OB
       table.  If an OB table is used to calculate the orbital
       parameters then it will be assumed to correspond to a
       single orbiter and any blanked fields will be be filled
       with recalculated values.
Adverbs:
  INNAME.....Input UV file name (name).      Standard defaults.
  INCLASS....Input UV file name (class).     Standard defaults.
  INSEQ......Input UV file name (seq. #).    0 => highest.
  INDISK.....Disk drive # of input UV file.  0 => any.
  INVERS.....Input OB table version; 0 => last
  SUBARRAY...Subarray number; 0 => 1
             This denotes the AN table that will be updated.
  ANTENNAS...A list of antennas for which the orbital elements
             will be updated.  The mount types for these
             antennae will be forced to "orbiting".  If all of
             the entries are less than or equal to zero then the
             orbital elements will be updated for all antennae
             that already have a mount type of "orbiting".
  APARM......Orbital elements.
             1: The semimajor axis of the orbit in meters.  If
                this value is less than the equatorial radius of
                the earth then the elements will be calculated
                from the OB table.
             2: The orbital eccentricity
             3: The inclination of the orbit to the equator in
                degrees.
             4: The right ascension of the ascending node in
                degrees.
             5: The argument of perigee in degrees.
             6: Mean anomaly at 0h on the observing date.
----------------------------------------------------------------
OBTAB:  Task to calculate orbital parameters
DOCUMENTER: Chris Flatters, NRAO
RELATED PROGRAMS: UVPLT, VPLOT, SLIME

                            PURPOSE


    OBTAB inserts the orbital elements of orbiting antennae
into an AN table, allowing models to be plotted for baselines
including orbiting antennae at times where there is no data.

    The normal mode of operation is to calculate the orbital
elements using the Cartesian coordinates and velocity vector
of the satellite given as a function of time in an OB table.
If there is no OB table present then orbital elements may be
supplied manually.

    OBTAB will update several antennae in one pass but will
assume that all of the antennae being updated are aliases for
a single orbiter.  The user may supply a list of antenna
numbers to update.  If no list is supplied then all antennae
that have a mount type of orbiting (MNTSTA=2) will be updated;
this will not be what you want if there is more than one real
orbiter.

    OB tables from the VLBA correlator are incomplete.  Given
an incomplete OB table, OBTAB will fill out the missing
information.  If the subarray number in the OB table is set
to zero then it will be set to the SUBARRAY used by OBTAB.
If the antenna number is zero in the OBTAB then it will be
set to the first positive entry in ANTENNAS, if any, or the
lowest numbered antenna with MNTSTA=2 if there is no
positive element in ANTENNAS.  Other missing information
will be recalculated.

    Normally, entries from the OB table will only be used
to calculate the orbital elements if there subarray number
matches the subarray being processed and their antenna ID
number corresponds to one of the antennae being processed
but zero subarray and antenna entries are assumed to be
"wildcards" that match any subarray or antenna. This has the
consequence that orbital elements will be calculated incorrectly
if an OB table contains data for more than one orbiter and has
zero subarray or antenna entries.

                          CURRENT PROBLEMS

    OBTAB is currently uses a better-safe-than-sorry approach
to calculating eclipse parameters that results in it probably
performing far more computations than it needs to.  This makes
it very slow.

                            REFERENCES

"Orbital Motion, 3rd Edn", A.E. Roy, Institute of Physics
Press (1988).

AIPS Memo Number 93, L. Kogan.





