;+ ; NAME: ; PLOTTLOG ; PURPOSE: ; To plot the contents of a daily Polar Camera temperature log. ; CATEGORY: ; ? ; CALLING SEQUENCE: ; PLOTTLOG, YEAR, MONTH, DAY [, CAMERA] [, PS = ps] [, KEEP = keep] $ ; [, DEBUG = debug] ; INPUTS: ; YEAR, MONTH, DAY: Specify the date (w.r.t. Universal Time) ; OPTIONAL INPUTS: ; CAMERA: Specify whch camera to plot temperatures from. This is ; a dummy argument retained for compatibility with an old ; version of the routine. ; KEYWORD PARAMETERS: ; /PS: Send the plot to a PostScript file. ; /KEEP: Retain the temporary files that hold temperature values ; from single sensors. ; /DEBUG: Stop early on and allow the user to step through to ; locate problems. ; /HELP: Show the user this header. ; OUTPUTS: ; None. ; OPTIONAL OUTPUTS: ; None. ; COMMON BLOCKS: ; None. ; SIDE EFFECTS: ; A temperature log file is (gunzipped if necessary,) read, and ; temporary files containing temperature records from individual ; sensors are created. The temporary files are removed after use ; unless the /KEEP keyword is set. ; RESTRICTIONS: ; The temperature log file must be in the standard directory, e.g., ; file KI_TEMP1.mdd (or KI_TEMP1.mdZ) must be in ; \IMAGES\LOG\yy\mdd where yy are the last two digits of the year, ; m is the (hexadecimal) month number, and dd are the digits of the ; day of the month. All log files are stored in this location by ; STORLOGS.PRO. ; PROCEDURE: ; ; EXAMPLE: ; ; SEE ALSO: ; ; MODIFICATION HISTORY: ; Written by: D P STEELE, ISR, 1993 - 94. ;- PRO plottlog,year,month,day,camera,ps=ps,keep=keep,debug=debug,help=help ; ; Look for specified temperature log file ; If found, open it and read the contents ; Prompt the user for the temperature data to plot ; Set up the plot window ; Plot the data IF Keyword_Set(help) THEN BEGIN Doc_Library,'plottlog' Return ENDIF ; Set up OS-specific items @isitdos CD,!DIR IF N_PARAMS() EQ 3 THEN BEGIN IF Keyword_Set(debug) THEN BEGIN Print,'Use debugging options to step through from here ...' Stop ENDIF ; Go to appropriate subdirectory of ~cnsr3/log yd=STRING(year MOD 100,FORMAT='(I2)') IF month LT 10 THEN mchar=STRTRIM(month,2) $ ELSE mchar=STRING(BYTE(month-10)+BYTE('a')) suffix=STRING(mchar,day,FORMAT='(A1,I2.2)') path=logroot+dd+yd+dd+suffix CD,path ; Locate the correct file IF dos THEN suff=STRMID(suffix,0,2) ELSE suff=suffix path=path+dd+'asctemp1.'+suff f=rfindfile(path+'*',COUNT=nf) IF nf GE 1 THEN f=STRLOWCASE(f(0)) ELSE BEGIN MESSAGE,'Cannot find '+path,/INFORMATIONAL RETURN ENDELSE ; If the temperature log file has been gzipped, gunzip it IF STRPOS(f,'z') NE -1 THEN BEGIN MESSAGE,"Attempting to 'gunzip' file "+f,/INFORMATIONAL SPAWN,gzipcmd+'-d -v '+f ; cmds=[gzipcmd+'-d -v '+f,'pause'] ; mputfile,sroot+dd+'gunzipf.bat',cmds ; SPAWN,sroot+dd+'gunzipf.bat' ENDIF ; Does the temperature log file actually exist? tlog=rfindfile(path+'*',COUNT=ntlog) IF ntlog EQ 1 THEN BEGIN OPENR,logunit,tlog(0),/GET_LUN loginfo=FSTAT(logunit) FREE_LUN,logunit goodfile=(loginfo.SIZE GT 1000) ENDIF ELSE goodfile=0B ; Used to use 'awk' to extract individual parameter records; ; now we use good ol' IDL. IF goodfile THEN BEGIN IF dos THEN BEGIN SPAWN,rmcmd+'t*.*' ; remove any remnants of previous runs SPAWN,rmcmd+'h*.*' ENDIF ELSE BEGIN SPAWN,rmcmd+'t*' SPAWN,rmcmd+'h*' ENDELSE ; breakout_command=awk_cmd+' -f '+awk_src+' '+tlog(0) ; SPAWN,breakout_command ; run 'awk' to create files for ; ; individual parameters rdtlog,year,month,day,infile=tlog(0) ; Plot individual parameters !P.MULTI=[0,0,2,0,0] IF KEYWORD_SET(ps) THEN BEGIN psfile=psroot+dd+'tlog'+dc+suffix+'.ps' psopen,psfile DEVICE,YSIZE=9.0,YOFFSET=1.0,/INCHES ENDIF ELSE BEGIN WINDOW,0,XSIZE=640,YSIZE=900 loadct,0,/silent ENDELSE ct0,year,month,day,/oneday ct1,year,month,day,/oneday IF KEYWORD_SET(ps) THEN BEGIN psclose IF NOT dos THEN SPAWN,'~steele/scripts/rmps3 '+psfile+' b' ENDIF ; Delete individual parameter records and gzip temperature log to save space IF NOT KEYWORD_SET(keep) THEN BEGIN IF dos THEN BEGIN SPAWN,rmcmd+'t*.*' ; remove any remnants of previous runs SPAWN,rmcmd+'h*.*' ENDIF ELSE BEGIN SPAWN,rmcmd+'t*' SPAWN,rmcmd+'h*' ENDELSE ENDIF SPAWN,gzipcmd+'-v '+tlog(0) ENDIF ELSE MESSAGE,'No temperature log found!',/INFORMATIONAL ENDIF ELSE BEGIN Doc_Library,'plottlog' Return ENDELSE RETURN END