47    use sufr_kinds, 
only: double
 
   50    real(double), 
intent(in) :: l,b,r, l0,b0,r0
 
   51    real(double), 
intent(out) :: x,y,z
 
   53    x = r * cos(b) * cos(l)  -  r0 * cos(b0) * cos(l0)
 
   54    y = r * cos(b) * sin(l)  -  r0 * cos(b0) * sin(l0)
 
   55    z = r * sin(b)           -  r0 * sin(b0)
 
 
   74    use sufr_kinds, 
only: double
 
   77    real(double), 
intent(in) :: l,b,r,eps
 
   78    real(double), 
intent(out) :: x,y,z
 
   80    x = r *  cos(b) * cos(l)
 
   81    y = r * (cos(b) * sin(l) * cos(eps)  -  sin(b) * sin(eps))
 
   82    z = r * (cos(b) * sin(l) * sin(eps)  +  sin(b) * cos(eps))
 
 
  104    use sufr_kinds, 
only: double
 
  105    use sufr_constants, 
only: pi
 
  106    use sufr_angles, 
only: rev
 
  111    real(double), 
intent(in) :: t1, l0,b0,r0
 
  112    real(double), 
intent(out) :: x,y,z
 
  113    real(double) :: t, l,b,r, dpsi,eps,eps0,deps
 
  124    x = r *  cos(b) * cos(l)
 
  125    y = r * (cos(b) * sin(l) * cos(eps)  -  sin(b) * sin(eps))
 
  126    z = r * (cos(b) * sin(l) * sin(eps)  +  sin(b) * cos(eps))
 
 
  149    use sufr_kinds, 
only: double
 
  150    use sufr_constants, 
only: jd2000
 
  153    real(double), 
intent(in) :: jd1,jd2
 
  154    real(double), 
intent(inout) :: x,y,z
 
  155    real(double) :: t1,t2,t22,t23, x1,y1,z1
 
  156    real(double) :: dz,ze,th,sd,cd,sz,cz,st,ct
 
  157    real(double) :: xx,xy,xz,yx,yy,yz,zx,zy,zz
 
  159    t1 = (jd1 - jd2000)/36525.d0  
 
  160    t2 = (jd2 - jd1)/36525.d0     
 
  165    dz = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t1*t1)*t2 + (1.463556d-6 - 1.668d-9*t1)*t22 + 8.725677d-8*t23
 
  166    ze = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t1*t1)*t2 + (5.307158d-6 + 3.20d-10*t1)*t22 + 8.825063d-8*t23
 
  167    th = (9.71717346d-3 - 4.136915d-6*t1 - 1.0520d-9*t1*t1)*t2 - (2.068458d-6 + 1.052d-9*t1)*t22 - 2.028121d-7*t23
 
  177    xx =  cd*cz*ct - sd*sz
 
  178    xy =  sd*cz    + cd*sz*ct
 
  180    yx = -cd*sz    - sd*cz*ct
 
  181    yy =  cd*cz    - sd*sz*ct
 
  187    x1 = xx*x + yx*y + zx*z
 
  188    y1 = xy*x + yy*y + zy*z
 
  189    z1 = xz*x + yz*y + zz*z
 
 
  211    use sufr_kinds, 
only: double
 
  212    use sufr_constants, 
only: jd2000
 
  215    real(double), 
intent(in) :: jd1,jd2
 
  216    real(double), 
intent(inout) :: a1,d1
 
  217    real(double) :: t1,t12, t2,t22,t23, dz,ze,th,a,b,c
 
  219    t1 = (jd1 - jd2000)/36525.d0      
 
  221    t2 = (jd2 - jd1)/36525.d0         
 
  226    dz = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t12)*t2 + (1.463556d-6 - 1.668d-9*t1)*t22 + 8.725677d-8*t23
 
  227    ze = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t12)*t2 + (5.307158d-6 + 3.20d-10*t1)*t22 + 8.825063d-8*t23
 
  228    th = (9.71717346d-3 - 4.136915d-6*t1 - 1.0520d-9*t12)*t2 - (2.068458d-6 + 1.052d-9*t1)*t22 - 2.028121d-7*t23
 
  231    a = cos(d1)           * sin(a1+dz)
 
  232    b = cos(th) * cos(d1) * cos(a1+dz)  -  sin(th) * sin(d1)
 
  233    c = sin(th) * cos(d1) * cos(a1+dz)  +  cos(th) * sin(d1)
 
 
  254    use sufr_kinds, 
