pro get_llow_lhi,triplet=triplet,chk_n=chk_n,debug=debug,$ ;input tymi=tymi,nset_in=nset_in,$ ;input ntym=ntym,dun=dun,nset_out=nset_out,$ ;output roadmap,xdata,loud=loud,$ ;input index,data,lo,hi,smin,smax,resol,fltr ;output ;+ ; NAME ; get_llow_lhi ; ; PURPOSE ; This program provides the parameters, which are stored in ; the text file '/disk/hl2/pd1/acton/fix_att/tbl_chng.txt', ; needed for creating SSC and SST composite SXT image files ; throughout the Yohkoh mission. It was necessary to create ; this code because, prior to 19-apr-92 14:44, the STANDARD ; observing tables had not been decided. The subroutine is ; called by mk_sff_pair.pro. ; ; CALLING SEQUENCE ; get_llow_lhi,triplet=triplet,chk_n=chk_n,debug=debug,$ ;input ; tymi=tymi,nset_in=nset_in,$ ;input ; ntym=ntym,dun=dun,nset_out=nset_out,$ ;output ; roadmap,xdata,loud=loud,$ ;input ; index,data,lo,hi,smin,smax,resol,fltr ;output ; ; INPUT ; roadmap, SXT index (NOT usual roadmap) structure. ; xdata, raw (byte) data cube corresponding to roadmap. ; ; OPTIONAL INPUT ; tymi, index of time loop. ; nset_in, index of nset loop ; ; OPTIONAL KEYWORD INPUT ; /debug, stop before return for debugging ; /chk_n, first pass to determine: ; (a) Whether to abort this day (sets DUN=1) ; (b) Number of time intervals this day (sets NTYM) ; /triplet, make SSTs. ; /loud, print out tbl_chng.txt data line. ; ; OUTPUT ; index,data: Subset of roadmap,xdata for current loop. ; lo,hi,smin,smax: DPE ranges needed by mk_sff_pair. ; resol,fltr: Resolution and filters for mk_sff_pair loops. ; ; KEYWORD OUTPUT ; ntym, the number of table intervals that day. ; dun, if eq 1 then do not process this interval for some reason. ; nset_out, number of different lo,hi,smin,smax,resol,fltr sets this interval. ; ; COMMENT ; This routine, with mk_sff_pair, are spaghetti code of the worst ; kind. It ain't pretty -- but it seems to work. ; ; HISTORY ; 31-May-2007 LWA Header added to tested code. ; 6-Jun-2007 LWA Put array chg in common block. ; 8-Jun-2007 LWA Fixed common block error. ; 25-Jun-2007 LWA Fixed lastym bug which eliminated last image. ; Handle case with >1 "double" table change. ; 1-Aug-2007 LWA Handle case with ill-ordered roadmap. ; 22-Aug-2007 LWA Commented out fmt_timer printout. ; 24-Aug-2007 LWA Added keyword quiet. ; 12-Feb-2010 LWA Mod. to handle too-large data array. ; 17-Feb-2010 LWA Deleted delvarx,xdata command 2/12/10 change. ; 2-Apr-2012 LWA chang=rd_tfile('/yla/ssc_work/tbl_chng.txt',12,3) ; 3-Apr-2012 LWA Read 100426 tbl_chng version, every cycle. ; Print before/after tbl_chang lines every cycle. ; 3-Apr-2012 LWA chang=rd_tfile('/yla/ssc_work/tbl_chng.txt',12,3) ; Only read 120402 tbl_chng.txt once ; 17-May-2012 LWA Read tbl_chng.txt every time. ; 23-May-2012 LWA Replace keyword quiet with keyword loud ; in order to print,chg(*,chgi(tymi)). ; 17-Jul-2012 LWA chang=rd_tfile('/disk/yla/www/archive/yohkoh/yla_ssw/tbl_chng.txt',12,3) ;- common mk_ssc_blk2, chang debug=keyword_set(debug) trip=keyword_set(triplet) chk_n=keyword_set(chk_n) loud=keyword_set(loud) dun=0 ;help,roadmap,xdata ;if n_elements(chang) eq 0 then begin ;BEWARE, the following statement only works at MSU. ;chang=rd_tfile('/disk/hl2/pd1/acton/fix_att/tbl_chng.txt',12,3) chang=rd_tfile('/disk/yla/www/archive/yohkoh/yla_ssw/tbl_chng.txt',12,3) ;endif yy=where(chang(11,*) eq trip) chg=chang(*,yy) date=reform(chg(1,*)+' '+chg(2,*)) ttt=int2secarr(date,'1-sep-91 00:00') tti=int2secarr(roadmap,'1-sep-91 00:00') bef=where(ttt lt min(tti)) if bef(0) eq -1 then begin dun=1 if debug then stop return endif aft=where(ttt gt max(tti)) chgi=indgen(min(aft)-max(bef))+max(bef) tchgi=anytim(date(chgi)) uchgi=uniq(tchgi) chgi=chgi(uchgi) ; How many cycles required this day? nchgi=n_elements(chgi) case 1 of nchgi gt 1 and chg(5,chgi(0)) eq -1 : chgi=chgi(1:n_elements(chgi)-1) nchgi eq 1 and chg(5,chgi(0)) eq -1 : begin dun=1 if debug then stop return end else : chgi=chgi endcase if chg(5,max(chgi)) eq -1 then ntym=n_elements(chgi)-2 $ else ntym=n_elements(chgi)-1 ;if not quiet then begin ; print ; print, 'CHK_N = ',strtrim(chk_n,2) ; print ;endif if chk_n then begin ;Exit first run-through which set time intervals. if chgi(0) ne 0 then begin if (date(chgi(0)-1) eq date(chgi(0))) then nset_out=1 else nset_out=0 endif else begin nset_out=0 endelse if debug then stop return ;Exit first run-through which set time intervals.q endif ; Prepare the data for the pairing process. if nset_in eq 1 then chgi=chgi-1 ;Do skipped nset case, 5/30/07. case 1 of chg(5,max(chgi)) eq -1 : begin print,'Case A' lastym=date(chgi(tymi+1)) slct=sel_timrange(roadmap,date(chgi(tymi)),lastym,/between) end ttt(chgi(tymi)) le max(tti) and ttt(chgi(tymi)) lt ttt(max(chgi)) : begin print,'Case B' lastym=date(chgi(tymi+1)) if (date(chgi(tymi)) eq lastym) then begin slct=sel_timrange(roadmap,lastym,date(chgi(tymi+2)),/between) endif else begin slct=sel_timrange(roadmap,date(chgi(tymi)),lastym,/between) endelse end ttt(chgi(tymi)) le max(tti) and ttt(chgi(tymi)) eq ttt(max(chgi)) : begin print,'Case C' alast=where(anytim(roadmap) eq max(anytim(roadmap))) lastym=fmt_tim(roadmap(alast)) help,lastym lastym=anytim(anytim(lastym)+1.,/ints) ;if not quiet then fmt_timer,roadmap slct=sel_timrange(roadmap,date(chgi(tymi)),lastym,/between) if debug then stop end ttt(chgi(tymi)) gt max(tti) : dun=1 endcase help,roadmap,xdata index=roadmap(slct) sizx=size(xdata) data=bytarr(sizx(1),sizx(2),n_elements(slct)) for zz=0,n_elements(slct)-1 do data(0,0,zz)=xdata(*,*,slct(zz)) ;data=xdata(*,*,slct) lo=fix([chg(5,chgi(tymi)),chg(7,chgi(tymi))]) hi=fix([chg(6,chgi(tymi)),chg(8,chgi(tymi))]) smin=fix(chg(3,chgi(tymi))) smax=fix(chg(4,chgi(tymi))) ; print selected tbl_chng.txt line. if loud then begin print print,chg(*,chgi(tymi)) print endif ; Which filter? if strmid(chg(9,chgi(tymi)),0,1) eq '"' then begin fltr=fix([strmid(chg(9,chgi(tymi)),1,1),strmid(chg(9,chgi(tymi)),3,1)]) endif else begin fltr=fix(chg(9,chgi(tymi))) endelse ; Which resolution? if strmid(chg(10,chgi(tymi)),0,1) eq '"' then begin resol=fix([strmid(chg(10,chgi(tymi)),1,1),strmid(chg(10,chgi(tymi)),3,1)]) endif else begin resol=fix(chg(10,chgi(tymi))) endelse ;if debug then stop ;if not quiet then print,chg(*,chgi(tymi)) nchng=chg(0,chgi(tymi)) if debug then print,' Tbl Chng load number = ',nchng, nset_in if debug then stop ;get_lines,chang,trip,resol ;4/3/2012, LWA (for diagnostics) end