;+ ; NAME: ; oc_fgh2lla.pro ; ; PURPOSE: ; Convert between fgh (skyplane) coordinates and lon, lat, alt ; ; DESCRIPTION: ; Convert between fgh (skyplane) coordinates and lon, lat, alt ; ; CALLING SEQUENCE: ; lonlatalt = oc_fgh2lla(targ,et,radec_star, fgh) ; ; INPUTS: ; et - the ET at the target for which you want to know the coordinates ; targ = target code ; radec_star - vector of; ; A - right ascention in radians ; D - declination in radians ; fgh - vector of [f, g, h] relative to target center ; OPTIONAL INPUT PARAMETERS: ; ; KEYWORDS ; OUTPUTS: ; lonlatalt - array of [east longitude (radian), ; geodetic latitude (radian), ; altitude (km)] ; ; REVISON HISTORY: ; 2007 Sep 12 Leslie Young ;- function oc_fgh2lla, targ, et, radec_star, fgh, rec=rec ; get the rotation matrix r_f2x = oc_f2x_rotmat(radec_star[0], radec_star[1]) r_x2t = oc_x2t_rotmat(targ, et) ; J2000 xyz to target r_f2t = r_x2t ## r_f2x ; rotate fgh into target-centered rectangular coordinates rec = transpose(r_f2t) # fgh ; convert from rectangular to spherical cspice_bodvar, naif_id(targ), 'RADII', abc re = abc[0] f = (re - abc[2])/re cspice_recgeo, rec, re, f, lon, lat, alt return, [lon, lat, alt] end