;------------------------------------------------------------- ;+ ; NAME: ; ELLIPSOID ; PURPOSE: ; Set or get earth ellipsoid structure. ; CATEGORY: ; CALLING SEQUENCE: ; ellipsoid ; INPUTS: ; KEYWORD PARAMETERS: ; Keywords: ; SET=ell_name Name of ellipsoid to set as working. ; Default = WGS 84. ; GET=ell_str Return ellipsoid structure. ; /ALL List all available ellipsoids. ; /CURRENT List currently set ellipsoid. ; OUTPUTS: ; COMMON BLOCKS: ; ellipsoid_com ; NOTES: ; Note: the ellipsoid structure contains the semimajor ; axis in meters, the reciprocal of the flattening ; factor, and the ellipsoid name. ; This routine is used internally by the ellipsoid ; ell_* routines. The working ellipsoid may be set ; before calling those routines. ; MODIFICATION HISTORY: ; R. Sterner, 2002 May 01 ; ; Copyright (C) 2002, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ;- ;------------------------------------------------------------- pro ellipsoid,set=set,get=get,error=err,all=all,current=curr,help=hlp ;----- Common containing ellipsoid structure ----------- common ellipsoid_com, ell_str if keyword_set(hlp) then begin print,' Set or get earth ellipsoid structure.' print,' ellipsoid' print,' All args are keywords.' print,' Keywords:' print,' SET=ell_name Name of ellipsoid to set as working.' print,' Default = WGS 84.' print,' GET=ell_str Return ellipsoid structure.' print,' /ALL List all available ellipsoids.' print,' /CURRENT List currently set ellipsoid.' print,' Note: the ellipsoid structure contains the semimajor' print,' axis in meters, the reciprocal of the flattening' print,' factor, and the ellipsoid name.' print,' This routine is used internally by the ellipsoid' print,' ell_* routines. The working ellipsoid may be set' print,' before calling those routines.' return endif ;--- Working ellipsoid defaults to WGS 84 -------------- if n_elements(ell_str) eq 0 then begin get_ellipsoid, 'WGS 84', ell, err=err if err ne 0 then stop ell_str = ell endif ;--- Set requested ellipsoid to be working ellipsoid --- if n_elements(set) ne 0 then begin get_ellipsoid, set, ell, err=err ; Try to get requested ellipsoid. if err ne 0 then return ; If error return. ell_str = ell ; Copy to working ellipsoid. endif ;--- Return working ellipsoid ------------ get = ell_str ;--- List all available ellipsoids --------------------- if keyword_set(all) then get_ellipsoid, /list ;--- List current ellipsoid --------------- if keyword_set(curr) then begin print,' Currently set ellipsoid:' print,' a 1/f Name' print,ell_str.a,ell_str.f1,ell_str.name, $ form='(F13.3,F16.9,3X,A)' endif end