Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=ESMF_KIND_R8) | :: | lon_rad | ||||
real(kind=ESMF_KIND_R8) | :: | lat_rad | ||||
real(kind=ESMF_KIND_R8) | :: | e_vec(3) | ||||
real(kind=ESMF_KIND_R8) | :: | n_vec(3) |
subroutine calc_unit_basis_vecs(lon_rad, lat_rad, e_vec, n_vec) real(ESMF_KIND_R8) :: lon_rad,lat_rad real(ESMF_KIND_R8) :: e_vec(3) real(ESMF_KIND_R8) :: n_vec(3) real(ESMF_KIND_R8) :: e_len, n_len ! East vector ! [-sin(lng), cos(lng), 0] e_vec(1)=-sin(lon_rad) e_vec(2)=cos(lon_rad) e_vec(3)=0 ! Make unit vec e_len=sqrt(e_vec(1)*e_vec(1) + & e_vec(2)*e_vec(2) + & e_vec(3)*e_vec(3)) if (e_len .ne. 0.0) then e_vec(1)=e_vec(1)/e_len e_vec(2)=e_vec(2)/e_len e_vec(3)=e_vec(3)/e_len endif ! North vector ! [-sin(lat) * cos(lng), -sin(lat) * sin(lng), cos(lat)] n_vec(1)=-sin(lat_rad)*cos(lon_rad) n_vec(2)=-sin(lat_rad)*sin(lon_rad) n_vec(3)=cos(lat_rad) ! Make unit vec n_len=sqrt(n_vec(1)*n_vec(1) + & n_vec(2)*n_vec(2) + & n_vec(3)*n_vec(3)) if (n_len .ne. 0.0) then n_vec(1)=n_vec(1)/n_len n_vec(2)=n_vec(2)/n_len n_vec(3)=n_vec(3)/n_len endif end subroutine calc_unit_basis_vecs