only: double
 
  257    real(double), 
intent(in) :: yr1,yr2
 
  258    real(double), 
intent(inout) :: a1,d1
 
  259    real(double) :: t1,t12, t2,t22,t23, dz,ze,th,a,b,c
 
  261    t1 = (yr1 - 2000.d0)/100.d0  
 
  263    t2 = (yr2 - yr1)/100.d0      
 
  268    dz = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t12)*t2 + (1.463556d-6 - 1.668d-9*t1)*t22 + 8.725677d-8*t23
 
  269    ze = (1.11808609d-2 + 6.770714d-6*t1 - 6.739d-10*t12)*t2 + (5.307158d-6 + 3.20d-10*t1)*t22 + 8.825063d-8*t23
 
  270    th = (9.71717346d-3 - 4.136915d-6*t1 - 1.0520d-9*t12)*t2 - (2.068458d-6 + 1.052d-9*t1)*t22 - 2.028121d-7*t23
 
  273    a = cos(d1)           * sin(a1+dz)
 
  274    b = cos(th) * cos(d1) * cos(a1+dz)  -  sin(th) * sin(d1)
 
  275    c = sin(th) * cos(d1) * cos(a1+dz)  +  cos(th) * sin(d1)
 
 
  296    use sufr_kinds, 
only: double
 
  297    use sufr_constants, 
only: jd2000
 
  300    real(double), 
intent(in) :: jd1,jd2
 
  301    real(double), 
intent(inout) :: l,b
 
  302    real(double) :: t1,t12, t2,t22,t23, eta,pii,p,aa,bb,cc
 
  304    t1  = (jd1 - jd2000)/36525.d0      
 
  306    t2  = (jd2 - jd1)/36525.d0         
 
  311    eta = (2.278765d-4    - 3.2012d-7     *t1  + 2.899d-9*t12)   *t2  + (-1.60085d-7  + 2.899d-9*t1)   *t22  + 2.909d-10*t23
 
  312    pii = 3.0521686858d0  + 1.59478437d-2 *t1  + 2.939037d-6*t12      - (4.2169525d-3 + 2.44787d-6*t1) *t2   + 1.7143d-7*t22
 
  313    p   = (2.438174835d-2 + 1.077382d-5   *t1  - 2.036d-10*t12)  *t2  + (5.38691d-6   - 2.036d-10*t1)  *t22  - 2.91d-11*t23
 
  316    aa = cos(eta) * cos(b) * sin(pii-l)  -  sin(eta) * sin(b)
 
  317    bb = cos(b)            * cos(pii-l)
 
  318    cc = cos(eta) * sin(b)               +  sin(eta) * cos(b) * sin(pii-l)
 
  320    l = p + pii - atan2(aa,bb)
 
 
  342    use sufr_kinds, 
only: double
 
  343    use sufr_constants, 
only: jd2000
 
  346    real(double), 
intent(in) :: jd1,jd2
 
  347    real(double), 
