;+ ; NAME: ; MCONVERT ; PURPOSE: ; Conversion between geographic coordinates and PACE geomagnetic ; coordinates (cf. Baker, K.B. and S. Wing, J. Geophys. Res., ; Vol. 94, pg. 9139, 1989) (PACE => Polar Anglo-american ; Conjugate Experiment) ; CATEGORY: ; Coordinate conversion ; CALLING SEQUENCE: ; MCONVERT,YR,MON,DAY,HR,MIN,SEC,INLAT,INLON,INALT,FLAG $ ; ,OUTLAT,OUTLONG,MLT ; INPUTS: ; YR, MON, DAY: Specify the date (in Universal Time); ; HR, MIN, SEC: Specify the time (in Universal Time); ; INLAT, INLON, INALT: Specify the input location, in degrees ; of N latitude, E longitude, and kilometers ; of altitude above the surface of the Earth. ; FLAG=1 => geographic coordinates; ; FLAG=2 => PACE geomagnetic coordinates. ; FLAG: Controls whether the conversion is from geographic ; -> PACE (FLAG=1) or PACE -> geographic (FLAG=2). ; OPTIONAL INPUTS: ; None. ; KEYWORD PARAMETERS: ; None. ; OUTPUTS: ; OUTLAT, OUTLONG, MLT: Return the latitude, longitude, ; and magnetic local time (hours) of the ; specified location. As above, ; FLAG=1 => PACE geomagnetic coordinates; ; FLAG=2 => geographic coordinates. ; OPTIONAL OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; Three files are written in ~steele/PACE: scratch0.dat holds ; the input parameters, scratch1.dat holds the output ; parameters, and checkinp.dat holds the inputs as well as ; all parameters generated by the SPAWNed executable. ; RESTRICTIONS: ; PACE doesn't work for altitudes above 600 km. ; PROCEDURE: ; The inputs are written to a formatted file: scratch0.dat. ; An executable file is run via SPAWN, which reads the inputs, ; performs geographic<->PACE conversion on them, and writes ; the output parameters to another formatted file: scratch1.dat. ; The contents of this file are then returned to the calling ; IDL routine. ; EXAMPLE: ; IDL> mconvert,1995,2,7,16,30,0,51.0800,245.8681,1.1154,1,mlat,mlong,mlt ; IDL> PRINT,mlat,mlong,mlt ; 58.6273 7.90959 ; SEE ALSO: ; CONVERT.PRO ; ; MODIFICATION HISTORY: ; Written by: R A Doe, SRI International, 1993? ; Modified: D P Steele, ISR, U of Calgary, 950207. ; Extended from CONVERT.PRO by D P Steele, ISR, 950306. ;- PRO mconvert,yr,mon,day,hr,min,sec,inlat,inlon,inalt,flag,outlat,outlon,outmlt ; This program is an IDL driver for the PACE geomagnetic ; model of Baker and Wing. UT hour, minute and seconds, as well ; as geographic/geomagnetic latitude and longitude, altitude, and ; a direction flag are written to a file scratch0.dat. The program ; then SPAWNs out to the FORTRAN executable `mconvert' which converts ; the input coordinates between geographic and PACE geomagnetic ; latitude and magnetic local time. The converted coordinates ; are then written to a file scratch1.dat and control passes back ; to the IDL program. CD,'~cnsr3/pace',CURRENT=old_dir ; Do error checking on FLAG flag=FIX(flag>1<2) OPENW,1,'scratch0.dat' PRINTF,1,FORMAT='(6(2x,i2),2x,f6.2,2(2x,f7.2),2x,i1)' $ ,yr MOD 1900,mon,day,hr,min,sec,inlat,inlon,inalt,flag CLOSE,1 SPAWN,"mconvert",/NOSHELL OPENR,1,'scratch1.dat' READF,1,outlat,outlon,outmlt CLOSE,1 CD,old_dir RETURN END