function get1hk_info, infil_arr, times0, mnem, list=list, $ raw_value=raw_value, rec=rec, qstop=qstop, qdebug=qdebug, q2stop=q2stop, $ every=every, insim=insim, err=err, nostring=nostring, cleanup=cleanup, $ exp_pkt=exp_pkt, append=append, hkmapfil=hkmapfil ; common hk_dbase_blk1, tlm, alg, dsc, cmd ; if (n_elements(tlm) eq 0) then rd_egse_hk_txt, tlm, alg, dsc, cmd ; break_file, infil_arr, dsk_log, dir, filnam, ext ; err = 1 ss = where_arr(mnem, tlm.name, /map_ss) ; ;------------------- ; epoch0 = '1-Jan-70' epoch = '1-Jan-70' ;;if (getenv('GSE_CONFIG_TYPE') eq 'TRACE') then epoch = '24-May-68' $ ;; else epoch = '1-Jan-70' ; times = anytim2ints(times0) n = n_elements(times) m = n_elements(mnem) ; out = -1 if (keyword_set(list)) then begin for itim=0,n-1 do begin tim = times(itim) infil_match = strmid(ex2fid( anytim2ex(tim) ), 0, 6) ss = where(filnam eq infil_match) ; if (ss(0) ne -1) then begin infil0 = infil_arr(ss(0)) if (keyword_set(qdebug)) then print, 'Using file: ', infil0 map = rd_hk(infil0, /map, hkmapfil=hkmapfil) ;read the roadmap dectim = int2secarr(tim, epoch0) imin = min( abs(map-dectim), irec) ;find the closest record if (imin lt 120) then begin rec = rd_hk(infil0, irec, irec, cleanup=cleanup, hkmapfil=hkmapfil) ;read that record ; if (data_type(rec) eq 8) then begin if (keyword_set(exp_pkt)) then begin ;MDM added 27-Nov-95 temp = rec.hk(70:70+49) rec.hk = rec.hk * 0 ;zero out all data rec.hk(0:49) = temp end if (itim eq 0) then begin data_ref = gtt_mnem(rec(0).hk, mnem(0), 'HK', raw_value=raw_value, nostring=nostring) timarr = replicate(anytim2ints([0,0]), n) out = replicate(data_ref, n, m) ;out = fltarr(n, m) end timarr(itim) = anytim2ints(epoch, off=double(rec.time)) for imnem=0,m-1 do out(itim, imnem) = gtt_mnem(rec.hk, mnem(imnem), 'HK', raw_value=raw_value, $ nostring=nostring ) end else begin if (itim eq 0) then out = fltarr(n, m) out(itim, *) = -1 end end end end end else begin block = 1000 ;do this number of records at a time ; ;;infil_match1 = strmid(ex2fid( anytim2ex(times(0)) ), 0, 6) ;;infil_match2 = strmid(ex2fid( anytim2ex(times(1)) ), 0, 6) ;;ss = where((filnam ge infil_match1) and (filnam le infil_match2), nfil) tmp = sel_filetimes(times(0), times(1), filnam, /one_before) ss = where_arr(filnam, tmp, nfil) if (keyword_set(qdebug)) then print, 'NFIL = ', nfil ; if (nfil ne 0) then begin qfirst = 1 for ifil=0,nfil-1 do begin infil0 = infil_arr(ss(ifil)) map = rd_hk(infil0, /map, hkmapfil=hkmapfil) ;read the roadmap if (ifil eq 0) then begin dectim = int2secarr(times(0), epoch0) dummy = min( abs(map-dectim), strec) ;find the closest record if (map(strec) lt dectim) then strec=(strec+1)<(n_elements(map)-1) ;MDM patch 16-Jan-95 end else begin strec = 0 end ; if (ifil eq nfil-1) then begin dectim = int2secarr(times(1), epoch0) dummy = min( abs(map-dectim), enrec) ;find the closest record if (map(strec) gt dectim) then enrec=(enrec-1)>0 ;MDM patch 16-Jan-95 end else begin enrec = n_elements(map)-1 end ; strec = long(strec) for strec2=strec,enrec,block do begin enrec2 = (strec2+block-1) < enrec if (keyword_set(qdebug)) then print, 'Reading ', infil0, ' records ', strec2, enrec2 rec = rd_hk(infil0, strec2, enrec2, cleanup=cleanup, hkmapfil=hkmapfil) ;read those records if (data_type(rec) eq 8) then begin if (keyword_set(exp_pkt)) then begin ;MDM added 27-Nov-95 temp = rec.hk(70:70+49) rec.hk = rec.hk * 0 ;zero out all data rec.hk(0:49) = temp end ; if (keyword_set(every)) then begin nout_every = (n_elements(rec) / every) > 1 ss_every = indgen( nout_every ) * every rec = rec(ss_every) end ; timarr0 = anytim2ints(epoch, off=double(rec.time)) ; data_ref = gtt_mnem(rec(0).hk, mnem(0), 'HK', raw_value=raw_value, nostring=nostring) out0 = replicate(data_ref, n_elements(rec), m) ;out0 = fltarr(n_elements(rec), m) for imnem=0,m-1 do out0(0, imnem) = gtt_mnem(rec.hk, mnem(imnem), 'HK', raw_value=raw_value, $ nostring=nostring ) ; if (qfirst) then begin out = temporary(out0) timarr = temporary(timarr0) end else begin out = [out, temporary(out0)] timarr = [timarr, temporary(timarr0)] end qfirst = 0 end end end end else begin out = [-1] end end ; out2 = -1 qok = 1 if (data_type(out) ne 7) then qok = (out(0) ne -1) if (qok) then begin ;found something if (keyword_set(append)) then begin timarr = [append.daytime, timarr] ;append previous result out = [append.value, out] end ; n = n_elements(timarr) m = n_elements(mnem) cmd = '{dummy, daytime: replicate({anytim2ints}, ' + strtrim(n,2) + '), ' + $ 'value: ' + fmt_tag(size(out)) + ' , ' + $ 'mnem: strarr(' + strtrim(m,2) + '), ' + $ 'descr: strarr(' + strtrim(m,2) + '), ' + $ 'code: lonarr(' + strtrim(m,2) + '), ' + $ 'flag: lonarr(' + strtrim(m,2) + ')}' if (keyword_set(qdebug)) then print, cmd out2 = make_str(cmd) out2.daytime.time = timarr.time out2.daytime.day = timarr.day out2.value = out out2.mnem = mnem out2.code = indgen(m) ; for i=0,m-1 do begin ss = where_arr(tlm.name, mnem(i), count) if (ss(0) ne -1) then out2.descr(i) = tlm(ss(0)).descr end err = 0 end else begin if (keyword_set(append)) then return, append end ; if (keyword_set(qstop)) then stop return, out2 end