pro norh_rd_rdt17,file,rdata,header,event=event ;+ ; NAME: ; NORH_RD_RDT17 ; ; PURPOSE: ; This procedure is for reading the raw data of NoRH. ; ; CALLING SEQUENCE: ; norh_rd_rdt17,file,rdata,header ; norh_rd_rdt17,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 ; by T. Yokoyama 2003.3.7 little endian ;- header={norhhd, $ 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(28248L-633) $ } dt_el={norhdt, $ frame: long(0), $ time: bytarr(8), $ status1: bytarr(2), $ status2: bytarr(6), $ amp_R: intarr(84), $ cor_R: intarr(2,84*83/2), $ ; (Real,Imaginary) * AntPairs amp_L: intarr(84), $ cor_L: intarr(2,84*83/2), $ dummy: bytarr(4) $ } openr,unit,file,/get_lun tmp=FSTAT(unit) filesize=tmp.size n_record=filesize/28248L if keyword_set(event) then begin rdata = replicate( {norhdt} , n_record ) readu,unit,rdata endif else begin rdata = replicate( {norhdt} , 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 free_lun,unit 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_r & byteorder,/ntohs,tmp & rdata.amp_r=tmp tmp=rdata.amp_l & byteorder,/ntohs,tmp & rdata.amp_l=tmp tmp=rdata.cor_r & byteorder,/ntohs,tmp & rdata.cor_r=tmp tmp=rdata.cor_l & byteorder,/ntohs,tmp & rdata.cor_l=tmp endif return end