intent(inout) :: i,o1,o2
 
  348    real(double) :: t1,t12,t2,t22,t23,  eta,pii,p,psi,aa,bb,cc,dd
 
  350    t1  = (jd1 - jd2000)/36525.d0      
 
  352    t2  = (jd2 - jd1)/36525.d0         
 
  357    eta = (2.278765d-4    - 3.2012d-7 * t1     + 2.899d-9*t12) *t2  + (-1.60085d-7  + 2.899d-9*t1) * t22  + 2.909d-10 * t23
 
  358    pii =  3.0521686858d0 + 1.59478437d-2 * t1 + 2.939037d-6*t12    - (4.2169525d-3 + 2.44787d-6*t1) * t2 + 1.7143d-7 * t22
 
  359    p   = (2.438174835d-2 + 1.077382d-5 * t1   - 2.036d-10*t12) *t2 + (5.38691d-6   - 2.036d-10*t1) * t22 - 2.91d-11 * t23
 
  363    aa =  sin(i)   * sin(o2-pii)
 
  364    bb = -sin(eta) * cos(i)      + cos(eta) * sin(i)   * cos(o2-pii)
 
  365    cc = -sin(eta) * sin(o2-pii)
 
  366    dd =  sin(i)   * cos(eta)    - cos(i)   * sin(eta) * cos(o2-pii)
 
  368    i  = asin(sqrt(aa*aa+bb*bb))  
 
  369    o2 = atan2(aa,bb) + psi       
 
  370    o1 = o1 + atan2(cc,dd)        
 
 
  389    use sufr_kinds, 
only: double
 
  390    use sufr_angles, 
only: rev
 
  391    use sufr_numerics, 
only: deq0
 
  394    real(double), 
intent(in) :: x,y,z
 
  395    real(double), 
intent(out) :: l,b,r
 
  396    real(double) :: x2,y2
 
  398    if(deq0(x) .and. deq0(y) .and. deq0(z)) 
then 
  406       l = rev( atan2(y,x) )        
 
  407       b = atan2(z, sqrt(x2 + y2))  
 
  408       r = sqrt(x2 + y2 + z**2)     
 
 
  427    use sufr_kinds, 
only: double
 
  428    use sufr_constants, 
only: pi
 
  429    use sufr_angles, 
only: rev
 
  432    real(double), 
intent(in) :: t,l0
 
  433    real(double), 
intent(inout) :: l,b
 
  434    real(double) :: tt,tt2, k,odot,e,pii,dl,db
 
  442    e    = 0.016708634d0 - 4.2037d-5   * tt - 1.267d-7  * tt2  
 
  443    pii  = 1.79659568d0  + 3.001024d-2 * tt + 8.0285d-6 * tt2  
 
  445    dl   =  k * ( -cos(odot-l)  +  e * cos(pii-l)) / cos(b)  
 
  446    db   = -k * sin(b) * (sin(odot-l)  -  e * sin(pii-l))
 
 
  471    use sufr_kinds, 
only: double
 
  472    use sufr_constants, 
only: jd2000
 
  473    use sufr_angles, 
only: rev
 
  474    use sufr_dummy, 
only: dumdbl1,dumdbl2
 
  475    use sufr_numerics, 
only: dne
 
  479    real(double), 
intent(in) :: jd, ra,dec
 
  480    real(double), 
intent(out) :: dra,ddec
 
  481    real(double), 
intent(in), 
optional :: eps0
 
  482    real(double) :: jdold, tjc,tjc2, l0,mas,sec,odot, k,ee,pii, eps
 
  483    save jdold, tjc,odot,k,ee,pii, eps
 
  487    if(dne(jd,jdold)) 
then 
  490       tjc   =  (jd-jd2000)/36525.0d0  
 
  492       l0    =  4.8950631684d0 + 628.331966786d0 * tjc + 5.291838d-6 *tjc2  
 
  495       mas   =  6.240035881d0 + 628.301956024d0 * tjc - 2.79776d-6 * tjc2 - 5.817764d-8 * tjc**3
 
  498       sec   =  (3.3416109d-2 - 8.40725d-5*tjc - 2.443d-7*tjc2)*sin(mas) + (3.489437d-4-1.763d-6*tjc)*sin(2*mas) + 5.044d-6*sin(3*mas)
 
  503       ee    =  0.016708634d0 - 4.2037d-5   * tjc - 1.267d-7  * tjc2   
 
  504       pii   =  1.79659568d0  + 3.001024d-2 * tjc + 8.0285d-6 * tjc2   
 
  508       if(
present(eps0)) 
then 
  511          call nutation(tjc/10.d0, dumdbl1, eps, dumdbl2)  
 
  520    dra  =   k * ( -(cos(ra) * cos(odot) * cos(eps)  +  sin(ra) * sin(odot))  / cos(dec)  &
 
  521         +  ee *    (cos(ra) * cos(pii)  * cos(eps)  +  sin(ra) * sin(pii))   / cos(dec) )
 
  523    ddec =   k * ( -(cos(odot) * cos(eps) * (tan(eps) * cos(dec)  -  sin(ra) * sin(dec))  +  cos(ra) * sin(dec) * sin(odot))  &
 
  524         +  ee *    (cos(pii)  * cos(eps) * (tan(eps) * cos(dec)  -  sin(ra) * sin(dec))  +  cos(ra) * sin(dec) * sin(pii)) )
 
 
  539    use sufr_kinds, 
