PRO load_data_n3edil,yyyydddb,hhb,yyyyddde,hhe, $
n1,n2,n3d,n3e,index,loc, $
snx=snx, snz=snz, $
verbose=verbose, source=source, mfl_model=mfl_model
if ~keyword_set(mfl_model) then mfl_model='SPV'
ptrDataFileList = make_file_list(yyyydddb, hhb, yyyyddde, hhe, level='n1')
if (ptr_valid(ptrDataFileList) eq 0) then begin
n_n1DataFile=0
if keyword_set(verbose) then message,/info,"# Warning ! No N1 data file selected..."
endif else begin
n1DataFileList=*ptrDataFileList
n_n1DataFile = n_elements(n1DataFileList)
ptr_free,ptrDataFileList
endelse
ptrDataFileList = make_file_list(yyyydddb, hhb, yyyyddde, hhe, level='n2')
if (ptr_valid(ptrDataFileList) eq 0) then begin
n_n2DataFile=0
if keyword_set(verbose) then message,/info,"# Warning ! No N2 data file selected..."
endif else begin
n2DataFileList=*ptrDataFileList
n_n2DataFile = n_elements(n2DataFileList)
ptr_free,ptrDataFileList
endelse
ptrDataFileList = make_file_list(yyyydddb, hhb, yyyyddde, hhe, level='n3d', source=source, antset='d')
if (ptr_valid(ptrDataFileList) eq 0) then begin
n_n3dDataFile=0
if keyword_set(verbose) then message,/info,"# Warning ! No N3d data file selected..."
endif else begin
n3dDataFileList=*ptrDataFileList
n_n3dDataFile = n_elements(n3dDataFileList)
ptr_free,ptrDataFileList
endelse
ptrDataFileList = make_file_list(yyyydddb, hhb, yyyyddde, hhe, level='n3e', source=source, antset='d')
if (ptr_valid(ptrDataFileList) eq 0) then begin
n_n3eDataFile=0
if keyword_set(verbose) then message,/info,"# Warning ! No N3e data file selected..."
endif else begin
n3eDataFileList=*ptrDataFileList
n_n3eDataFile = n_elements(n3eDataFileList)
ptr_free,ptrDataFileList
endelse
if n_n1DataFile*n_n2DataFile*n_n3dDataFile*n_n3eDataFile eq 0 then return
indexDataFileList = strarr(n_n2DataFile)
locDataFileList = strarr(n_n2DataFile)
for ifile=0L,n_n2DataFile-1L do begin
str1 = strmid(n2DataFileList(ifile),0,strpos(n2DataFileList(ifile),'n2/P'))
str2 = strmid(n2DataFileList(ifile),strpos(n2DataFileList(ifile),'n2/P')+4)
indexDataFileList(ifile) = str1+'index/INDEX_'+str2
locDataFileList(ifile) = str1+'loc/loc_'+mfl_model+'_'+str2
endfor
nn = 0l
for i=0l,n_n3dDataFile-1l do begin
ndata=1l
read_data_binary,n3dDataFileList(i),ndata,/ndata,level='n3d'
nn = nn+ndata
endfor
if nn ne 0l then begin
print,'Creating data structures ('+string(nn)+' elements)'
n1 = replicate({data_n1},nn)
n2 = replicate({data_n2},nn)
n3d = replicate({data_n3d},nn)
n3e = replicate({data_n3e},nn)
index = replicate({data_index},nn)
loc = replicate({data_loc},nn)
ii0 = 0l
for i=0l,n_n3dDataFile-1l do begin
while strmid(n3dDataFileList(i),9,/rev) ne strmid(n2DataFileList(i),9,/rev) do begin
if i eq 0 then n2DataFileList=n2DataFileList(1:*) else $
n2DataFileList=[n2DataFileList(0:i-1),n2DataFileList(i+1:*)]
n_n2DataFile = n_n2DataFile-1
endwhile
print,'-------------------------------------------------------------------'
print,'Reading N1 file: '+n1DataFileList(i)
read_data_binary,n1DataFileList(i),n1t,level='n1'
print,'Reading N2 file: '+n2DataFileList(i)
read_data_binary,n2DataFileList(i),n2t,level='n2'
print,'Reading N3d file: '+n3dDataFileList(i)
read_data_binary,n3dDataFileList(i),n3dt,level='n3d'
print,'Reading N3e file: '+n3eDataFileList(i)
read_data_binary,n3eDataFileList(i),n3et,valid,level='n3e'
print,'Reading INDEX file: '+indexDataFileList(i)
read_data_binary,indexDataFileList(i),indt,level='index'
print,'Reading LOC file: '+locDataFileList(i)
if n_elements(n3et) eq 1 then loct=[{data_loc}] else begin
read_data_binary,locDataFileList(i),loct,level='loc'
print,'merging...'
endelse
if valid then begin
ii1 = ii0 +n_elements(n3dt)
n1(ii0:ii1-1) = n1t(n3dt.num)
n2(ii0:ii1-1) = n2t(n3dt.num)
n3d(ii0:ii1-1) = n3dt
n3e(ii0:ii1-1) = n3et
index(ii0:ii1-1) = indt
loc(ii0:ii1-1) = loct
ii0 = ii1
endif
endfor
endif else begin
print,'No data for the selected period'
n1={data_n1}
n2={data_n2}
n3d={data_n3d}
n3e={data_n3e}
index={data_index}
loc={data_loc}
endelse
snx = 10.*alog10(n3e.sn(0)>0.01)
snz = 10.*alog10(n3e.sn(1)>0.01)
return
end