登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 daweilee1989 于 2014-10-9 20:18 编辑
clear;
clc;
global ln mn
ln=720;mn=301;
folder = 'E:\satallite wind\sw\2008wind\'; % Jan 7, 2010
files=dir([folder,'*.d']); % Jan 7, 2010
[nf,m]=size(files);
for nf=1:nf
filename = getfield(files(nf),'name');
datenom = ['20',filename(1:8)];
filename = [folder,filename];
fd = fopen(filename,'r','ieee-be');
% str = fread(fd,1,'char','ieee-be');
u = fread(fd,ln*mn,'float','ieee-be');
v = fread(fd,ln*mn,'float','ieee-be');
% for j=1:mn
% for i=1:ln
% u(i,j)=fread(fd,1,'float','ieee-be');
% end
% end
% for j=1:mn
% for i=1:ln
% v(i,j)=fread(fd,1,'float','ieee-be');
% end
% end
% read(22) ((u(i,j),i=1,l),j=1,m)
% read(22) ((v(i,j),i=1,l),j=1,m)
% close(22)
fclose(fd);
alat=-75+(1:mn)*0.5-0.5;
alon=0+(1:ln)*0.5-0.5; L = (alat>=16 & alat<=26);
alat(~L)=NaN;
L = (alon>=115 & alon<=125);
alon(~L)=NaN;
[X Y] = meshgrid(alon,alat);
% Y=flipud(Y);
u = reshape(u,ln,mn);
v = reshape(v,ln,mn);
u = u';
v = v';
L = u<-9000;
u(L) = NaN;
L = v<-9000;
v(L) = NaN;
LON = reshape(X,1,ln*mn);
LAT = reshape(Y,1,ln*mn);
ave_u = reshape(u,1,ln*mn);
ave_v = reshape(v,1,ln*mn);
% lonstart = round((115.6+0.5)/0.5);
% lonend = round((124.4+0.5)/0.5);
% latstart = round((16.6+75.5)/0.5);
% latend = round((25.4+75.5)/0.5);
% for i=lonstart:lonend
% for j=latstart:latend
% nn=(i-1)*mn+j;
% LAT(nn)=-75.0+j*0.5-0.5;
% LON(nn)=0.0+i*0.5-0.5;
% ave_u(nn)=u(i,j);
% ave_v(nn)=v(i,j);
% end
% end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HF=figure;
m_proj('mercator','lon',[115.6 124.4],'lat',[16.6 25.4]);%%%%%%%%%%%%%%please attention, the Bashi Strait
% hold on;m_quiver(alllon(1000:end),alllat(1000:end),allwindu(1000:end),allwindv(1000:end),3);
% hold on;m_plot(alllon(1000:end-1),alllat(1000:end-1),'k-','LineWidth',1.5);
m_gshhs_i('patch',[.5 .5 .5]);
LON(end+1)=116.5;
LAT(end+1)=24.5;
ave_u(end+1)=15;
ave_v(end+1)=0;
L1 = ave_u==0; L2 = ave_v==0;
L = L1 & L2;
LON(L) = NaN;
LAT(L) = NaN;
L1 = isnan(LON);
L2 = isnan(LAT);
L = L1 | L2;
LON(L)=[];LAT(L)=[];ave_u(L)=[];ave_v(L)=[];
clear L1 L2 L;
L1 = isnan(ave_u);
L2 = isnan(ave_v);
L = L1 | L2;
LON(L)=[];LAT(L)=[];ave_u(L)=[];ave_v(L)=[];
hold on;m_quiver(LON,LAT,ave_u,ave_v,1.5,'k-','LineWidth',1.48);
% title(datenom);
% hold on;m_plot(alllon(1:end-1),alllat(1:end-1),'k-','LineWidth',1.5);
% hold on;m_plot(ctdpointslon,ctdpointslat,'ro'); hold on;m_text(LON(end),LAT(end)+0.2,'\fontsize{8}\color{white}15 m/s');
m_grid('box','on','tickdir','out','xaxislocation','bottom');
hold off; savepic = [folder,num2str(nf),'-',datenom,'.emf'];
print (HF,'-dmeta',savepic);
close(HF);
end
% end
|