function tostr,value return, strcompress(string(fix(value)),/remove_all) end function chopr, svalue, n if strlen(svalue) lt n then n = strlen(svalue) return, strmid(svalue, strlen(svalue)-n,n) end ; ; Plot out the magnetometer data after remove the baseline (e.g., *.remca) ; PRO plot_remca dirin = '' ext = '' filein = '' linein = '' line = '' smax = 99900. fmt = '(f8.1,3f8.2,1x,e12.4,f9.2,f8.2,f9.2,2f8.2)' read, 'Enter directory of files to process : ',dirin if strmid(dirin,strlen(dirin)-1,1) ne '/' then dirin=dirin+'/' read, 'Enter files to process (example *.remca) : ',ext ndays = 0 read, 'Enter number of days in file : ',ndays dy = fltarr(1441*ndays) hr = fltarr(1441*ndays) mn = fltarr(1441*ndays) bx = fltarr(1441*ndays) by = fltarr(1441*ndays) bz = fltarr(1441*ndays) list = findfile(dirin+ext) print,'total files = ',n_elements(list) psfile='remca_plot.ps' setdevice, psfile, 'l',4,0.9 if n_elements(list) gt 0 then for ll=0,n_elements(list)-1 do begin npt = 0 filein = list(ll) print, 'Reading ',filein close,1 openr,1,filein ; read 5 lines of header readf,1,linein ; print,'linein = ',linein readf,1,linein readf,1,linein readf,1,linein readf,1,linein dy(*)=99999.0 hr(*)=99999.0 mn(*)=99999.0 bx(*) = 99999.0 by(*) = 99999.0 bz(*) = 99999.0 while not eof(1) do begin readf,1,line ; if npt le 10 then print,line yr = strmid(line,0,2) mon = strmid(line,2,2) stat = strmid(line,10,3) dy(npt) = float(strmid(line,4,2)) hr(npt) = float(strmid(line,6,2)) mn(npt) = float(strmid(line,8,2)) bx(npt) = float(strmid(line,17,6)) by(npt) = float(strmid(line,23,6)) bz(npt) = float(strmid(line,29,6)) ; if npt le 10 then print,hr(npt),mn(npt),bx(npt),by(npt) npt = npt + 1 endwhile print,'total data point = ',npt ; total days of data res = 5.0 nday = fix(npt/(288.*res) +0.5) nticks = 4*nday ;plot out the data l1 = strlen(filein) l2 = strlen(dirin) filename=strmid(filein,l2,13) !p.multi= [0,1,3] !y.style=1 !x.style=1 !x.minor=6 !x.ticks=nticks ;!y.minor=10 !x.range=[0,24*nday] print,'nday nticks = ',nday,nticks ticklab = strarr(nticks+1) ticklab(*) = '0' for i=0,nday-1 do begin for j=0,3 do begin ticklab(i*4+j) = strcompress(string(j*6)) endfor endfor day0 = dy(1) plot,(dy(0:npt-1)-day0)*24+hr(0:npt-1)+mn(0:npt-1)/60.,$ bx(0:npt-1),max_value=smax,$ ytitle = 'X-Component (nT)',xtitle='UT (hour)',$ ycharsize=1.5, xcharsize=1.5,$ xtickname=ticklab oplot,[0,24*nday],[0,0],linestyle=2 loc = where(bx(0:npt-1) lt smax,count) if (count) gt 0 then begin av = mean(bx(loc)) oplot,[0,24*nday],[av,av],linestyle=1 endif xyouts,0.07,1.0,filename,size=1.2,/norm name1=strcompress(yr+mon+chopr('0'+tostr(dy(0)),2)+chopr('0'+tostr(hr(0)),2)+$ ':'+ chopr('0'+tostr(mn(0)),2)) name2=strcompress(yr+mon+chopr('0'+tostr(dy(npt-1)),2)+ $ chopr('0'+tostr(hr(npt-1)),2)+':'+ chopr('0'+tostr(mn(npt-1)),2)) name3=strcompress(name1+'-'+name2) xyouts,0.6,1.0,name3,charsize=1.1,/norm plot,(dy(0:npt-1)-day0)*24+hr(0:npt-1)+mn(0:npt-1)/60.,$ by(0:npt-1),max_value=smax,$ ytitle = 'Y-Component (nT)',xtitle='UT (hour)',$ ycharsize=1.5, xcharsize=1.5,$ xtickname=ticklab oplot,[0,24*nday],[0,0],linestyle=2 loc = where(by(0:npt-1) lt smax,count) if (count) gt 0 then begin av = mean(by(loc)) oplot,[0,24*nday],[av,av],linestyle=1 endif plot,(dy(0:npt-1)-day0)*24+hr(0:npt-1)+mn(0:npt-1)/60.,$ bz(0:npt-1),max_value=smax,$ ytitle = 'Z-Component (nT)',xtitle='UT (hour)',$ ycharsize=1.5, xcharsize=1.5,$ xtickname=ticklab oplot,[0,24*nday],[0,0],linestyle=2 loc = where(bz(0:npt-1) lt smax,count) if (count) gt 0 then begin av = mean(bz(loc)) oplot,[0,24*nday],[av,av],linestyle=1 endif endfor device,/close END