;+ ; Contains the read_data_n3g procedure ; ; :Author: ; Baptiste Cecconi ; ; :History: ; 2009/11/24: Created ; ; 2009/11/24: Last Edit ;- ; ;+ ; read_data_n3g is a procedure that <behavior desc here> ; ; :Params: ; file: in, required, type=sometype ; A parameter named file ; data: in, required, type=sometype ; A parameter named data ;- PRO read_data_N3g,file,data ; level 3g data structure definition ; (see data_n3g__define) data = {data_N3g} ; size of 1 record of the structure : ;nbytesdata = n_tags(data, /data_length) ; works only on IDL 5.6 nbytesdata = 16b ; opening binary data file : ; (swapping byte order if CPU is big endian) openr,lun,file,/get_lun,/swap_if_big_endian ; number of records in the file : s = fstat(lun) ndata = s.size/nbytesdata ; checking if file length is consistent with single record length if long(ndata)*long(nbytesdata) ne s.size then $ print,'>>> WARNING : you may be using a wrong binary data format !!! <<<' ; final data structure definition : data = replicate(data,ndata) ; reading data : readu,lun,data ; closing close,lun free_lun,lun return end