PRO plotorb,sat,date,start,endt,interval,device,ctime,cgdlat,cgdlon $ ,noplot=noplot,fpalt=fpalt ; ; This procedure plots the magnetic footprint (at an altitude ; specified by the user; default 110 km) of the specified satellite ; on the given date between the specified start and end times (UT), ; plotting points at the specified intervals. Output can be directed ; to the specified device. ; ; Argument formats: ; sat: must agree exactly with satellite name in tle.### files ; date: YYMMDD ; start: HHMMSS (UT) of first footprint point ; endt: HHMMSS (UT) of last footprint point; if this time ; occurs after 24 UT on 'date', specify it as a time ; > 240000. ; interval: minutes between plotted points (can be fractional) ; device: device name as accepted by SET_PLOT command ; noplot: keyword indicating that instead of plotting the ; path of the selected satellite on a grid around ; Rabbit Lake, the path of the satellite is to be ; returned to the calling routine in the variables ; ctime, cgdlat, and cgdlon. ; ; Algorithm: ; build input file for ~/steele/track/spacetrk/bin/spmod ; use SPAWN command to run spmod with given input file and redirect ; output to another file (shd the file name be a parameter, or ; shd it be named to reflect the inputs?) ; select the output device (default to 'X') ; read in the output file and plot the footprint using the MAP calls ; overplot the location and approximate field of view of Rabbit Lake ; if PostScript selected, close the file and send it to the printer ; ; DPS, 28 April 1993 ; ; if no plot needed, the following information is not required IF NOT KEYWORD_SET(noplot) THEN BEGIN ; ascertain user's intentions, if sat = 'UARS' resp='' IF sat EQ 'UARS' THEN BEGIN PRINT,'Do you want the large neighbourhood of Rabbit Lake? (Y/[N])' READ,resp resp=STRUPCASE(resp) ENDIF ENDIF ; is the footprint altitude specified yet? IF NOT KEYWORD_SET(fpalt) THEN fpalt=110. ; start by creating spmod input file OPENW,ip,'~/input.tmp',/GET_LUN PRINTF,ip,sat PRINTF,ip,date,start,FORMAT='(I6,".",I6.6)' PRINTF,ip,date,endt,FORMAT='(I6,".",I6.6)' PRINTF,ip,interval,FORMAT='(F5.2)' PRINTF,ip,'4' ; get geodetic coordinates of the footprint PRINTF,ip,fpalt ; footprint altitude CLOSE,ip FREE_LUN,ip ; now spawn a UNIX command to calculate the required footprint ; coordinates SPAWN,'~steele/track/spacetrk/bin/spmod < ~/input.tmp >! ~/output.tmp',orbres ; read in the coordinates OPENR,op,'~/output.tmp',/GET_LUN textline='' numline=FLTARR(5) inputs=TRANSPOSE(numline) FOR i=0,13 DO READF,op,textline tlefile=STRMID(textline,33,7) edate=0.0D0 READF,op,yr,edate,FORMAT='(18X,I2,F12.8)' yr=1900+yr FOR i=0,2 DO READF,op,textline REPEAT BEGIN READF,op,numline inputs=[inputs,TRANSPOSE(numline)] ENDREP UNTIL EOF(op) CLOSE,op FREE_LUN,op ; extract file contents from inputs inputs=inputs(1:*,*) cdate=inputs(*,0) ctime=inputs(*,1) cgdlat=inputs(*,2) cgdlon=inputs(*,3)-360. ; if no plot desired, return satellite path to calling program IF KEYWORD_SET(noplot) THEN RETURN ; restrict plotted coordinates to points inside lat/lon grid IF resp NE 'Y' THEN BEGIN wedge=-114. eedge=-92. nedge=62. sedge=54. ENDIF ELSE BEGIN wedge=-126. eedge=-80. nedge=67. sedge=49. ENDELSE ingrid=WHERE((cgdlon GE wedge) AND (cgdlon LE eedge) AND $ (cgdlat GE sedge) AND (cgdlat LE nedge),ningrid) IF ningrid GT 0 THEN BEGIN cdate=cdate(ingrid) ctime=ctime(ingrid) cgdlat=cgdlat(ingrid) cgdlon=cgdlon(ingrid) ; set up device IF STRUPCASE(device) EQ 'PS' THEN psopen,'/tmp/tmp.ps' ; define Rabbit Lake coordinates rllat=58.233 rllon=256.330-360.0 ; create map title mtitle=STRING(sat,date,start,endt $ ,FORMAT='(A," near Rabbit Lake, SK, ",I6,", ",I6.6," - ",I6.6," UT")') ; plot map MAP_SET,rllat,rllon,/ORTHOGRAPHIC,LIMIT=[sedge,wedge,nedge,eedge] $ ,/GRID,/LABEL,TITLE=mtitle,LATLAB=-110,LATALIGN=0.0,LONLAB=55 $ ,LONALIGN=1.0,/NOBORDER,LATDEL=1.0,LONDEL=2.0,XMARGIN=[3,3] $ ,YMARGIN=[3,3],CHARSIZE=0.75,/CONTINENTS,/USA prov USERSYM,[1,0,-1,0],[0,1,0,-1],/FILL PLOTS,cgdlon,cgdlat,PSYM=-8,NOCLIP=0 atmin=WHERE(LONG(ctime) MOD 100 EQ 0) XYOUTS,cgdlon(atmin),cgdlat(atmin)+0.1,STRTRIM(LONG(ctime(atmin)),2) $ ,ALIGNMENT=0.5,CHARSIZE=0.75 ydn2md,yr,FIX(edate),emon,eday XYOUTS,rllon,sedge-(nedge-sedge)/22.86,ALIGNMENT=0.5 $ ,STRING(tlefile,yr,emon,eday $ ,FORMAT='(A,": ",I4,"/",I2.2,"/",I2.2)') ; show Rabbit Lake position PLOTS,rllon,rllat,PSYM=1 XYOUTS,rllon-0.4,rllat,'Rabbit Lake',ALIGNMENT=1. ; overplot the horizon at Rabbit Lake a=6371. nza=4 hang=!DTOR*15.*(FINDGEN(nza)+1) gcrad=hang-ASIN((a*SIN(hang))/(a+fpalt)) naz=37 az=FINDGEN(naz)*360./(naz-1) hlon=FLTARR(naz,nza) hlat=hlon FOR i=0,naz-1 DO BEGIN rb2ll,rllon,rllat,gcrad,az(i),alon,alat hlon(i,*)=alon hlat(i,*)=alat ENDFOR FOR i=0,nza-1 DO BEGIN PLOTS,hlon(*,i)-360.,hlat(*,i) XYOUTS,hlon(0,i),hlat(0,i)+0.05,ALIGNMENT=0.5,CHARSIZE=0.75 $ ,STRTRIM(FIX(!RADEG*hang(i)+.001),2)+'!9%!x' IF i EQ nza-1 THEN XYOUTS,hlon(0,i),hlat(0,i)+0.25 $ ,ALIGNMENT=0.5,CHARSIZE=0.75 $ ,STRING(fpalt,FORMAT='("(",I3," km altitude)")') ENDFOR ; end plot IF !D.NAME EQ 'PS' THEN BEGIN psclose SPAWN,'rmps3 /tmp/tmp.ps b' ENDIF SPAWN,'rm ~/input.tmp ~/output.tmp' ENDIF ELSE PRINT,sat+' not visible from Rabbit Lake at these times.' RETURN END