only: double
 
  542    real(double), 
intent(in) :: t
 
  543    real(double), 
intent(inout) :: l,b
 
  544    real(double) :: tt,l2,dl,db
 
  548    l2 = l - 0.02438225d0*tt - 5.41052d-6*tt*tt
 
  549    dl = -4.379322d-7 + 1.89853d-7*(cos(l2) + sin(l2))*tan(b)
 
  550    db = 1.89853d-7*(cos(l2) - sin(l2))
 
 
  572    use sufr_kinds, 
only: double
 
  573    use sufr_angles, 
only: rev
 
  576    real(double), 
intent(in) :: l,b,eps
 
  577    real(double), 
intent(out) :: ra,dec
 
  579    ra  = rev(atan2( sin(l) * cos(eps)  -  tan(b) * sin(eps),  cos(l) ))
 
  580    dec =      asin( sin(b) * cos(eps)  +  cos(b) * sin(eps) * sin(l) )
 
 
  599    use sufr_kinds, 
only: double
 
  600    use sufr_angles, 
only: rev
 
  603    real(double), 
intent(in) :: ra,dec,eps
 
  604    real(double), 
intent(out) :: l,b
 
  606    l = rev(atan2( sin(ra)  * cos(eps) + tan(dec) * sin(eps),  cos(ra) ))
 
  607    b =      asin( sin(dec) * cos(eps) - cos(dec) * sin(eps) * sin(ra) )
 
 
  629  subroutine eq2horiz(ra,dec,agst, hh,az,alt, lat,lon)
 
  630    use sufr_kinds, 
only: double
 
  631    use sufr_angles, 
only: rev,rev2
 
  635    real(double), 
intent(in) :: ra,dec,agst
 
  636    real(double), 
intent(in), 
optional :: lat,lon
 
  637    real(double), 
intent(out) :: hh,az,alt
 
  638    real(double) :: llat,llon, sinhh,coshh, sinlat,coslat, sindec,cosdec,tandec
 
  643    if(
present(lat)) llat = lat
 
  644    if(
present(lon)) llon = lon
 
  646    hh  = rev( agst + llon - ra )  
 
  652    coslat = sqrt(1.d0-sinlat**2)    
 
  654    cosdec = sqrt(1.d0-sindec**2)    
 
  655    tandec = sindec/cosdec
 
  657    az  = rev( atan2( sinhh,   coshh  * sinlat - tandec * coslat ))  
 
  658    alt = rev2( asin( sinlat * sindec + coslat * cosdec * coshh ))   
 
 
  680  subroutine horiz2eq(az,alt, agst,  hh,ra,dec,  lat,lon)
 
  681    use sufr_kinds, 
only: double
 
  682    use sufr_angles, 
only: rev,rev2
 
  686    real(double), 
intent(in) :: az,alt,agst
 
  687    real(double), 
intent(out) :: ra,dec,hh
 
  688    real(double), 
intent(in), 
optional :: lat,lon
 
  689    real(double) :: sinlat,coslat, cosaz,sinalt,cosalt,tanalt, llat,llon
 
  694    if(
present(lat)) llat = lat
 
  695    if(
present(lon)) llon = lon
 
  699    coslat = sqrt(1.d0-sinlat**2)  
 
  702    cosalt = sqrt(1.d0-sinalt**2)  
 
  703    tanalt = sinalt/cosalt
 
  705    hh  = rev(  atan2( sin(az),  cosaz  * sinlat + tanalt * coslat ))  
 
  706    dec = rev2( asin(  sinlat * sinalt - coslat * cosalt * cosaz   ))  
 
  707    ra  = rev( agst + llon - hh )                                      
 
 
  725    use sufr_kinds, 
