;+ ; Contains the make_index_files procedure ; ; :Author: ; Laurent Lamy ; ; :History: ; 2006: Created ; ; 2009: Ajout du critère SN>10dB suite au recalcul des N3 avec bonne soustraction ; du fond (cf presentation avant/apres LL). ; ; 2009/06/16: File Created ; ; 2010/10/25: Last Edit ;- ; ;+ ; Calcul des fichiers indices (paramètres codés "en dur", cf thèse LL) ; ; :Uses: ; select_data_n3e_n3d ; ; :Params: ; yyyydddb: in, required, type=sometype ; start date ; hhb: in, required, type=sometype ; start time ; yyyyddde: in, required, type=sometype ; end date ; hhe: in, required, type=sometype ; ent time ; ; :Keywords: ; verbose: in, optional, type=sometype ; Print more info ; source: in, optional, type=sometype ; Radiosource ; antenna_file: in, optional, type=sometype ; name of antenna file to use ; output_path: in, optional, type=sometype ; specify a path other than the default ;- PRO MAKE_INDEX_FILES, yyyydddb,hhb,yyyyddde,hhe, $ verbose=verbose, $ source=source, $ antenna_file=antenna_file, $ output_path=output_path ; ------------------------------------------------------------------------------ ; Data selection criteria: ; ------------------------------------------------------------------------------ vmin = 0.2 ; Min polarization vmax = 1.1 ; Max polarization altmin = 0. ; Min distance above equator altmax = 10. ; Max distance above equator snmin = 10. ; Min S/N in decibel ; ------------------------------------------------------------------------------ ; Testing for keywords: ; ------------------------------------------------------------------------------ if not keyword_set(source) then source='sq' if not keyword_set(antenna_file) then antenna_file='d' case antenna_file of 'calJGR2004' : str_ant = 'j' 'calDec04' : str_ant = 'd' 'rheometry' : str_ant = 'r' else : print,'antenna set possibly uncorrect' endcase ; ------------------------------------------------------------------------------ ; Loading list of files: ; ------------------------------------------------------------------------------ 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 print,"# 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='n3e', $ source=source, antset=str_ant) if (ptr_valid(ptrDataFileList) eq 0) then begin n_n3eDataFile=0 if keyword_set(verbose) then print,"# Warning ! No N3e data file selected..." endif else begin n3eDataFileList=*ptrDataFileList n_n3eDataFile = n_elements(n3eDataFileList) ptr_free,ptrDataFileList endelse ptrDataFileList = make_file_list(yyyydddb, hhb, yyyyddde, hhe, level='n3d', $ source=source, antset=str_ant) if (ptr_valid(ptrDataFileList) eq 0) then begin if keyword_set(verbose) then print,"# Warning ! No N3d data file selected..." endif else begin n3dDataFileList=*ptrDataFileList n_n3dDataFile = n_elements(n3dDataFileList) ptr_free,ptrDataFileList endelse if (n_n3dDataFile ne n_n3eDataFile) then stop,'N3E and N3D Datafile do not have same size!' for i=0l,n_n3eDataFile-1l do begin while strmid(n3eDataFileList(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 N2 file: '+n2DataFileList(i) read_data_binary,n2DataFileList(i),n2t,level='n2' print,'Reading N3e file: '+n3eDataFileList(i) read_data_binary,n3eDataFileList(i),n3e,level='n3e' print,'Reading N3d file: '+n3dDataFileList(i) read_data_binary,n3dDataFileList(i),n3d,level='n3d' print,'merging...' n2 = n2t(n3e.num) ; ------------------------------------------------------------------------------ ; Output data filename: ; ------------------------------------------------------------------------------ period_path = strmid(n3eDataFileList(i),0,strlen(n3eDataFileList(i))-21) str_aj=strmid(n3eDataFileList(i),9,/rev) dataFileOut = 'index/INDEX_'+str_aj if keyword_set(output_path) then dataFileOut = output_path+dataFileOut $ else dataFileOut = period_path+dataFileOut ; ------------------------------------------------------------------------------ ; Data selection and creation of index arrays: ; ------------------------------------------------------------------------------ print,'Creating index file: '+dataFileOut SELECT_DATA_N3E_N3D,n2,n3e,n3d,source,vmin,vmax,snmin,altmin,altmax, $ index,rr,tl,zz,ydf,zdf ; ------------------------------------------------------------------------------ ; Creation of index structure: ; ------------------------------------------------------------------------------ data_index = replicate({data_index},n_elements(n3e)) data_index.ydh = n3e.ydh data_index.num = n3e.num data_index.ind = index data_index.tl = tl data_index.rr = rr data_index.zz = zz data_index.ydf = ydf data_index.zdf = zdf ; ------------------------------------------------------------------------------ ; Writing index: ; ------------------------------------------------------------------------------ print,"% Writing output index into : ",dataFileOut write_data_binary,dataFileOut,data_index endfor ; Update the Kronos Database with the new files spawn, [getenv('ROOT_RPWS') + '/pro/kronosdb/upsert.sh', '-l', 'index', string(format='(I7)', yyyydddb), string(format='(I7)', yyyyddde)], /NOSHELL return end