function [x_3dgrid,y_3dgrid,z_3dgrid,u_grid,v_grid,w_grid]=roll_windfield

files=dir(['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\wind field Simulation (Ping)\*.nc']); 
ncload(['C:\Documents and Settings\lorsolo\My Documents\research\HRD research\wind field Simulation (Ping)\',files(1).name]);
keep('U','V','W','PHB');
lati=30.4722;
g= 9.780327*(1 + .0053024*(sin(deg2rad(lati)))^2 - .0000058*(sin(2*deg2rad(lati)))^2 );


U=permute(U,[2 3 1]);
V=permute(V,[2 3 1]);
W=permute(W,[2 3 1]);
PHB=permute(PHB,[2 3 1]);

[li,col,lev]=size(U);
u_grid=NaN*zeros(li,li,lev);
v_grid=NaN*zeros(li,li,lev);
w_grid=NaN*zeros(li,li,lev);
geop=NaN*zeros(li,li,lev);

for j=1:li
    u_grid(:,j,:)=0.5*(U(:,j,:)+U(:,j+1,:));
end

for i=1:li
    v_grid(i,:,:)=0.5*(V(i,:,:)+V(i+1,:,:));
end

for k=1:lev
    w_grid(:,:,k)=0.5*(W(:,:,k)+W(:,:,k+1));
    geop(:,:,k)=0.5*(PHB(:,:,k)+PHB(:,:,k+1));
end




z_3dgrid=geop/g;
x_grid= 0:10:2090;%0:20:4180;  %0:10:2090;%-5200:50:5250;%400:50:10450;
y_grid= 0:10:2090;%0:20:4180;   %0:10:2090;%-5200:50:5250;%-10400:100:10500;
z_grid=1:53;
[x_3dgrid,y_3dgrid,z2_3dgrid]=meshgrid(x_grid,y_grid,z_grid);
