;+ ; Contains the make_loc_files procedure ; ; :Author: ; Baptiste Cecconi ; ; :History: ; 2008/11: Created (LL) ; ; 2009/04/22: File Created ; ; 2011/05/03: Last Edit ;- ; ;+ ; Procédure de calcul des fichiers loc 2- ou 3-antennes (mot-clef ant_set='...') ; et loc_error (mot_clef /loc_error) 2- ou 3-antennes avec les sélections ; spécifiées (tmin,tmax,rsmax,latmin,latmax,mfl_model,source,n_error) ; ; :Uses: ; extract_ephem, localization_3a, localization, make_localization_error_3a, make_localization_error ; ; :Params: ; tb: in, required, type=sometype ; A parameter named tb ; hb: in, required, type=sometype ; A parameter named hb ; te: in, required, type=sometype ; A parameter named te ; he: in, required, type=sometype ; A parameter named he ; ; :Keywords: ; rsmax: in, optional, type=sometype ; A keyword named rsmax ; latmin: in, optional, type=sometype ; A keyword named latmin ; latmax: in, optional, type=sometype ; A keyword named latmax ; mfl_model: in, optional, type=sometype ; A keyword named mfl_model ; source: in, optional, type=sometype ; A keyword named source ; n_error: in, optional, type=sometype ; A keyword named n_error ; ant_set: in, optional, type=sometype ; A keyword named ant_set ; loc_error: in, optional, type=sometype ; A keyword named loc_error ; reload: in, optional, type=sometype ; Les fichiers existants ne sont pas recalculés sauf si mot-clef /reload ; output_path: in, optional, type=sometype ; A keyword named output_path ;- PRO MAKE_LOC_FILES,tb,hb,te,he,rsmax=rsmax,latmin=latmin,latmax=latmax,$ mfl_model=mfl_model,source=source,n_error=n_error,$ ant_set=ant_set,loc_error=loc_error,reload=reload,$ output_path=output_path EXTRACT_EPHEM,tb,te,t,lat,tl,rs tmin=aj_t97(tb) & tmax=aj_t97(te) if tmin gt tmax then print,'Enter correct period' if ~keyword_set(rsmax) then rsmax=max(rs) if ~keyword_set(latmin) then latmin=0. if ~keyword_set(latmax) then latmax=max(abs(lat)) if ~keyword_set(ant_set) then ant_set='2-ant' if ~keyword_set(mfl_model) then mfl_model='SPV' if ~keyword_set(source) then source='sq' if ~keyword_set(n_error) then n_error=8 if keyword_set(output_path) then valid_output_path=1 else valid_output_path=0 w=where(rs le rsmax and abs(lat) ge latmin and abs(lat) le latmax) if w(0) ne -1 then begin t=t(w) & rs=rs(w) & lat=lat(w) & tl=tl(w) tt=uniq_list(long(t)) for i=0,n_elements(tt)-1l do begin ww=where(long(t) eq tt(i),count) if ww(0) ne -1 then begin h1=long((t(ww(0))-tt(i))*24) h2=long((t(ww(count-1l))-tt(i))*24)+1 if i eq 0 then h1=hb if i eq n_elements(tt)-1l then h2=he p = make_file_list(t97_aj(tt(i)),h1,t97_aj(tt(i)),h2,level='n3e',source='sq') if ptr_valid(p) then begin nfiles = n_elements(*p) day = long(strmid(*p,9,7,/rev)) hour = long(strmid(*p,1,2,/rev)) ; Calcul des LOC: path = strarr(nfiles) for j=0,nfiles-1 do path(j) = strmid((*p)(j),0,strpos((*p)(j),'/',/reverse_search)-3)+'loc/'+$ 'loc_'+mfl_model+'_'+strmid((*p)(j),9,7,/rev)+'.'+strmid((*p)(j),1,2,/rev) path_3a = strarr(nfiles) for j=0,nfiles-1 do path_3a(j) = strmid((*p)(j),0,strpos((*p)(j),'/',/reverse_search)-3)+'loc/'+$ 'loc_3A_'+mfl_model+'_'+strmid((*p)(j),9,7,/rev)+'.'+strmid((*p)(j),1,2,/rev) ;if valid_output_path eq 0 then output_path=strmid(path(0),0,36) if valid_output_path eq 0 then output_path=strmid(path(0),0,47) if ant_set eq '2-ant' then begin if keyword_set(reload) then begin for k=0,n_elements(day)-1l do LOCALIZATION,day(k),hour(k),mfl_model=mfl_model,$ /verb,output_path=output_path endif else begin wload = where(file_test(path) eq 0) if wload(0) ne -1 then begin for k=0,n_elements(wload)-1l do LOCALIZATION,day(wload(k)),hour(wload(k)),mfl_model=mfl_model,$ /verb,output_path=output_path endif else print,strtrim(day(0),1),': Loc 2A already computed' endelse endif if ant_set eq '3-ant' then begin if keyword_set(reload) then begin for k=0,n_elements(day)-1l do LOCALIZATION_3A,day(k),hour(k),mfl_model=mfl_model,$ /verb,output_path=output_path endif else begin wload = where(file_test(path_3a) eq 0) if wload(0) ne -1 then begin for k=0,n_elements(wload)-1l do LOCALIZATION_3A,day(wload(k)),hour(wload(k)),mfl_model=mfl_model,$ /verb,output_path=output_path endif else print,strtrim(day(0),1),': Loc 3A already computed' endelse endif ; Calcul des LOC_ERROR: if keyword_set(loc_error) then begin path_err = strarr(nfiles) for j=0,nfiles-1 do path_err(j) = strmid((*p)(j),0,strpos((*p)(j),'/',/reverse_search)-3)+'loc/'+$ 'loc_err_'+mfl_model+'_n08_'+strmid((*p)(j),9,7,/rev)+'.'+strmid((*p)(j),1,2,/rev) path_err_3a = strarr(nfiles) for j=0,nfiles-1 do path_err_3a(j) = strmid((*p)(j),0,strpos((*p)(j),'/',/reverse_search)-3)+'loc/'+$ 'loc_err_3A_'+mfl_model+'_n08_'+strmid((*p)(j),9,7,/rev)+'.'+strmid((*p)(j),1,2,/rev) if ant_set eq '2-ant' then begin if keyword_set(reload) then begin for k=0,n_elements(day)-1l do MAKE_LOCALIZATION_ERROR,day(k),hour(k),day(k),hour(k)+1,n_error=n_error,$ mfl_model=mfl_model,source=source,output_path=output_path endif else begin wload = where(file_test(path_err) eq 0) if wload(0) ne -1 then begin for k=0,n_elements(wload)-1l do MAKE_LOCALIZATION_ERROR,day(wload(k)),hour(wload(k)),day(wload(k)),hour(wload(k))+1,$ n_error=n_error,mfl_model=mfl_model,source=source,output_path=output_path endif else print,strtrim(day(0),1),': Loc_error 2A already computed' endelse endif if ant_set eq '3-ant' then begin if keyword_set(reload) then begin for k=0,n_elements(day)-1l do MAKE_LOCALIZATION_ERROR_3A,day(k),hour(k),day(k),hour(k)+1,n_error=n_error,$ mfl_model=mfl_model,source=source,output_path=output_path endif else begin wload = where(file_test(path_err_3a) eq 0) if wload(0) ne -1 then begin for k=0,n_elements(wload)-1l do MAKE_LOCALIZATION_ERROR_3A,day(wload(k)),hour(wload(k)),day(wload(k)),hour(wload(k))+1,$ n_error=n_error,mfl_model=mfl_model,source=source,output_path=output_path endif else print,strtrim(day(0),1),': Loc_error 3A already computed' endelse endif endif endif else print,'** Warning: Day'+strtrim(string(t97_aj(tt(i))),1)+' , N3E data missing **' endif endfor endif ; Update the Kronos Database with the new files spawn, [getenv('ROOT_RPWS') + '/pro/kronosdb/upsert.sh', '-l', 'loc', string(format='(I7)', tb), string(format='(I7)', te)], /NOSHELL end