function gt_filt2, item, header=header, string=string, short=short, $ spaces=spaces, silent=silent ; ;+ ;NAME: ; gt_filt2 ;PURPOSE: ; To extract info of the Filter Wheel 2 from Hinode/XRT FITS headers. ; This function returns the value of the EC_FW2 tag and optionally ; convert into a string mnemonic. The EC_FW2_ tag (holds filter name ; string) is not used, but checked the consistency with its numeric ; expression (i.e. EC_FW2). ; ;CALLING SEQUENCE: ; print, gt_filt2() ;to list the nemonics ; filt2 = gt_filt2(index) ; filt2 = gt_filt2(index, /string) ; filt2 = gt_filt2(index, /short) ; filt2 = gt_filt2(indgen(6)+1) ;used with menu selection ; filt2 = gt_filt2(index, /space) ;put single space before string ; filt2 = gt_filt2(index, space=3) ;put 3 spaces ; ;INPUT: ; item - A Hinode/XRT FITS structure. It can be an array. If this ; value is not present, a help summary is printed on the ; filter names used. ;OPTIONAL INPUT: ; string - If present, return the string mnemonic (long notation) ; short - If present, return the short string mnemonic ; spaces - If present, place that many spaces before the output ; string. ; silent - If set, consistency check do not performed ; between EC_FW2 and EC_FW2_. ;OUTPUT: ; returns - The filter selected, a integer value or a string ; value depending on the switches used. It is a vector ; if the input is a vector ;OPTIONAL OUTPUT: ; header - A string that describes the item that was selected ; to be used in listing headers. ;HISTORY: ; 18-Jan-2012 Aki Takeda - Modified version of GT_FILTB.PRO ; to work with Hinode/XRT FITS data. ;- ; header_array = ['Filter_Wheel_2', 'FW2'] conv2str = ['Open ', 'Al_mesh ', 'Ti_poly ', 'Gband ', $ 'Al_thick', 'Be_thick', ' ???? '] ; 8 characters conv2short = ['Open', 'Amsh', 'Tpol', 'Gbnd', $ 'Altk', 'Betk', '????'] ; 4 Characters ; if (n_params(0) eq 0) then begin print, 'String Output for GT_FILT2' for i=0,6 do print, i, conv2str(i), conv2short(i), format='(i3, 2x, a8, 2x, a4)' return, '' end ; ;***** check input ***** siz = size(item) typ = siz( siz(0)+1 ) if (typ ne 8) then begin print,'gt_filt2: FITS header structures required.' out='' return, out endif else tags = tag_names(item) ; if (tags(0) ne 'SIMPLE') then begin print,'gt_filt2: FITS header structures required.' out='' return, out endif ; ;***** read tag values ***** if not tag_exist(item,'EC_FW2') then $ if tag_exist(item,'EC_FW2_') then begin out = item.EC_FW2_ print,'gt_filt2: EC_FW2 tag not found. String values returned.' return, out endif else begin print,'gt_filt2: EC_FW2 and EC_FW2_ tags not found.' out='' return, out endelse ; out = item.EC_FW2 ; as initial values ; if tag_exist(item,'EC_FW2') and tag_exist(item,'EC_FW2_') then begin fnum = item.EC_FW2 fstr = item.EC_FW2_ fstr2= gt_conv2str(out, conv2str,/string) for i=0,n_elements(fnum)-1 do begin chk=strpos(fstr2(i),fstr(i)) if (chk eq -1) and not keyword_set(silent) then $ print,'gt_filt2: Detect descrepancy at ', $ anytim(item(i).date_obs,/ecs,/trunc), $ '. EC_FW2: ', strtrim(string(item(i).EC_FW2),2), $ ', EC_FW2_: ',item(i).EC_FW2_ endfor endif ; out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces) ; return, out end