only: double
 
  726    use sufr_angles, 
only: rev
 
  729    real(double), 
intent(in) :: ra,dec
 
  730    real(double), 
intent(out) :: l,b
 
  731    real(double) :: ra0,dec0,l0
 
  737    l = rev( l0 - atan2( sin(ra0-ra), cos(ra0-ra) * sin(dec0)  -  tan(dec) * cos(dec0) ))
 
  738    b =            asin( sin(dec)                 * sin(dec0)  +  cos(dec) * cos(dec0) * cos(ra0-ra) )
 
 
  754    use sufr_kinds, 
only: double
 
  755    use sufr_angles, 
only: rev
 
  757    real(double), 
intent(in) :: l,b
 
  758    real(double), 
intent(out) :: ra,dec
 
  759    real(double) :: ra0,dec0,l0
 
  765    ra  = rev(atan2( sin(l-l0), cos(l-l0) * sin(dec0)  -  tan(b) * cos(dec0)) + ra0)
 
  766    dec =      asin( sin(b)   * sin(dec0)              +  cos(b) * cos(dec0) * cos(l-l0))
 
 
  797  subroutine geoc2topoc_ecl(gcl,gcb, gcr,gcs, eps,lst,  tcl,tcb, tcs, lat,hgt)
 
  798    use sufr_kinds, 
only: double
 
  799    use sufr_constants, 
only: earthr,au
 
  800    use sufr_angles, 
only: rev
 
  804    real(double), 
intent(in) :: gcl,gcb,gcr,gcs,eps,lst
 
  805    real(double), 
intent(in), 
optional :: lat,hgt
 
  806    real(double), 
intent(out) :: tcl,tcb,tcs
 
  807    real(double) :: llat,lhgt, ba,re,u,rs,rc,sinHp,n
 
  812    if(
present(lat)) llat = lat
 
  813    if(
present(hgt)) lhgt = hgt
 
  816    ba = 0.996647189335d0  
 
  820    u  = atan(ba*tan(llat))
 
  821    rs = ba*sin(u) + lhgt/re*sin(llat)
 
  822    rc = cos(u)    + lhgt/re*cos(llat)
 
  825    sinhp = sin(earthr/au)/gcr  
 
  828    n  = cos(gcl)*cos(gcb) - rc*sinhp*cos(lst)
 
  830    tcl = rev( atan2( sin(gcl)*cos(gcb) - sinhp*(rs*sin(eps) + rc*cos(eps)*sin(lst)) , n ) )  
 
  831    tcb = atan((cos(tcl)*(sin(gcb) - sinhp*(rs*cos(eps) - rc*sin(eps)*sin(lst))))/n)          
 
  832    tcs = asin(cos(tcl)*cos(tcb)*sin(gcs)/n)                                                  
 
 
  859    use sufr_kinds, 
only: double
 
  860    use sufr_constants, 
only: earthr,au
 
  864    real(double), 
intent(in) :: gcra,gcd,gcr,gch
 
  865    real(double), 
intent(in), 
optional :: lat,hgt
 
  866    real(double), 
intent(out) :: tcra,tcd
 
  867    real(double) :: llat,lhgt, ba,re,u,rs,rc,sinHp,dra
 
  872    if(
present(lat)) llat = lat
 
  873    if(
present(hgt)) lhgt = hgt
 
  876    ba = 0.996647189335d0  
 
  880    u  = atan(ba*tan(llat))
 
  881    rs = ba*sin(u) + lhgt/re*sin(llat)
 
  882    rc = cos(u) + lhgt/re*cos(llat)
 
  885    sinhp = sin(earthr/au)/gcr  
 
  887    dra  = atan2( -rc*sinhp*sin(gch) , cos(gcd)-rc*sinhp*cos(gch) )            
 
  889    tcd  = atan2( (sin(gcd)-rs*sinhp)*cos(dra) , cos(gcd)-rc*sinhp*cos(gch) )  
 
 
  911    use sufr_kinds, 
