pro norh_rd_rdt34,file,rdata,header,event=event ;+ ; NAME: ; NORH_RD_RDT34 ; ; PURPOSE: ; This procedure is for reading the raw data of NoRH. ; ; CALLING SEQUENCE: ; norh_rd_rdt34,file,rdata,header ; norh_rd_rdt34,file,rdata,/event ; ; INPUTS: ; file: file name of NoRH raw data ; ; OPTIONAL INPUT KEYWORDS: ; event; set when the input is an 'event' file. ; In case of 'event' file, no header is returned. ; ; OUTPUTS: ; rdata: structure of the raw data ; header: header of the data ; ; HISTORY: ; by T. Yokoyama 2000.6.15 ; by T. Yokoyama 2003.2.28 event keyword ;- header={norhhd34, $ date: ' ', $ fstatus: ' ', $ ; 1:with data drop, 2:without data drop dummy: byte(0), $ st_frame: long(0), $ ed_frame: long(0), $ st_time: ' ', $ ed_time: ' ', $ flag: strarr(600)+' ', $ ; 0:NoData, 1:Calib, 2:Data, 3:EventData fnl_frame: long(0), $ fnl_flag: ' ', $ rfu: bytarr(14136L-633) $ } dt_el={norhdt34, $ frame: long(0), $ time: bytarr(8), $ status1: bytarr(2), $ status2: bytarr(6), $ amp: intarr(84), $ cor: intarr(2,84*83/2), $ ; (Real,Imaginary) * AntPairs dummy: bytarr(4) $ } openr,unit,file,/get_lun tmp=FSTAT(unit) filesize=tmp.size n_record=filesize/14136L rdata = replicate( {norhdt34} , n_record-1 ) if keyword_set(event) then begin rdata = replicate( {norhdt34} , n_record ) readu,unit,rdata endif else begin rdata = replicate( {norhdt34} , n_record-1 ) readu,unit,header readu,unit,rdata if ((!version.arch eq 'x86') or (!version.arch eq 'x86_64'))then begin ; swap endian tmp=header.st_frame & byteorder,/ntohl,tmp & header.st_frame=tmp tmp=header.ed_frame & byteorder,/ntohl,tmp & header.ed_frame=tmp tmp=header.fnl_frame & byteorder,/ntohl,tmp & header.fnl_frame=tmp endif endelse if ((!version.arch eq 'x86') or (!version.arch eq 'x86_64'))then begin ; swap endian tmp=rdata.frame & byteorder,/ntohl,tmp & rdata.frame=tmp tmp=rdata.amp & byteorder,/ntohs,tmp & rdata.amp=tmp tmp=rdata.cor & byteorder,/ntohs,tmp & rdata.cor=tmp endif free_lun,unit return end