;  SHADO
;---------------------------------------------------------------
;! Calculate the shadowing of antennas at the array
;# TASK ANALYSIS UV
;-----------------------------------------------------------------------
;;  Copyright (C) 2003
;;  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
;-----------------------------------------------------------------------
SHADO     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
SHADO   creates print out of the sensitivity affected by  shadowing
INFILE                             Antenna location file name
                                   in the UVCON format
OUTFILE                            Output file name. The file is
                                   at the LATEX or TEXT format
                                   under control of APARM(9)
                                   If number of hour angles
                                   (APARM(5)) > 11 then the
                                   OUTFILE is not created.
APARM                              Control information:
                                   1: Min source declin., deg
                                      0 => -30
                                   2: Number of declinations
                                      0 => 12
                                   3: Step at declination, deg
                                      0 => 10
                                   4: Min hour angle, hours
                                      The hour angles are for
                                      the given array center
                                      0 => -4
                                   5: Number of hour angles
                                      0 => 9
                                      see help/explain
                                   6: Step at hour angle, hours
                                      0 => 1
                                   7: Min antenna elevation, deg
                                   8: Max blockage allowed
                                      in fraction of the area
                                   9: Format of the OUTFILE
                                      0 => LATEX
                                      1 => TEXT
----------------------------------------------------------------
SHADO
Task:  Estimate the sensitivity loosing of an array because of
       shadowing of the array antennas by each other.
       The array geometry is given by INFILE. The sensitivity
       with taking into account the shadowing is determined as
       the ratio of the number of unshadowed antenna to the total
       number of antennas. Only antennas with elevation exceeded
       the given elevation limit are taking into account.
       The antenna is called shadowed if the blockage exceeds
       the given limit of blockage.

Adverbs:
INFILE.......Antenna location file name. See format in EXPLAIN

OUTFILE......Output file name. The file is at the LATEX or TEXT
             format under control of APARM(9).
             The OUTFILE is not created if number of hour angles
             is .GT. 11.
             If LATEX then the OUTFILE is ready to create the
             output as a table in .ps format using LATEX commands
             (latex, dvips). You may want to edit the table
             capture before command 'latex'

APARM........Control information:
                1: Min source declination, degrees 0 => -30
                2: Number of declinations, 0 => 12
                3: Step at declination, degrees 0 => 10
                   Each table rows corresponds to new declination
                4: Min hour angle, hours 0 => -4
                5: Number of hour angles, 0 => 9
                   The output file is not created if number of
                   hour angles .GT. 11. The outprint is still
                   appears on display at this case.
                6: Step at hour angle, hours. 0 => 1
                   The hour angles are given for the given array
                   center.
                7: Min antenna elevation, deg
                   Only antennas with elevation exceeded
                   APARM(7) are taking into account.
                8: Max blockage allowed in fraction of the area.
                   The antenna is called shadowed if the blockage
                   exceeds APARM(8).
                9: Format of the OUTFILE
                      0 => LATEX
                      1 => TEXT
----------------------------------------------------------------
SHADO: Task to estimate the sensitivity loosing of an array
       because of shadowing of the array antennas by each other.
PROGRAMMER: L. Kogan, NRAO, Socorro.
RELATED PROGRAMS: UVCON


               SPECIFYING THE ARRAY CONFIGURATION

     The information defining the array configuration is read by
SHADO from an auxiliary input file, supplied by the user.  This
is a free-format text file.  One must list, in the following
order:

Line 1: The number of antennas.
Line 2: The site latitude(geodetic), the site longitude, in degrees,
        The site height relatively the geoid, in meters.
Line 3: A multiplicative conversion factor specifying how the
        antenna coordinates, listed next by the user, can be
        converted into units of meters; and a second
        multiplicative conversion factor specifying how the listed
        antenna diameters can be converted into units of meters.
	If the antenna location coordinates are given in nanoseconds,
	the conversion factor is 0.299.

	The remaining lines specify the antenna location and parameters,
	with one line for each antenna.  Each line is formatted thus:

Col. 1:	The coordinate system:  All are right-handed.  Units are in
	meters, (but see note for Line 3, above).
	   0 => Equatorial, with X positive towards
		Greenwich longitude (and latitude = 0), Y to the
		'east', and Z to the North Pole.
		Units in meters, but see Line 3 description above.
                Warning: VLBA uses opposite direction for Y axis,
                so you need to change it if you use it.
	   1 => Local Horizon, with X positive towards east,
		Y positive towards north, Z positive to local zenith.
		Units in meters, but see Line 3 description above.
		Coordinate origin is at the array center.
	   2 => Geodetic, with coordinates given by geodetic latitude,
		longitude (positive towards west), (both in degrees)
		and elevation above the geoid (in meters).
	   3 => Array Centered Equatorial.  The same as '0' but
		with X positive to Dec = 0 on local meridian,
		Y positive to east, and Z positive towards NCP.
                This option is good for VLA
		Units in meters, but see Line 3 description above.

Col. 2:	Antenna Coordinate X, as defined above.
Col. 3: Antenna Coordinate Y, as defined above.
Col. 4: Antenna Coordinate Z, as defined above.
Col. 5: Antenna diameter (meters, but see note for Line 3, above).

The coordinate system can be mixed up inside of the INFILE

Here is a sample file for a six-element array:

6
30 20
1 1
3 499.8614     -1317.9860    -735.2027    10
1 -801.3750     -124.9699    1182.1318    20
3 -5271.2720    -823.5634    7791.9982    30
3  152.7899     -401.2680    -223.3888    40
3 -6870.8985   -1072.9210   10148.7829    50
3 765.2380      2889.4558   -1108.8724    60

The array center is at latitude 30 degrees and longitude 20 degrees to
west.  Conversion factors for both antennas positions and diameters
equal 1, so the relevant values are given in meters.  Position of the
second antenna is given in the local RH system with Z as local zenith.
All other antennas' positions are given in a local equatorial
coordinate system.  Diameters of the antennas are 10, 20, 30, 40, 50,
and 60 meters.

One must supply the name of the input file via the AIPS
adverb INFILE.  Examples:
         INFILE='myarea:test.ant'                 (Unix)
            where MYAREA is an environment variable set before
            starting AIPS.  For example:
            %setenv MYAREA /mnt/myarea/sim (in csh)
            $export MYAREA=/mnt/myarea/sim (in ksh)












