; $Id: rsliceTX.pro,v 1.1 2022/01/13 20:59:40 brandenb Exp $
;
;  reads xy slices
;  this routine is not very general yet and needs to be adjusted
;  before it can be general purpose.
;  it works only for nprocx=1 (all in one slice file)
;
@parameters
;file_slice='data/proc0/slice_hhT.xy' & outfile='last.sav'
file_slice='data/slice_hhX.xy' & outfile='last_X.sav'
file_slice='data/slice_hhT.xy' & outfile='last_T.sav'
;
t=0d0
nx=1024
ny=nx
nz=nx
xy_slice=dblarr(nx,ny)
slice_ypos=0d0
;
close,1
icount=0
openr,1,file_slice,/f77
while not eof(1) do begin
  readu,1,xy_slice,t,slice_ypos
  print,t
  f=reform(xy_slice[*,0])
  if icount eq 0 then tt=t else tt=[tt,t]
  if icount eq 0 then ff=f else ff=[ff,f]
  ;plot,xy_slice(11,*),yr=[-1,1]*1e-3
  tvscl,xy_slice
  icount=icount+1
  wait,.1
end
;
nt=icount
fff=reform(ff,nx,nt)
close,1
;
;print,824-512
;     312
;IDL> help,fff[*,312:*]
;print,"tvscl,fff[*,312:*]"
i1_fff=nt-nomspec
i1_fff=0
fff_last=fff[*,i1_fff:*]
tt_last=tt[i1_fff:*]
nx=n_elements(f)
dx=2*!pi/nx
x=dx*(findgen(nx)-.5*nx+.5)
save,file=outfile,fff_last,tt_last,x
;<Expression>    DOUBLE    = Array[1024, 512]
END
