pro norp_rd_dat,file,mvalid,time,fi,fv,freq $ ,rdfreq=rdfreq,timerange=timerange,usewk=usewk,dir=dir $ ,nocalib=nocalib,readraw=readraw,rdata=rdata $ ,calib1g=calib1g,calib2g=calib2g,calib4g=calib4g $ ,calib9g=calib9g,calib17=calib17,calib35=calib35 $ ,firaw1g=firaw1g,fvraw1g=fvraw1g,npa1g=npa1g,stat1g=stat1g $ ,firaw2g=firaw2g,fvraw2g=fvraw2g,npa2g=npa2g,stat2g=stat2g $ ,firaw4g=firaw4g,fvraw4g=fvraw4g,npa4g=npa4g,stat4g=stat4g $ ,firaw9g=firaw9g,fvraw9g=fvraw9g,npa9g=npa9g,stat9g=stat9g $ ,firaw17=firaw17,fvraw17=fvraw17,npa17=npa17,stat17=stat17 $ ,firaw35=firaw35,fvraw35=fvraw35,npa35=npa35,stat35=stat35 $ ,npa80=npa80,stat80=stat80 ;+ ; NAME: ; NORP_RD_DAT ; ; PURPOSE: ; This procedure is for reading and calibrating the NoRP data. ; ; CALLING SEQUENCE: ; norp_rd_dat,file,mvalid,time,fi,fv ; ; INPUTS: ; file: file name of NoRP data ; ; OPTIONAL INPUT KEYWORDS: ; rdfreq: 7-elements byte array indicating the data to be read. ; If rdfreq(0)=1, 1GHz data will be read. ; If rdfreq(1)=1, 2GHz data will be read. ; If rdfreq(2)=1, 4GHz data will be read. ; If rdfreq(3)=1, 9GHz data will be read. ; If rdfreq(4)=1, 17GHz data will be read. ; If rdfreq(5)=1, 35GHz data will be read. ; If rdfreq(6)=1, 80GHz data will be read. ; If NOT given, ALL data will be read. ; timerange: 2-elements string array indicating the ; time range of the data to be read ; e.g. ['1998-1-1 4:00','1998-1-1 5:00'] ; ; OUTPUTS: ; mvalid: byte array indicating the data is valid or not. ; e.g. if the data(123) obtained at time(123) ; was the calibration data mvalid(123)=0. ; If the data(124) was the real Sun flux mvalid(124)=1. ; time: structure array with 'time internal format'. Time is in UT. ; fi: I (R+L) data array (mfreq,ndata) ; data(0,*) is the time-sequencial array of the 1st ; frequency which are read (indicated by 'rdfreq'). ; fv: V (R-L) data array (mfreq,ndata) ; ; HISTORY: ; programmed by T. Kosugi in 1984 May as Fortran program ; for old NoRP data format ; re-programmed by H.Sekiguchi 1987 July - 1988 Dec. ; ; 1995 July,20 N,Shinox for new format NoRP data ; 95.04.19 ed. add ATT correction for pol data ,correction data type ; changed intarr() to fltarr()., ; 95.09.04 Ver.2.0 M. Nishio and K. Hori ; 95.11.10 Ver.3.0 M. Nishio refernce level at 9.4GHz= amb -> zero ; <> ; 95.12.12 Ver.3.1 M. Nishio and K. Shibasaki (1GHz ATT 7dB -> 4.3) ; 98.09.03 sekix & shinox add 80GHz ; 98.11.20 K. Hori ; 1999-1-12 TY unify program for old/new NoRP data ; 1999-3-12 TY calibration data option ; 2000-4-11 TY add freq ; 2001-5-8 TY to read npa and stat ; ;- print,file if (strpos(file,'pl') eq -1) then begin ; 'file' is date day=file ex=anytim(day,/ex) yyyy=reform(ex(6,*)) mm=reform(ex(5,*)) dd=reform(ex(4,*)) yy=yyyy-yyyy/100*100 yymmdd=$ string(transpose([[yy],[mm],[dd]]),format="(i2.2,i2.2,i2.2)") year=strtrim(string(yyyy),2) files='pl'+yymmdd+'*' if not keyword_set(dir) then begin if keyword_set(usewk) then begin dir=getenv('NORP_DWK') endif else begin dir0=getenv('NORP_RAW') dir=[dir0+'/'+year+'/'+string(mm,format="(i2.2)")] endelse endif infil=file_list(dir,files) endif else begin infil=file endelse infil=infil(0) if (n_elements(infil) eq 1) then begin if (infil(0) eq '') then begin print,'No files found' mvalid=-1 return endif endif norp_rd_rdt,infil,rdata,date,version timejo=norp_rdt2timej(rdata,date) if keyword_set(readraw) then begin timej=timejo time=anytim2ints(timej,offset=-9.*60.*60) return endif ndata=lonarr(2) ndata(0)=0 & ndata(1)=n_elements(timejo)-1 if n_elements(timerange) eq 2 then begin timejrange=anytim2ints(anytim(timerange,/yohkoh),offset=9.*60*60) norp_gt_ndata,timejrange,timejo,ndata endif ndx=ndata(1)-ndata(0)+1 if (ndata(0) ge ndata(1)) then begin print,'No data is available in this duration' mvalid=-1 return endif timej=timejo(ndata(0):ndata(1)) time=anytim2ints(timej,offset=-9.*60.*60) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if not keyword_set(rdfreq) then rdfreq=bytarr(7)+1b if version eq 0 then rdfreq(0:3)=0 ;rdfreq(6)=0b ; expire 80 GHz freq_all=[1,2,3.75,9.4,17,35,80] whr=where(rdfreq ne 0,mfreqx) freq=freq_all(whr) fi=fltarr(mfreqx,ndx) fv=fltarr(mfreqx,ndx) mvalid=bytarr(mfreqx,ndx) mfreq=-1 if rdfreq(0) then begin norp_rdt2data_1g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib1g,firaw=firaw1g,fvraw=fvraw1g,npa=npa1g,stat=stat1g mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(1) then begin norp_rdt2data_2g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib2g,firaw=firaw2g,fvraw=fvraw2g,npa=npa2g,stat=stat2g mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(2) then begin norp_rdt2data_4g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib4g,firaw=firaw4g,fvraw=fvraw4g,npa=npa4g,stat=stat4g mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(3) then begin norp_rdt2data_9g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib9g,firaw=firaw9g,fvraw=fvraw9g,npa=npa9g,stat=stat9g mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(4) then begin norp_rdt2data_17g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib17,firaw=firaw17,fvraw=fvraw17,npa=npa17,stat=stat17 mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(5) then begin norp_rdt2data_35g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,calibration=calib35,firaw=firaw35,fvraw=fvraw35,npa=npa35,stat=stat35 mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif if rdfreq(6) then begin norp_rdt2data_80g,rdata,timejo,mvalid0,fi0,fv0,ndata=ndata,nocalib=nocalib $ ,npa=npa80,stat=stat80 mfreq=mfreq+1 fi(mfreq,*)=fi0 fv(mfreq,*)=fv0 mvalid(mfreq,*)=mvalid0 endif return end