| 1 | #include "slalib.h" | 
|---|
| 2 | #include "slamac.h" | 
|---|
| 3 | void slaRefco ( double hm, double tdk, double pmb, double rh, | 
|---|
| 4 | double wl, double phi, double tlr, double eps, | 
|---|
| 5 | double *refa, double *refb ) | 
|---|
| 6 | /* | 
|---|
| 7 | **  - - - - - - - - - | 
|---|
| 8 | **   s l a R e f c o | 
|---|
| 9 | **  - - - - - - - - - | 
|---|
| 10 | ** | 
|---|
| 11 | **  Determine constants A and B in atmospheric refraction model | 
|---|
| 12 | **  dz = A tan z + B tan^3 z. | 
|---|
| 13 | ** | 
|---|
| 14 | **  z is the "observed" zenith distance (i.e. affected by | 
|---|
| 15 | **  refraction) and dz is what to add to z to give the "topocentric" | 
|---|
| 16 | **  (i.e. in vacuo) zenith distance. | 
|---|
| 17 | ** | 
|---|
| 18 | **  Given: | 
|---|
| 19 | **    hm    double    height of the observer above sea level (metre) | 
|---|
| 20 | **    tdk   double    ambient temperature at the observer (deg k) | 
|---|
| 21 | **    pmb   double    pressure at the observer (millibar) | 
|---|
| 22 | **    rh    double    relative humidity at the observer (range 0-1) | 
|---|
| 23 | **    wl    double    effective wavelength of the source (micrometre) | 
|---|
| 24 | **    phi   double    latitude of the observer (radian, astronomical) | 
|---|
| 25 | **    tlr   double    temperature lapse rate in the troposphere (degk/metre) | 
|---|
| 26 | **    eps   double    precision required to terminate iteration (radian) | 
|---|
| 27 | ** | 
|---|
| 28 | **  Returned: | 
|---|
| 29 | **    *refa double    tan z coefficient (radian) | 
|---|
| 30 | **    *refb double    tan^3 z coefficient (radian) | 
|---|
| 31 | ** | 
|---|
| 32 | **  Called:  slaRefro | 
|---|
| 33 | ** | 
|---|
| 34 | **  Notes: | 
|---|
| 35 | ** | 
|---|
| 36 | **  1  Typical values for the tlr and eps arguments might be 0.0065 and | 
|---|
| 37 | **     1e-10 respectively. | 
|---|
| 38 | ** | 
|---|
| 39 | **  2  The radio refraction is chosen by specifying wl > 100 micrometres. | 
|---|
| 40 | ** | 
|---|
| 41 | **  3  The routine is a slower but more accurate alternative to the | 
|---|
| 42 | **     slaRefcoq routine.  The constants it produces give perfect | 
|---|
| 43 | **     agreement with slaRefro at zenith distances arctan(1) (45 deg) | 
|---|
| 44 | **     and arctan(4) (about 76 deg).  It achieves 0.5 arcsec accuracy | 
|---|
| 45 | **     for ZD < 80 deg, 0.01 arcsec accuracy for ZD < 60 deg, and | 
|---|
| 46 | **     0.001 arcsec accuracy for ZD < 45 deg. | 
|---|
| 47 | ** | 
|---|
| 48 | **  Last revision:   4 June 1997 | 
|---|
| 49 | ** | 
|---|
| 50 | **  Copyright P.T.Wallace.  All rights reserved. | 
|---|
| 51 | */ | 
|---|
| 52 | { | 
|---|
| 53 | double r1,r2; | 
|---|
| 54 |  | 
|---|
| 55 | /* Sample zenith distances: arctan(1) and arctan(4) */ | 
|---|
| 56 | static double atn1 = 0.7853981633974483; | 
|---|
| 57 | static double atn4 = 1.325817663668033; | 
|---|
| 58 |  | 
|---|
| 59 | /* Determine refraction for the two sample zenith distances. */ | 
|---|
| 60 | slaRefro ( atn1, hm, tdk, pmb, rh, wl, phi, tlr, eps, &r1 ); | 
|---|
| 61 | slaRefro ( atn4, hm, tdk, pmb, rh, wl, phi, tlr, eps, &r2 ); | 
|---|
| 62 |  | 
|---|
| 63 | /* Solve for refraction constants. */ | 
|---|
| 64 | *refa = ( 64.0 * r1 - r2 ) / 60.0; | 
|---|
| 65 | *refb = ( r2 - 4.0 * r1 ) / 60.0; | 
|---|
| 66 | } | 
|---|