Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=ESMF_KIND_R8), | intent(in) | :: | lon | |||
real(kind=ESMF_KIND_R8), | intent(in) | :: | lat | |||
real(kind=ESMF_KIND_R8), | intent(in) | :: | r | |||
real(kind=ESMF_KIND_R8), | intent(out) | :: | x | |||
real(kind=ESMF_KIND_R8), | intent(out) | :: | y | |||
real(kind=ESMF_KIND_R8), | intent(out) | :: | z |
subroutine spherical_to_cartesian(lon, lat, r, x, y, z) real(ESMF_KIND_R8) , intent(IN) :: lon, lat, r real(ESMF_KIND_R8) , intent(OUT) :: x, y, z x = r * COS(lon) * cos(lat) y = r * SIN(lon) * cos(lat) #ifdef RIGHT_HAND z = r * SIN(lat) #else z = -r * sin(lat) #endif end subroutine spherical_to_cartesian