123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- # 0 "<stdin>"
- # 0 "<built-in>"
- # 0 "<command-line>"
- # 1 "/usr/include/stdc-predef.h" 1 3 4
- # 17 "/usr/include/stdc-predef.h" 3 4
- # 2 "<command-line>" 2
- # 1 "<stdin>"
- # 10 "<stdin>"
- module m_oldtonew
- use m_confmap
- implicit none
- contains
- ! this routine performes a conformal mapping of the old to the new
- ! coordinate system
- !
- subroutine oldtonew(lat_o, lon_o, lat_n, lon_n)
- real(8), intent(in) :: lat_o, lon_o
- real(8), intent(out) :: lat_n, lon_n
- real :: theta, phi, psi, mu
- complex :: z, w
- if (.not. confmap_initialised) then
- print *, 'ERROR: oldtonew(): confmap not initialised'
- stop
- end if
- ! transform to spherical coordinates
- !
- theta = mod(lon_o * rad + 3.0 * pi_1, 2.0 * pi_1) - pi_1
- phi = pi_2 - lat_o * rad
- ! transform to the new coordinate system
- !
- if (abs(phi - pi_1) < epsil) then
- mu = mu_s
- psi = psi_s
- elseif (abs(phi - phi_b) < epsil .and. abs(theta - theta_b) < epsil) then
- mu = 0.0
- psi = pi_1
- else
- z = tan(0.5 * phi) * exp(imagone * theta)
- w = (z - ac) * cmnb / ((z - bc) * cmna)
- mu = atan2(aimag(w), real(w))
- psi = 2.0 * atan(abs(w))
- endif
- ! transform to lat/lon coordinates
- !
- lat_n = (pi_2 - psi) * deg
- lon_n = mu * deg
- end subroutine oldtonew
- end module m_oldtonew
|