clear;

load data\en_instability_dat.mat;
load D:\wrk\proposal\HFIP_2020\data\land.mat;

colormap('jet');

k1=subplot(2,2,1);
contourf(lon,lat,cwm_h,[0:0.5:5],'edgecolor','none');
caxis([0 5]);
c1=colorbar;
hold on;
%plot(lon(110:150,268),lat(110:150,268),'w');
%plot([-105.5,-103],[16.43 16.43],'w');
%axis([-104.55,-104.05,16.2,16.7]);
axis([-107.1,-101.2,13.6,19.3]);
plot(lon(120,268),lat(120,268),'g*');
plot(lon(121,268),lat(121,268),'r*');
plot(lon(122,268),lat(122,268),'k*');
xlabel('Longitude');
ylabel('Latitude');
h=title('(a) $q_{c}$ (g/kg) at z=3.4 km','interpreter','latex'); 
set(h,'fontweight','normal');
[c,h]=contour(hlon,hlat,mask,[1 100],'w');
hold off;

k2=subplot(2,2,2);
plot(th_e1,z_m,'g');
hold on;
plot(th_e2,z_m,'r');
plot(th_e3,z_m,'k');
xlabel('(K)');
ylabel('Height (km)');
h=title('(b) $\theta_{e}$ profile at the edge of eyewall','interpreter','latex'); 
set(h,'fontweight','normal');
axis([345,362,0,5.6]);
h=legend('at green *','at red *','at black *');
set(h,'box','off','location','southeast','fontsize',7);
hold off;

k3=subplot(2,2,3);
plot(qt_1*1000,z_m,'g');
hold on;
plot(qt_2*1000,z_m,'r');
plot(qt_3*1000,z_m,'k');
xlabel('(g/kg)');
ylabel('Height (km)');
h=title('(c) $q_{t}$ profile at the edge of eyewall','interpreter','latex'); 
set(h,'fontweight','normal');
axis([5,25,0,5.6]);
h=legend('at green *','at red *','at black *');
set(h,'box','off','location','southwest','fontsize',7);
hold off;

k4=subplot(2,2,4);
h1=plot(dth_e-cri,z_m,'b');
hold on;
h2=plot(dth_e1-cri1,z_m,'b:');
h3=plot(dth_e2-cri2,z_m,'b--');
plot([0 0],[0 6],'g--');
xlabel('(K)');
ylabel('Height (km)');
title('(d) $\Delta \theta_{e} - \overline{\theta}\Delta q_{t}/\alpha$','interpreter','latex'); 
axis([-7,1,0,5.6]);
h=legend([h1 h2 h3],'green * - red *','red * - black *','green * - black *');
set(h,'box','off','location','southwest');
hold off;

set(k1,'position',[0.16 0.58 0.27 0.37],'fontsize',8);
set(c1,'position',[0.44 0.58 0.02 0.37],'fontsize',8);
set(k2,'position',[0.54 0.58 0.31 0.37],'fontsize',8);
set(k3,'position',[0.16 0.08 0.31 0.37],'fontsize',8);
set(k4,'position',[0.54 0.08 0.31 0.37],'fontsize',8);

%print -dpng en_instability_HWRF
