FUNCTION xrt_syncomp_unc, syn_ind, l0dir=l0dir ; ========================================================================= ;+ ; PROJECT: ; Solar-B / XRT ; ; NAME: ; XRT_SYNCOMP_UNC ; ; CATEGORY: ; Data calibration ; ; PURPOSE: ; Calculate uncertainty map of a synoptic composite image, ; processed by MK_XRT_COMPOSITE.PRO or MK_XRT_COMP3.PRO. ; This function returns a composite uncertainty array ; from the original level0 data for short/(medium)/long ; exposures according to their contribution to the ; input composite image. ; ; CALLING SEQUENCE: ; uncert_arr=xrt_syncomp_unc(syn_ind, l0dir=l0dir) ; ; INPUTS: ; SYN_IND - [Mandatory] ; 1-dimensional index structure of a synoptic composite ; data (level2). It is assumed this index structure ; has the HISTORY tag containing the DATE_OBS info ; of the original short/(medium)/long exposure images. ; ; KEYWORDS: ; ; L0_DIR - [Optional] [default=''] ; Sting for the location(full path directory) of the ; level0 data. ; ; OUTPUTS: ; UNCERT_ARR - [Nx,Ny] float array of the composited uncertainty. ; ; EXAMPLES: ; ; When $XRT_DATA is available for the level0 data location: ; IDL> unc_array=xrt_syncomp_unc(syn_index) ; IDL> wdef,0,1024,1024 ; IDL> tvscl, xrtdisp(unc_array, /log) ; ; Manually specify the level0 data location: ; IDL> level0_dir='/disk/data/HINODE/xrt/level0/2012/03/03/H0600/' ; IDL> unc_array=xrt_syncomp_unc(syn_index, l0dir=level0_dir) ; ; COMMON BLOCKS: ; None. ; NOTES: ; Requires the original level0 data (from which the synoptic ; composite is processed) for calculation. ; The latest synoptic composite index structure contains the ; DATE_OBS value of the short/(medium/)long exposure images ; in the HISTORY tag. This function derives the level0 file ; name from the DATE_OBS info, calculate the uncertainty maps ; of the original images with XRT_PREP, then construct ; a composite uncertainty map. ; ; MODIFICATION HISTORY: ; progver = 'v2015.Mar.29' ; --- (Aki Takeda) Written. ; ;- ; ========================================================================= if keyword_set(l0dir) then q_l0dir=1 else q_l0dir=0 ;***** extract original level0 filenames ***** ncomp=tag_exist(syn_ind,'LNGFNAME')+ $ tag_exist(syn_ind,'MEDFNAME')+tag_exist(syn_ind,'SRTFNAME') ; case ncomp of 2: begin ncomp=2 print,'*** input image is a doublet composite. ***' fnames=[syn_ind.LNGFNAME,syn_ind.SRTFNAME] end 3: begin ncomp=3 print,'*** input image is a triplet composite. ***' fnames=[syn_ind.LNGFNAME,syn_ind.MEDFNAME,syn_ind.SRTFNAME] end else: begin ncomp=0 print,'*** No info found on the original data. ***' goto, FIN end endcase ; case q_l0dir of 1: begin l0fpath=l0dir files=file_search(l0fpath+fnames,count=nn) if nn eq 0 then begin print,l0fpath print,'*** level0 files not found. Returning...' return,0 endif end 0: begin dir_xrtl0ssw=get_logenv('XRT_DATA') if dir_xrtl0ssw eq '' then begin print,'*** Level0 directory not found. Use L0DIR keyword to specify.' return, 0 endif else begin yyyy=strmid(fnames,3,4) mm=strmid(fnames,7,2) dd=strmid(fnames,9,2) hhhh='H'+strmid(fnames,12,2)+'00' l0fpath=dir_xrtl0ssw+'/'+yyyy+'/'+mm+'/'+dd+'/'+hhhh+'/' files=file_search(l0fpath+fnames,count=nn) if nn eq 0 then begin print,'*** level0 files not found. Returning...' return, 0 endif endelse end endcase ; ;***** read level0 files & calculate uncertainty *** read_xrt,files,index,data case ncomp of 2: begin l_idx=index(0) & l_da=data(*,*,0) s_idx=index(1) & s_da=data(*,*,1) MK_XRT_COMP2_UNC, l_idx, l_da, s_idx, s_da, $ c_idx, c_da, uncert_map=unc_map end 3: begin l_idx=index(0) & l_da=data(*,*,0) m_idx=index(1) & m_da=data(*,*,1) s_idx=index(2) & s_da=data(*,*,2) MK_XRT_COMP3_UNC, l_idx, l_da, m_idx, m_da, s_idx, s_da, $ c_idx, c_da, uncert_map=unc_map end else: endcase ; return, unc_map FIN: end