track=load('..\CMA_tracks\track.txt');
N=size(track);track=reshape(track,[N(1) N(2)/6 6]);N=size(track);
fidin=fopen('..\CMA_tracks\name.txt');col='kcbgymr';
load coast;x=long;y=lat;
for i=1:N(1)
disp(i)
tmp=squeeze(track(i,:,:));
nt=max(find(tmp(:,1)~=0));
tmp=tmp(1:nt,:);
lon=tmp(:,3);lat=tmp(:,2);
[~,k_in]=min(tmp(:,3));
% k1=find(tmp(9:end-8,8)<-37);k2=find(tmp(9:end-8,8)<-40);
% kk=unique(sort([k1;k2]))+8;
% for ii=1:length(kk)
% k=kk(ii);
% R(1)=(lon(k)-lon(k-8))*cosd((lat(k)+lat(k-8))/2)+(lat(k)-lat(k-8))*sqrt(-1);
% R(2)=(lon(k+8)-lon(k))*cosd((lat(k)+lat(k+8))/2)+(lat(k+8)-lat(k))*sqrt(-1);
% A=angle(R)*180/pi;da=A(2)-A(1);
% da(da>180)=-360+da(da>180);da(da<-180)=da(da<-180)+360;
% if da<-35&tmp(k,6)>=3&tmp(k,7)>90&tmp(k,7)<180
% k_in=kk(ii);break;
% end
% end
time=tmp(1,1);[yy,~,~]=datevec(time);
tline=fgetl(fidin);tline=tline(1:max(find(tline-0~=0)));
figure(1)
axesm( 'giso','Grid','on','MapLonLimit',[100 210],'MapLatLimit',[0 60]);
plotm(y,x,'k');
plotm(lat,lon,'k','linewidth',2),hold on
for jj=1:nt
if tmp(jj,6)<=6
plotm(lat(jj),lon(jj),'.','color',col(tmp(jj,6)+1) ,'markersize',10)
else
plotm(lat(jj),lon(jj),'yo','markersize',15)
end
end
plotm(lat(k_in),lon(k_in),'ro','markersize',10)
title([num2str(yy) ' ' tline]);tightmap;
% axis([100 180 0 50])
set(gcf,'unit','centimeters','position',[1 1 24 20]);
set(gca,'Position',[.1 .1 .8 .8]);
saveas(gcf,['track\' num2str(i,'%4d') '_' num2str(yy) '_' tline],'png')
close 1;
end