geo_to_cart Function

private pure function geo_to_cart(glat, glon, alt) result(x)

geodetic to scaled cartesian coordinates

Arguments

Type IntentOptional 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

Return Value real(kind=wp), dimension(3)

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

Called by

proc~~geo_to_cart~~CalledByGraph proc~geo_to_cart shellig_module::geo_to_cart proc~shellg shellig_module::shellig_type%shellg proc~shellg->proc~geo_to_cart proc~igrf shellig_module::shellig_type%igrf proc~igrf->proc~shellg proc~shellc shellig_module::shellig_type%shellc proc~shellc->proc~shellg proc~get_flux_g_ radbelt_module::radbelt_type%get_flux_g_ proc~get_flux_g_->proc~igrf proc~igrfc shellig_module::shellig_type%igrfc proc~igrfc->proc~shellc none~get_flux radbelt_module::radbelt_type%get_flux none~get_flux->proc~get_flux_g_ proc~get_flux_c_ radbelt_module::radbelt_type%get_flux_c_ none~get_flux->proc~get_flux_c_ proc~get_flux_c_->proc~igrfc proc~get_flux_c radbelt_module::get_flux_c proc~get_flux_c->none~get_flux proc~get_flux_g radbelt_module::get_flux_g proc~get_flux_g->none~get_flux proc~get_flux_g_c radbelt_c_module::get_flux_g_c proc~get_flux_g_c->none~get_flux interface~get_flux radbelt_module::get_flux interface~get_flux->proc~get_flux_c interface~get_flux->proc~get_flux_g

Source Code

    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