only: double
 
  912    use sufr_constants, 
only: pio2, d2r
 
  915    real(double), 
intent(in) :: alt
 
  916    real(double), 
intent(in), 
optional :: press,temp
 
  919    if(abs(alt).gt.pio2) 
then   
  922       if(alt.lt.-1.102d0*d2r) 
then   
  927          refract = 2.9670597d-4/tan(alt + 3.137559d-3/(alt + 8.91863d-2))  
 
 
  952    use sufr_kinds, 
only: double
 
  953    use sufr_constants, 
only: rpio2
 
  956    real, 
intent(in) :: alt
 
  957    real, 
intent(in), 
optional :: press,temp
 
  959    real(double) :: lalt, lpress,ltemp
 
  961    if(abs(alt).ge.rpio2) 
then   
  966       if(
present(press)) lpress = dble(press)
 
  968       if(
present(temp)) ltemp = dble(temp)
 
 
 1004    use sufr_kinds, 
only: double
 
 1005    use sufr_constants, 
only: d2r,r2d, pio2
 
 1008    real(double), 
intent(in) :: alt0, h0,lat0, t0,p0, rh,lam, dtdh, eps
 
 1012    if(abs(alt0).ge.pio2) 
return    
 1013    if(alt0.lt.-0.9d0*d2r) 
return   
 1016    z0   = 90.d0 - alt0*r2d  
 
 1018    lamm = lam / 1000.d0     
 
 1027    do while(dz.gt.eps/3600.d0)  
 
 
 1065    use sufr_kinds, 
only: double
 
 1066    use sufr_constants, 
only: pio2, d2r,r2d, earthr
 
 1069    real(double), 
intent(in) :: alt0, h0,ph
 
 1070    real(double), 
intent(in), 
optional :: t0,p0, rh,lam, dtdh, eps
 
 1072    real(double), 
parameter :: gcr=8314.36d0, md=28.966d0, mw=18.016d0, gamma=18.36d0
 
 1073    real(double), 
parameter :: ht=11.d3, hs=80.d3, z2=11.2684d-06
 
 1075    integer :: i,in,is,istart, j,k
 
 1077    real(double) :: n,n0,nt,nts,ns,a(10), dndr,dndr0,dndrs,dndrt,dndrts, f,f0, fb,fe,ff,fo,fs,ft,fts,gb, h
 
 1078    real(double) :: pw0,r,r0,refo,refp,reft,rg,rs,rt,  sk0,step,t,t0o,tg,tt,z,z1,zs,zt,zts, earthrm
 
 1081    if(alt0.lt.-1.102d0*d2r) 
return   
 1085    z0 = (pio2 - alt0)*r2d  
 
 1088    if(
present(t0)) 
then   
 1093    if(
present(p0)) 
then   
 1098    if(
present(rh)) 
then   
 1103    if(
present(lam)) 
then   
 1108    if(
present(dtdh)) 
then   
 1113    if(
present(eps)) 
then   
 1124    gb = 9.784d0*(1.d0 - 0.0026d0*cos(2.d0*ph) - 0.00000028d0*h0)
 
 1125    z1 = (287.604d0 + 1.6288d0/(laml**2) + 0.0136d0/(laml**4)) * (273.15d0/1013.25d0)*1.d-6
 
 1131    pw0   = rhl*(t0l/247.1d0)**a(4)
 
 1132    a(5)  = pw0*(1.d0 - mw/md)*a(3)/(a(4)-a(3))
 
 1135    a(8)  = ( z1*a(5) + z2*pw0)/t0l
 
 1136    a(9)  = (a(3) - 1.d0)*a(1)*a(7)/t0l
 
 1137    a(10) = (a(4) - 1.d0)*a(1)*a(8)/t0l
 
 1140    earthrm = earthr*1.d-2  
 
 1143    sk0 = n0 * r0 * sin(z0*d2r)
 
 1146    f0 = 
