;***************************************************************** ;* make_vmono_as_gup.pro ;* ;* KST/ESR ;* iesr=1 ; 1:ESR or 2:KST ;* ;* set mono.dat ;* for ESR monoesr.date ;* E-field also ;* The original file is make_E_as.pro dated on July 15, 1999 ;* ;* Version 1.0 July 17, 1999 Made ;* 1.1 Dec 8, 1999 one altitude data for CP-2 ;* 2.0 Sep 2, 2000 ext2,read_date_dat is changed ;****************************************************************** ; If you want to fill data gaps of E-file (with height), ; please use make_vmono_as_gup2.pro ; pro print_proname,proname date='September 2, 2000:v2.0 ' & s='-----' & s2=' ' print,' ' & print,s,s2,proname,s2,date,s2,s & print,' ' end pro read_date_dat,date,ext2 date=0l & openr,1,'mono.date' print,'----- Open (r) = mono.date -----' readf,1,format='(I6)',date ext2='no' if EOF(1) ne 1 then readf,1,ext2 close,1 end function its,i s=strcompress(string(i),/REMOVE_ALL) & return,s end ; for ESR pro readf_date,sdate0 common ext,ext2,aclp ; July 26, 2000 sdate0='123456' openr,1,'monoesr.date' & readf,1,format='(a6)',sdate0 ext2='no' if EOF(1) ne 1 then readf,1,ext2 close,1 i=strpos(ext2,'LP') if i ne -1 then aclp='long' else aclp='short' end pro read_emono_gup,sdate0,ext2,path,cp,n1,n2,$ time_mono,alt_mono,q_mono,E_mono,Eerrmono,Ne_mono,Neerr_mono filename='Emono'+sdate0+cp+'.gdat' if ext2 ne 'no' then filename='Emono'+sdate0+cp+ext2+'.gdat' openr,1,path+filename & print,'----- Open (r) = ',path+filename n1=0l & n2=0l & readu,1,n1,n2 & print,format='(A12,2I4)','Time, alt = ',n1,n2 time_mono=intarr(n1) & alt_mono=intarr(n2,n1) q_mono=intarr(n2,n1) & E_mono=fltarr(3,n2,n1) Ne_mono=intarr(n2,n1) & Eerrmono=E_mono & Neerr_mono=Ne_mono readu,1,time_mono,alt_mono,q_mono,E_mono,Ne_mono,Eerrmono,Neerr_mono close,1 end function check_err_val,fac,Verr fac2=fac tmp=where(Verr lt 0,n) if n ne 0 then fac2=1.0 return,fac2 end function hhmm2min,hhmm i=(hhmm/100)*60 + (hhmm mod 100) return,i end ; ; ipulse = 1:short 2:long 3:E-field ; pro make_vmono_as_routine,sdate0,das,dat,cp,pul,ipulse,time_mono,$ alt_mono,q_mono,v_mono,verrmono,iesr common ext,ext2,aclp ; Ausut 29, 2000 case ipulse of 1:o0='vmono'+sdate0+cp 2:o0='vmono'+sdate0+cp 3:o0='Emono'+sdate0+cp 4:o0='umono'+sdate0+cp 5:o0='Emono'+sdate0+cp endcase if ipulse eq 1 then o0=o0+pul(ipulse-1) outfile=o0+das if ext2 ne 'no' then outfile=o0+ext2+das if iesr eq 1 then begin case ipulse of 1:outfile='vmono'+sdate0+cp+'esr'+das 2:stop 3:outfile='Emono'+sdate0+cp+'esr'+das 4:outfile='umono'+sdate0+cp+das 5:outfile='Emono'+sdate0+cp+'l_esr'+das endcase if ext2 ne 'no' then begin case ipulse of 1:outfile='vmono'+sdate0+cp+'esr'+ext2+das 2:stop 3:outfile='Emono'+sdate0+cp+'l_esr'+ext2+das 4:outfile='umono'+sdate0+cp+ext2+das 5:outfile='Emono'+sdate0+cp+'l'+ext2+'_esr'+das endcase endif endif openw,1,outfile print,'----- Open (w) = ',outfile date0=fix(long(sdate0) mod 10000) date=date0 + (time_mono /2400) ;;!!! future work is neccesary when over end of month. time=time_mono mod 2400 str0='(2I5,I4,I3,6F9.1)' str1='format='+str0 case ipulse of 1:com1='Ion velocity (m/s)' 2:com1='Ion velocity (m/s)' 3:com1='E-field (mV/m)' 4:com1='Neutral wind (m/s)' 5:com1='E-field (mV/m)' endcase case ipulse of 1:com2='dV' 2:com2='dV' 3:com2='dE' 4:com2='dV' 5:com2='dE' endcase if ipulse eq 3 or ipulse eq 5 then fac=1000.0 else fac=1.0 printf,1,com1+' in geographic coordinate: '+str1 if iesr ne 1 then $ printf,1,'Based on CP-2, whose cycle time is 6-minutes for scanning 4 antenna positions.' if iesr eq 1 then $ printf,1,'Based on CP-2, whose cycle time is 8-minutes for scanning 4 antenna positions.' printf,1,'Data with q eq 0 and errors (= '+com2+') ne -32768 may be used.' printf,1,'Time is in UT. Alt (= altitude) is in km.' ;printf,1,' Date Time Alt q North East Down dVnorth dVeast dVdown' ; 12345123451234123123456789123456789123456789123456789123456789123456789 printf,1,' Date Time Alt q North East Down '+com2+'north '+com2+'east '+$ com2+'down' n1=n_elements(time) n2=n_elements(alt_mono(*,0)) for itime=0,n1-1 do begin ; Loop of time alt=reform(alt_mono(*,itime)) d1=date(itime) & t1=time(itime) if (itime mod 100) eq 0 then print,format='(I4,2I5)',itime,d1,t1 for ialt=0,n2-1 do begin ; Loop of alt Vxyz=reform(v_mono(*,ialt,itime))*fac Verr=reform(verrmono(*,ialt,itime)) fac2=check_err_val(fac,Verr) Verr=Verr*fac2 q=q_mono(ialt,itime) a1=alt(ialt) printf,1,format=str0,d1,t1,a1,q,Vxyz,Verr endfor JJ1: endfor close,1 end pro reform_earr,ialt,alt,q,v,verr,Ne0,Neerr n=n_elements(alt(0,*)) alt3=intarr(1,n) & q3=intarr(1,n) v3=fltarr(3,1,n) & verr3=fltarr(3,1,n) Ne3=intarr(1,n) & Neerr3=intarr(1,n) for i=0,n-1 do begin a=reform(alt(*,i)) dalt=abs(a-ialt) k=min(dalt,l) if i eq 0 then tmp=l else tmp=[tmp,l] alt3(0,i)=(alt(l,i)) q3(0,i)=(q(l,i)) v3(*,0,i)=reform(v(*,l,i)) verr3(*,0,i)=reform(verr(*,l,i)) Ne3(0,i)=(Ne0(l,i)) Neerr3(0,i)=(Neerr(l,i)) endfor alt=alt3 q=q3 v=v3 verr=verr3 Ne0=Ne3 Neerr=Neerr3 end pro check_error_umonoesr,verrmono k1=n_elements(verrmono(0,0,*)) k2=n_elements(verrmono(0,*,0)) for k=0,k1-1 do begin for k3=0,k2-1 do begin v=verrmono(*,k3,k) tmp=where(abs(v) gt 30000,k4) if k4 ne 0 then verrmono(*,k3,k)= -32768 endfor endfor end function set_vmono_esr,i1,i2,qmono q_mono=intarr(i1,i2) for i1loop=0,i1-1 do begin for i2loop=0,i2-1 do begin a=fix(total(qmono(*,i1loop,i2loop))) if a lt 0 then a=9 q_mono(i1loop,i2loop)=a endfor endfor return,q_mono end ;************************************************************* ; Main, main ; ;************************************************************* common CP,cpname,ist,iet,nday,time,ver,sdate1,date common ext,ext2,aclp ; Ausut 29, 2000 proname='make_vmono_as_gup.pro' & print_proname,proname iEf=1 ; cp='cp2' iesr=1 ; 1:ESR or 2:KST ipulse=1 ; 1:short pulse | 2:longpulse | 3:E-field | 4:wind ; 5:E-field only one height ("ialt") ialt=278 ; when ipulse=5, then it is effective path='./' & pul=['s',' '] igup=1 ; In future, it might be useful for ND data. if iesr eq 2 then begin read_date_dat,date,ext2 sdate0=its(date) endif if iesr eq 1 then readf_date,sdate0 if igup then das='.gdas' ; ion velocity if (ipulse eq 1 or ipulse eq 2) and iesr ne 1 then $ read_vmono_gup,ipulse,sdate0,ext2,path,cp,n1,n2,$ time_mono,alt_mono,q_mono,v_mono,verrmono,Ne_mono,Neerr_mono,readfile if ipulse eq 1 and iesr eq 1 then begin read_vmono_esr,sdate0,i1,i2,t,v_mono,verrmono,alt,alt2,vmonoorg,verrmonoorg,qmono,$ latmono_all,lonmono_all,Nemono_all,Neerrmono_all q_mono=set_vmono_esr(i1,i2,qmono) alt_mono=intarr(i1,i2) ;alt_mono(*,*)=reform(alt2(0,*,*)) for i=0,i2-1 do alt_mono(*,i)=(alt(*)+0.5) time_mono=(t/60)*100 + (t mod 60) endif if ipulse eq 2 and iesr eq 1 then stop ; wind if ipulse eq 4 then begin case iesr of 1:read_umono_esr,sdate0,path,n1,n2,t,alt_mono,q_mono,v_mono,verrmono else:begin cpext2=cp & if ext2 ne 'no' then cpext2=cp+ext2 read_umono_gup,sdate0,path,cpext2,n1,n2,$ time_mono,alt_mono,q_mono,v_mono,verrmono,Ne_mono,Neerr_mono end endcase if iesr eq 1 then begin time_mono=(t/60)*100 + (t mod 60) cp='esr' check_error_umonoesr,verrmono endif endif ; E-field if iesr eq 1 and ipulse eq 5 then cp2=cp+'l_esr' if ipulse eq 3 or ipulse eq 5 then begin case iesr of 1:begin cpl=cp+'l' if ext2 ne 'no' then cpl=cp+'l'+ext2 read_emono_esr,sdate0,path,cpl,t,altE,q_mono0,v_mono0,verrmono0 end else:read_emono_gup,sdate0,ext2,path,cp,n1,n2,$ time_mono,alt_mono,q_mono,v_mono,verrmono,Ne_mono,Neerr_mono endcase if iesr eq 1 then begin time_mono=(t/60)*100 + (t mod 60) ntime=n_elements(time_mono) alt_mono=fltarr(1,ntime) q_mono=intarr(1,ntime) v_mono=fltarr(3,1,ntime) verrmono=fltarr(3,1,ntime) alt_mono(0,*)=altE v_mono(*,0,*)=v_mono0(*,*) tmp=where(q_mono0 le -10,ntmp) if ntmp ne 0 then q_mono0(tmp)=-9 q_mono(0,*)=q_mono0(*) verrmono(*,0,*)=verrmono0(*,*) endif ; ; no data for Ne ; Ne_mono=q_mono ; Neerr_mono=q_mono endif if iesr ne 1 and ipulse eq 5 then $ reform_earr,ialt,alt_mono,q_mono,v_mono,verrmono,Ne_mono,Neerr_mono ;make_vmono_as_routine,sdate0,das,dat,cp+pul(ipulse-1),time_mono,alt_mono,$ make_vmono_as_routine,sdate0,das,dat,cp,pul,ipulse,time_mono,alt_mono,$ q_mono,v_mono,verrmono,iesr end