function GMTconv1(Umean,Vmean)
%
% functions grabs the Umean/Vmean of a float & stores it as an ascii file
% for processing with GMT
%
% grid: 240 
%
global Umean Vmean X Y deltau deltav
%load 
fid = fopen('emoe4.asc','w');
fid2= fopen('emoe42.asc','w');
%fid2 = fopen('xk3ne.asc','w');
%fid3 = fopen('yk3ne.asc','w');
n=size(Umean(1,:))
n=n(2)
m=size(Umean(:,1))
m=m(1)
r=zeros(m,n);
%error=zeros(m,n);
theta=zeros(m,n);
%angle=zeros(m,n);
%size=0.5
for x=1:m;
 for y =1:n;
r(x,y)=sqrt((Umean(x,y)^2)+(Vmean(x,y)^2));
error(x,y)=sqrt((deltau(x,y)^2)+(deltav(x,y)^2));
%Vmean(x,y)
%Umean(x,y)
theta(x,y)=(360/(2*pi))*atan(Vmean(x,y)/Umean(x,y));
if (Umean(x,y)<0) & (Vmean(x,y)>0)
  theta(x,y)=(180+(theta(x,y)));
elseif (Umean(x,y)<0) & (Vmean(x,y)<0)
  theta(x,y)=-(180-theta(x,y));
%elseif (Umean(x,y)>0) & (Vmean(x,y)<0)
%  theta(x,y)=-(360+theta(x,y));
end
%angle(x,y)=(360/(2*pi))*atan(deltav(x,y)/deltau(x,y));
%if (deltau(x,y)<0) & (deltav(x,y)>0)
%  angle(x,y)=(180+(angle(x,y)));
%elseif (deltau(x,y)<0) & (deltav(x,y)<0)
%  angle(x,y)=-(180-angle(x,y));
%elseif (deltau(x,y)>0) & (deltav(x,y)<0)
%  angle(x,y)=-((360)+angle(x,y));
%end
blurb=0.00;
var = [X(x,y); Y(x,y); theta(x,y); r(x,y)];
vare= [X(x,y); Y(x,y); blurb; deltau(x,y); deltav(x,y)];
%varx = [X(x,y); Umean(x,y)];
%vary = [Y(x,y); Vmean(x,y)];
 if(X(x,y)<1000) & (r(x,y)>error(x,y))
fprintf(fid,'%6.2f %6.2f %6.2f %6.2f\n', var);
fprintf(fid2,'%6.2f %6.2f %6.2f %6.2f %6.2f\n',vare);
%fprintf(fid2,'%6.2f %6.2f\n', varx);
%fprintf(fid3,'%6.2f %6.2f\n', vary);
 end
end
end
fclose(fid);
fclose(fid2);
%fclose(fid3);
