aboutsummaryrefslogtreecommitdiff
path: root/src/slalib/refco.f
blob: 3bc8816296cf9b385880733d71d5b8e2949e4583 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SUBROUTINE sla_REFCO (HM, TDK, PMB, RH, WL, PHI, TLR, EPS,
     :                      REFA, REFB)
*+
*     - - - - - -
*      R E F C O
*     - - - - - -
*
*  Determine the constants A and B in the atmospheric refraction
*  model dZ = A tan Z + B tan**3 Z.
*
*  Z is the "observed" zenith distance (i.e. affected by refraction)
*  and dZ is what to add to Z to give the "topocentric" (i.e. in vacuo)
*  zenith distance.
*
*  Given:
*    HM      d     height of the observer above sea level (metre)
*    TDK     d     ambient temperature at the observer (deg K)
*    PMB     d     pressure at the observer (millibar)
*    RH      d     relative humidity at the observer (range 0-1)
*    WL      d     effective wavelength of the source (micrometre)
*    PHI     d     latitude of the observer (radian, astronomical)
*    TLR     d     temperature lapse rate in the troposphere (degK/metre)
*    EPS     d     precision required to terminate iteration (radian)
*
*  Returned:
*    REFA    d     tan Z coefficient (radian)
*    REFB    d     tan**3 Z coefficient (radian)
*
*  Called:  sla_REFRO
*
*  Notes:
*
*  1  Typical values for the TLR and EPS arguments might be 0.0065D0 and
*     1D-10 respectively.
*
*  2  The radio refraction is chosen by specifying WL > 100 micrometres.
*
*  3  The routine is a slower but more accurate alternative to the
*     sla_REFCOQ routine.  The constants it produces give perfect
*     agreement with sla_REFRO at zenith distances arctan(1) (45 deg)
*     and arctan(4) (about 76 deg).  It achieves 0.5 arcsec accuracy
*     for ZD < 80 deg, 0.01 arcsec accuracy for ZD < 60 deg, and
*     0.001 arcsec accuracy for ZD < 45 deg.
*
*  P.T.Wallace   Starlink   3 June 1997
*
*  Copyright (C) 1997 Rutherford Appleton Laboratory
*-

      IMPLICIT NONE

      DOUBLE PRECISION HM,TDK,PMB,RH,WL,PHI,TLR,EPS,REFA,REFB

      DOUBLE PRECISION ATN1,ATN4,R1,R2

*  Sample zenith distances: arctan(1) and arctan(4)
      PARAMETER (ATN1=0.7853981633974483D0,
     :           ATN4=1.325817663668033D0)



*  Determine refraction for the two sample zenith distances
      CALL sla_REFRO(ATN1,HM,TDK,PMB,RH,WL,PHI,TLR,EPS,R1)
      CALL sla_REFRO(ATN4,HM,TDK,PMB,RH,WL,PHI,TLR,EPS,R2)

*  Solve for refraction constants
      REFA = (64D0*R1-R2)/60D0
      REFB = (R2-4D0*R1)/60D0

      END