geodetic to scaled cartesian coordinates
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | glat |
geodetic latitude in degrees (north) |
||
real(kind=wp), | intent(in) | :: | glon |
geodetic longitude in degrees (east) |
||
real(kind=wp), | intent(in) | :: | alt |
altitude in km above sea level |
cartesian coordinates in earth radii (6371.2 km)
pure function geo_to_cart(glat, glon, alt) result(x) real(wp), intent(in) :: glat !! geodetic latitude in degrees (north) real(wp), intent(in) :: glon !! geodetic longitude in degrees (east) real(wp), intent(in) :: alt !! altitude in km above sea level real(wp), dimension(3) :: x !! cartesian coordinates in earth radii (6371.2 km) !! !! * x-axis pointing to equator at 0 longitude !! * y-axis pointing to equator at 90 long. !! * z-axis pointing to north pole real(wp) :: rlat !! latitude in radians real(wp) :: rlon !! longitude in radians real(wp) :: d, rho ! deg to radians: rlat = glat * umr rlon = glon * umr ! JW : it's weird that ct is sin, and st is cos...it was like that in the original code associate (ct => sin(rlat), st => cos(rlat), cp => cos(rlon), sp => sin(rlon)) d = sqrt(aquad - (aquad - bquad) * ct * ct) rho = (alt + aquad / d) * st / era x = [rho * cp, rho * sp, (alt + bquad / d) * ct / era] end associate end function geo_to_cart