pro mtraj_getdata,dayni2,latinx,loninx,uout,vout,tout,$ qout,err,forward=forward,$ dayfracs1=dayfracs1,u1=u1,v1=v1,q1=q1,t1=t1,$ dayfracs2=dayfracs2,u2=u2,v2=v2,q2=q2,t2=t2,dir=dir ;+ ; NAME: ; mtraj_getdata ; PURPOSE: ; This routine gets the Meteorological data for the ftraj trajectory model at ; the potential temperature theta (or at the array of potential temperatures). ; The code will interpolate the data onto to linear array of latitudes and longitudes ; given by latinx and loninx. Usually this routine is called after the routine traj_selectdata ; is called and the commom block "metfiles" is loaded. ;- common metfiles,dayfracs,latsx,lonsx dayni=dayni2 if n_elements(dayfracs1) eq 0 then dayfracs1=0. if n_elements(dayfracs2) eq 0 then dayfracs2=0. ; load the two target arrays n=where(dayfracs gt dayni) if n(0) ge 0 then dset1=dayfracs(n(0)-1) else stop,'error in mtraj_detdata' dset2=dayfracs(n(0)) if dset1 ne dayfracs1 then begin $ mtraj_loaddata,dset1,u1,v1,t1,q1,latsx,lonsx,dir=dir dayfracs1=dset1 endif if dset2 ne dayfracs2 then begin $ mtraj_loaddata,dset2,u2,v2,t2,q2,latsx,lonsx,dir=dir dayfracs2=dset2 endif ; ---- now we have finished getting arrays on theta surfaces ; ----- next do time averaging here w2 = (dayni - dayfracs1)/(dayfracs2-dayfracs1) w2=float(w2) w1 = 1.- w2 latsxr=latsx lonsxr=lonsx ; ----- final step interpolate onto parcel points ; begin interpolation ; single theta value uout=latinx*0. vout=latinx*0. tout=latinx*0. qout=latinx*0. ; now interpolate onto input vectors uout=latlonintrp(u1*w1 + u2*w2,lonsx,latsx,loninx,latinx,$ gotem,kl,kl1,kl2,jl,ju,x,y,/wrap,/regular) vout=latlonintrp(v1*w1 + v2*w2,lonsx,latsx,loninx,latinx,$ gotem,kl,kl1,kl2,jl,ju,x,y,/wrap,/more,/regular) tout=latlonintrp(t1*w1 + t2*w2,lonsx,latsx,loninx,latinx,$ gotem,kl,kl1,kl2,jl,ju,x,y,/wrap,/more,/regular) qout=latlonintrp(q1*w1 + q2*w2,lonsx,latsx,loninx,latinx,$ gotem,kl,kl1,kl2,jl,ju,x,y,/wrap,/more,/regular) skipp: return end