summaryrefslogtreecommitdiff
path: root/map65/libm65/tm2.f90
blob: 45fd2aeec76d3115b9802ea2c51781bf8c5b5b5c (plain)
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
module tm2_mod
  implicit none

  interface
     subroutine tmoonsub(day, glat, glong, el, rv, xl, b, pax)
       real(8), intent(in)  :: day, glat, glong
       real(8), intent(out) :: el, rv, xl, b, pax
     end subroutine tmoonsub
  end interface

contains

subroutine tm2(day, xlat4, xlon4, xl4, b4)
  implicit none

  ! Arguments
  real(8), intent(in)  :: day
  real(4), intent(in)  :: xlat4, xlon4
  real(4), intent(out) :: xl4, b4

  ! Locals
  real(8), parameter :: RADS = 0.0174532925199433d0
  real(8) :: glat, glong
  real(8) :: el, rv, xl, b, pax

  ! Convert to radians
  glat  = xlat4 * RADS
  glong = xlon4 * RADS

  ! Call the external routine
  call tmoonsub(day, glat, glong, el, rv, xl, b, pax)

  ! Convert back to real*4
  xl4 = real(xl, 4)
  b4  = real(b, 4)

end subroutine tm2

end module tm2_mod