; OBEDT
;---------------------------------------------------------------------
;! Task to flag data of orbiting antennas
;# TASK Coordinates Table
;---------------------------------------------------------------------
;;  Copyright (C) 1995, 1997, 2009, 2018
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
OBEDT     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
OBEDT     Task to flag data of orbiting antennas
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
TIMERANG                           Time range to use. 0=>all
SUBARRAY                           Subarray number; 0 => 1
OPCODE                             Parameter used to control
                                   the flagging
                                   '    ' => 'DIST'
APARM                              Control information:
                                   1 : lower limit of the param.
                                   2 : upper limit of the param.
                                   The data are flagged if the
                                   selected parameter is between
                                   these two.
                                   If AN table is not filled by
                                   the parameters for the orbit.
                                   antennas and there is no OB
                                   tab., the orbit is determined
                                   by the six parameters:

                                   3 :  Semi-major axis (m)
                                   4 :  Eccentricity
                                   5 :  Inclination of the orbit
                                        plane to equator, deg.
                                   6 :  RA of the ascending node,
                                        deg.
                                   7 :  Angle of perigee to the
                                        ascending node, deg.
                                   8 :  Mean anomaly at the
                                        reference time, deg.
                                   9 :  step in time, seconds
                                        0 => 10sec
FLAGVER                            Version of the FG table.
                                   0 => the new one
BADDISK                            Disks to avoid for scratch
----------------------------------------------------------------
OBEDT
Task:  The task reads antenna table (AN) or an orbiting table (OB),
       checks the value of the selected parameter, compares it with the
       selected lower and upper limits and flags the data of the
       orbiting antennas if the parameter is between the limits.
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
  TIMERANG...Time range to use; 0=>all
  SUBARRAY...Subarray number; 0 => 1
  OPCODE.....'DIST' - the distance of the satellite from the Earth
                      center, km
             'VEL ' - speed of the satellite, km/s
             'SUNS' - Angle of the Sun from the source, degrees
             'ECLB' - Time from the beginning of the previous eclipse
                      of the Sun, hours
             'ECLE' - Time from the end of the previous eclipse
                      of the Sun, hours
             '    ' => 'DIST'
  APARM.....Control information:
         1 : Lower limit of the parameter in units corresponding to
             OPCODE
         2 : Upper limit of the parameter in units corresponding to
             OPCODE
             The data are flagged if the selected parameter is between
             these lower and upper limits.
         If AN table is not filled by the parameters for the orbiting
         antennas and there is no OB table, the only orbit
         is determined by the following six parameters:
         3 :  Semi-major axis (m)
         4 :  Eccentricity
         5 :  Inclination of orbit plane to equator, deg.
         6 :  RA of the ascending node, deg.
         7 :  Angle of perigee to the ascending node, deg.
         8 :  Mean anomaly at the reference time, deg.
         9 :  Step in time, seconds. Condition of flagging is checked
              under control APARM(1), APARM(2) at the time with
              the time step APARM(9)
              0 => 10 sec
  FLAGVER...Version of the FG table. 0 => the new one
  BADDISK....The disk numbers to avoid for scratch files (sorting
             tables mostly).


Documenters: L.R. Kogan

                            PURPOSE

The orbiting VLBI provides some additional requirements which do not
have a place at the case of the classic ground based VLBI network.
For example the Sun can be eclipsed for the orbiting antenna and as a
result the battery will not be charged properly and the whole orbiting
hardware will not work properly. So the user can want to flag such data
in advance. He can want to flag data using another parameter (distance,
speed ..) as a criterium.
The OB table is the table including the relevant information about the
orbiting antenna. Using the OB table as a source of the information can
provide problem at the case of big gaps in time at the OB table.
To exclude the problem the task uses the AN table to read the six
parameters of the orbits. If the AN table is not filled out by the
orbits parameters, the task reconstructs the orbits using OB table data.
If OB table does not exist, an user can use the orbit determined by
APARM(3)-APARM(8). Having obtained the parameters of the orbits, the
task calculates the required value (OPCODE) for a time at the range of
the UV data with the step - APARM(9).
The thresholds are selected by APARM(1) and APARM(2).




