      real(selected_real_kind(15)) function antemp(L,Z)
      implicit real(selected_real_kind(15)) (a-h,o-z)
      DIMENSION ZB(10,7),C(11,7),DELTA(10,7),TSTAR(7)
C ************** TROPICAL SOUNDING **************************
      DATA (ZB(N,1),N=1,10)/
     1                        2.0,   3.0,   16.5,  21.5,  45.0,
     2                        51.0,  70.0,  100.,  200.,  300./
      DATA (C(N,1),N=1,11)/
     1                       -6.0,  -4.0,  -6.7,   4.0,   2.2,
     2                        1.0,  -2.8,  -.27,   0.0,   0.0,  0.0/
      DATA (DELTA(N,1),N=1,10)/
     1                         .5,    .5,    .3,    .5,    1.0,
     2                        1.0,   1.0,   1.0,   1.0,    1.0/
C ************** SUB-TROPICAL SUMMER ************************
      DATA (ZB(N,2),N=1,10)/
     1                        1.5,   6.5,  13.0,  18.0,  26.0,
     2                        36.0,  48.0,  50.0, 70.0,  100./
      DATA (C(N,2),N=1,11)/
     1                       -4.0,  -6.0,  -6.5,   0.0,   1.2,
     2                        2.2,   2.5,   0.0,  -3.0,  -0.25,  0.0/
      DATA (DELTA(N,2),N=1,10)/
     1                         .5,  1.0,    .5,    .5,   1.0,
     2                        1.0,  2.5,    .5,   1.0,   1.0/
C ************** SUB-TROPICAL WINTER ************************
      DATA (ZB(N,3),N=1,10)/
     1                        3.0,  10.0,  19.0,  25.0,  32.0,
     2                        44.5, 50.0,  71.0,  98.0,  200.0/
      DATA (C(N,3),N=1,11)/
     1                       -3.5,  -6.0,  -0.5,  0.0,   0.4,
     2                        3.2,   1.6,  -1.8, -0.7,   0.0,   0.0/
      DATA (DELTA(N,3),N=1,10)/
     1                         .5,   .5,  1.0,   1.0,   1.0,
     2                        1.0,  1.0,  1.0,   1.0,   1.0/
C *************  SUB-ARCTIC SUMMER *************************
      DATA (ZB(N,4),N=1,10)/
     1                         4.7, 10.0,  23.0,  31.8,  44.0,
     2                        50.2, 69.2, 100.0, 102.0, 103.0/
      DATA (C(N,4),N=1,11)/
     1                        -5.3, -7.0,   0.0,  1.4,   3.0,
     2                         0.7, -3.3,  -0.2,  0.0,   0.0,  0.0/
      DATA (DELTA(N,4),N=1,10)/
     1                         .5,   .3,  1.0,   1.0,   2.0,
     2                        1.0,  1.5,  1.0,   1.0,   1.0/
C ************ SUB-ARCTIC WINTER *****************************
      DATA (ZB(N,5),N=1,10)/
     1                        1.0,   3.2,   8.5,   15.5,   25.0,
     2                        30.0,  35.0,  50.0,  70.0,  100.0/
      DATA (C(N,5),N=1,11)/
     1                        3.0,  -3.2,  -6.8,  0.0,  -0.6,
     2                        1.0,   1.2,   2.5, -0.7,  -1.2,  0.0/
      DATA (DELTA(N,5),N=1,10)/
     1                         .4,   1.5,    .3 ,   .5,   1.0,
     2                        1.0,   1.0,   1.0,   1.0,   1.0/
C ************ US STANDARD 1976 ******************************
      DATA (ZB(N,6),N=1,10)/
     1                       11.0,  20.0,  32.0,  47.0,  51.0,
     2                       71.0,  84.8520,  90.0,  91.0,  92.0/
      DATA (C(N,6),N=1,11)/
     1                       -6.5,   0.0,   1.0,   2.80,  0.0,
     2                       -2.80, -2.00,  0.0,   0.0,   0.0,  0.0/
      DATA (DELTA(N,6),N=1,10)/
     1                        0.3,   1.0,   1.0,   1.0,   1.0,
     2                        1.0,   1.0,   1.0,   1.0,   1.0/
C
C ************ ENLARGED US STANDARD 1976 **********************
      DATA (ZB(N,7),N=1,10)/
     1                       11.0,  20.0,  32.0,  47.0,  51.0,
     2                       71.0,  84.8520,  90.0,  91.0,  92.0/
      DATA (C(N,7),N=1,11)/
     1                       -6.5,   0.0,   1.0,   2.80,  0.0,
     2                       -2.80, -2.00,  0.0,   0.0,   0.0,  0.0/
      DATA (DELTA(N,7),N=1,10)/
     1                        0.3,   1.0,   1.0,   1.0,   1.0,
     2                        1.0,   1.0,   1.0,   1.0,   1.0/
C
      DATA TSTAR/
     1            300.0,  294.0,  272.2,  287.0,  257.1, 2*288.15/
C
      NLAST=10
      TEMP=TSTAR(L)+C(1,L)*Z
      DO 20 N=1,NLAST
      EXPO=(Z-ZB(N,L))/DELTA(N,L)
      if (abs(expo).le.60.) then
        x=exp(expo)
        y=x+1.0/x
        zlog=log(y)
      else
        zlog=abs(expo)
      endif
      EXPP=ZB(N,L)/DELTA(N,L)
      if (abs(expp).le.60.) then
        x=exp(expp)
        y=x+1.0/x
        faclog=log(y)
      else
        faclog=abs(expp)
      endif
      TEMP=TEMP+(C(N+1,L)-C(N,L))*0.5*(Z+DELTA(N,L)*
     1     (ZLOG-FACLOG))
   20 CONTINUE
      ANTEMP=TEMP
      RETURN
      END
