38 real (r8),
intent(in) :: sa(:), ct(:), p(:)
39 real (r8),
intent(out) :: tu(:), rsubrho(:), p_mid(:)
42 real (r8),
dimension(:),
allocatable :: dsa, sa_mid, dct, ct_mid, dp
43 real (r8),
dimension(:),
allocatable :: alpha_mid, beta_mid
45 character (*),
parameter :: func_name =
"gsw_turner_rsubrho" 48 if (
size(tu).lt.nz-1 .or.
size(rsubrho).lt.nz-1 .or.
size(p_mid).lt.nz-1)
then 55 allocate (dsa(nz-1), sa_mid(nz-1), dct(nz-1), ct_mid(nz-1), dp(nz-1))
56 allocate (alpha_mid(nz-1), beta_mid(nz-1))
59 dsa(k) = (sa(k) - sa(k+1))
60 sa_mid(k) = 0.5_r8*(sa(k) + sa(k+1))
61 dct(k) = (ct(k) - ct(k+1))
62 ct_mid(k) = 0.5_r8*(ct(k) + ct(k+1))
63 dp(k) = (p(k) - p(k+1))
64 p_mid(k) = 0.5_r8*(p(k) + p(k+1))
68 alpha=alpha_mid,beta=beta_mid)
70 tu(1:nz-1) =
rad2deg*atan2((alpha_mid*dct + beta_mid*dsa), &
71 (alpha_mid*dct - beta_mid*dsa))
73 where (dsa .ne. 0.0_r8)
74 rsubrho = (alpha_mid*dct)/(beta_mid*dsa)
79 deallocate (dsa, sa_mid, dct, ct_mid, dp)
80 deallocate (alpha_mid, beta_mid)
real(r8), parameter rad2deg
pure subroutine gsw_turner_rsubrho(sa, ct, p, tu, rsubrho, p_mid)
elemental real(r8) function, public gsw_error_code(err_num, func_name, error_code)