function cutm3d(flin,flout);
%function cutm3d(flin,flout);
%remove observations more than 2 std's from mean from m3d file/
s=read_m3d(flin);
s.z=s.u+sqrt(-1)*s.v;
mu=mean(s.z);
st=std(s.z);
j=find(abs(e1.z-mu)<2*st);
s.yrday=s.yrday(j);
s.x=s.x(j);
s.y=s.y(j);
s.u=s.u(j);
s.v=s.v(j);
s.zmin=s.zmin(j);
s.zmax=s.zmax(j);
s.zbottom=s.zbottom(j);
write_m3d(flout)