refi(r0,n0,dndr0)
 
 1151    zt = asin(sk0/(rt*nt))*r2d
 
 1152    ft = 
refi(rt,nt,dndrt)
 
 1156    zts = asin(sk0/(rt*nts))*r2d
 
 1157    fts = 
refi(rt,nts,dndrts)
 
 1162    zs = asin(sk0/(rs*ns))*r2d
 
 1163    fs = 
refi(rs,ns,dndrs)
 
 1177          h = (zt - z0)/dble(is)
 
 1180       else if(k.eq.2) 
then 
 1181          h = (zs - zts )/dble(is)
 
 1193          if(i.eq.1.and.k.eq.1) 
then 
 1196          else if(i.eq.1.and.k.eq.2) 
then 
 1208             else if(k.eq.2) 
then 
 1211             rg = rg - ( (rg*n - sk0/sin(z*d2r))/(n + rg*dndr) )
 
 1218          else if(k.eq.2) 
then 
 1224          if(istart.eq.0.and.mod(i,2).eq.0) 
then 
 1232       refp = h*(fb + 4.d0*fo + 2.d0*fe + ff)/3.d0
 
 1234       if(abs(refp-refo).gt.0.5d0*epsl*r2d) 
then 
 1242          if(istart.eq.0) istart = 1
 
 1245       if(k.eq.1) reft = refp
 
 
 1277  function aref(z0, h0,ph, t0,p0,rh, lam,dTdh,eps)
 
 1278    use sufr_kinds, 
only: double
 
 1279    use sufr_constants, 
only: d2r,r2d
 
 1282    real(double), 
intent(in) :: z0, h0,ph, t0,p0, rh,lam, dtdh, eps
 
 1283    real(double) :: 
aref, alt0
 
 1285    alt0 = (90.d0-z0)*d2r  
 
 
 1303    use sufr_kinds, 
only: double
 
 1305    real(double), 
intent(in) :: r,n,dndr
 
 1306    real(double) :: 
refi 
 1308    refi = r*dndr/(n + r*dndr)
 
 
 1326    use sufr_kinds, 
only: double
 
 1328    real(double), 
intent(in) :: r0,t0, a(10),r
 
 1329    real(double), 
intent(out) :: t,n,dndr
 
 1330    real(double) :: tt0, tt01,tt02
 
 1332    t    = t0 - a(1)*(r-r0)
 
 1334    tt01 = tt0**(a(3)-2.d0)
 
 1335    tt02 = tt0**(a(4)-2.d0)
 
 1337    n    = 1.d0 + ( a(7)*tt01 - a(8)*tt02 )*tt0
 
 1338    dndr = -a(9)*tt01 + a(10)*tt02
 
 
 1357    use sufr_kinds, 
only: double
 
 1359    real(double), 
intent(in) :: rt,tt,nt, a,r
 
 1360    real(double), 
intent(out) :: n,dndr
 
 1364    n    = 1.d0 + (nt - 1.d0)*exp(-b*(r-rt))
 
 1365    dndr = -b*(nt-1.d0)*exp(-b*(r-rt))
 
 
Procedures for coordinates.
 
subroutine precess_xyz(jd1, jd2, x, y, z)
Compute the precession of the equinoxes in rectangular coordinates, from jd1 to jd2.
 
real(double) function refract(alt, press, temp)
Compute the atmospheric refraction for a given true altitude. You should add the result to the uncorr...
 
