;************************************************************************ ; Extract variables of cdata ; ;************************************************************************ function cindex,iv ; common cdata_names, array s=size(iv) if s(0) eq 0 and s(1) ne 7 then return,iv if n_elements(array) le 1 then spawn,'~bob/bin/cdata.help -1',array index=where(array eq iv, n) if n le 0 or index(0) le 0 then begin print,iv+' not in cdata:' print,array return,-1 end return,index(0) end pro wdata,f,it,iv ; common coff,mpar,mav,ipack,incr,ioff,time,voff,xfile,irec common cdat,x,y,z,nx,ny,nz,nw,ntmax,date0,time0 if n_params() eq 0 then begin print,'wdata,f,isnap,iarray' return end ; iv=cindex(iv) a=assoc(1,fltarr(nz),ioff(it)+(incr-1)*voff+4L*(mpar+iv*nz)) a(0)=f return end function cdataz,it,iv,help=help ; common coff,mpar,mav,ipack,incr,ioff,time,voff,xfile,irec common cdat,x,y,z,nx,ny,nz,nw,ntmax,date0,time0 common cdata_names, array if n_params() eq 0 then print,'cdata(isnap,iarray)' if n_elements(help) gt 0 then begin if n_elements(array) le 1 then spawn,'~bob/bin/cdata.help -1',array for i=0,n_elements(array)-1 do $ print,i,array(i),format='(i3,2x,a)' if n_params() lt 2 then return,array end if n_params() eq 0 then return,0 iv=cindex(iv) ;a=assoc(1,fltarr(nz),ioff(it)+(incr-1)*voff+4L*(mpar+iv*nz)) idat=incr-1 a=assoc(1,fltarr(nz),irec(incr*it+idat)+4L*(mpar+iv*nz)) a=a(0) byteorder,a,/ntohl return,a end function cdatat,iv ; common coff,mpar,mav,ipack,incr,ioff,time,voff,xfile,irec common cdat,x,y,z,nx,ny,nz,nw,ntmax,date0,time0 if n_params() eq 0 then begin print,'tmp=cdatat(iarray)' return,0 end ; a=fltarr(nz,ntmax,/nozero) iv=cindex(iv) for t=0,ntmax-1 do a(*,t)=cdataz(t,iv) return,a end