;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; DICal_GETPDSMASTFN.PRO ;;; ;;; Derive EPOXI PDS/MAST filename from date, Exposure ID and Image # ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Instrument prefix is two characters: hv; hi; mv; iv. ;;; Date is string 'yyYY-MO-DDTHH:MM:SS.ccc' ;;; Exposure ID is integer, range 0 to 9999999 (ExposID) ;;; Image # is integer, range 1 to 256 (IM#) ;;; Suffix is specified by the user and will be separated by an underscore ;;; if it does not start with one ;;; ;;; PDS/MAST filename will be YYMODDHH_ExposID_IM#[_sfx] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; function diCal_getpdsmastfn, hdr, sfxArg us='_' ;;; Underscore rtn='UNKNOWN' ;;; Assume failure dt=fxpar(hdr,'obsmiddt',count=ct) if ct eq 1L then expid=fxpar(hdr,'expid',count=ct) if ct eq 1L then imgnum=fxpar(hdr,'imgnum',count=ct) if ct eq 1L then instrume=fxpar(hdr,'instrume',count=ct) if ct ne 1L then return,rtn case strtrim(instrume,2) of 'HRIIR': pfx='hi' 'HRIVIS': pfx='hv' 'MRIVIS': pfx='mv' 'ITSVIS': pfx='iv' else: return,rtn endcase rtn = pfx $ + strmid(dt,2,2) + strmid(dt,5,2) + strmid(dt,8,2) + strmid(dt,11,2) $ + string(f='(a1,i7.7,a1,i3.3)',us,expid,us,imgnum) if n_elements(sfxArg) eq 1L then begin sfx = strtrim(sfxArg[0],2) if sfx ne '' then begin sfxsep = strmid(sfx,0,1) eq us ? '' : us rtn = rtn + sfxsep + sfx endif endif return,strupcase(rtn) end