subroutine eq2horiz(ra, dec, agst, hh, az, alt, lat, lon)
Convert spherical equatorial coordinates (RA, dec, agst) to spherical horizontal coordinates (hh,...
 
real(double) function refi(r, n, dndr)
The refraction integrand for atmospheric_refraction_apparent()
 
subroutine horiz2eq(az, alt, agst, hh, ra, dec, lat, lon)
Convert spherical horizontal coordinates (az, alt, agst) to spherical equatorial coordinates (hh,...
 
subroutine eq_2_ecl(ra, dec, eps, l, b)
Convert (geocentric) spherical equatorial coordinates RA, Dec (and eps) to spherical ecliptical coord...
 
real(double) function atmospheric_refraction(alt0, h0, lat0, t0, p0, rh, lam, dtdh, eps)
Compute the atmospheric refraction of light for a given true altitude. Return 0 for alt<-0....
 
subroutine stratosphere_model(rt, tt, nt, a, r, n, dndr)
Stratosphere model for atmospheric_refraction_apparent()
 
subroutine gal2eq(l, b, ra, dec)
Convert spherical galactic coordinates (l,b) to spherical equatorial coordinates (RA,...
 
real(double) function atmospheric_refraction_apparent(alt0, h0, ph, t0, p0, rh, lam, dtdh, eps)
Compute the atmospheric refraction of light for a given apparent (observed) altitude of a celestial o...
 
subroutine aberration_eq(jd, ra, dec, dra, ddec, eps0)
Correct equatorial coordinates for annual aberration - moderate accuracy, use for stars.
 
subroutine precess_orb(jd1, jd2, i, o1, o2)
Compute the precession of the equinoxes in orbital elements.
 
real function refract_sp(alt, press, temp)
Compute the atmospheric refraction for a given true altitude, using single-precision values....
 
subroutine ecl_spher_2_eq_rect(l, b, r, eps, x, y, z)
Convert spherical, ecliptical coordinates to rectangular, equatorial coordinates of an object - both ...
 
subroutine eq2gal(ra, dec, l, b)
Convert spherical equatorial coordinates (RA, dec) to spherical galactic coordinates (l,...
 
subroutine rect_2_spher(x, y, z, l, b, r)
Convert rectangular coordinates x,y,z to spherical coordinates l,b,r.
 
subroutine precess_eq(jd1, jd2, a1, d1)
Compute the precession of the equinoxes in equatorial coordinates, from jd1 to jd2.
 
subroutine ecl_2_eq(l, b, eps, ra, dec)
Convert (geocentric) spherical ecliptical coordinates l,b (and eps) to spherical equatorial coordinat...
 
real(double) function aref(z0, h0, ph, t0, p0, rh, lam, dtdh, eps)
Compute the atmospheric refraction of light for a given apparent (observed) zenith angle....
 
subroutine fk5(t, l, b)
Convert coordinates to the FK5 system.
 
subroutine hc_spher_2_gc_rect(l, b, r, l0, b0, r0, x, y, z)
Compute the geocentric rectangular coordinates of a planet, from its and the Earth's heliocentric sph...
 
subroutine calcsunxyz(t1, l0, b0, r0, x, y, z)
Compute the geocentric equatorial rectangular coordinates of the Sun, from Earth's heliocentric,...
 
subroutine aberration_ecl(t, l0, l, b)
Correct ecliptic longitude and latitiude for annual aberration.
 
subroutine troposphere_model(r0, t0, a, r, t, n, dndr)
Troposphere model for atmospheric_refraction_apparent()
 
subroutine precess_eq_yr(yr1, yr2, a1, d1)
Compute the precession of the equinoxes in equatorial coordinates, from yr1 to yr2.
 
subroutine precess_ecl(jd1, jd2, l, b)
Compute the precession of the equinoxes in geocentric ecliptical coordinates.
 
subroutine geoc2topoc_eq(gcra, gcd, gcr, gch, tcra, tcd, lat, hgt)
Convert geocentric equatorial coordinates to topocentric.
 
subroutine geoc2topoc_ecl(gcl, gcb, gcr, gcs, eps, lst, tcl, tcb, tcs, lat, hgt)
Convert spherical ecliptical coordinates from the geocentric to the topocentric system.
 
Local parameters for libTheSky: location, date, time.
 
real(double) height
Altitude of the observer above sea level (m)
 
real(double) lon0
Longitude of the observer (rad)
 
real(double) lat0
Latitude of the observer (rad)
 
subroutine nutation(t, dpsi, eps0, deps)
Calculate nutation - cheap routine from Meeus - as well as the mean obliquity of the ecliptic.