sfile=input('File name (default = output)','s');
if isempty(sfile)
   sfile='output';
end   
sfsize=max(size(sfile))+2;
file=strcat(sfile,'/x.out');
load(file)
file=strcat(sfile,'/t.out');
load(file)
file=strcat(sfile,'/p.out');
load(file)
sa=size(x);
sam=max(sa);
carray=cellstr(num2str(transpose([1:sam])));
carray=[carray;cellstr('Exit')];
ss=sa(1,2)-1;
s1=size(t);
ss1=s1(1,1);
fr=[1:ss1];
xt=x+0.5.*(x(2)-x(1));
x2=xt(1:ss);
for j=1:30,
   m(j)=j;
end   
i=1;
while i == 1
    r=menu('Select from the following:','Precipitation (hovmuller)',...
   'Omega (hovmuller)','v (hovmuller)','u (hovmuller)','Surface T (hovmuller)',...
   'Fraction of potential evaporation','Surface shortwave (hovmuller)',...
   'Outgoing longwave (hovmuller)',...
   'High cloud fraction (hovmuller)','Low cloud fraction (hovmuller)',...
   'CAPE (hovmuller)','TC potential intensity (hovmuller)','Omega (cross-section)',...
   'Updraft mass flux (cross-section)','Downdraft mass flux (cross-section)',...
   'Cloud fraction (cross-section)','Streamfunction (cross-section)',...
   'Meridional velocity (cross-section)','Relative humidity (cross-section)',...
   'Perturbation temperature (cross-section)',...
   'Time mean energy fluxes','Time mean surface temperature',...
   'Precipitation spectrum','Zonal velocity spectrum',...
   'Surface temperature spectrum','Surface shortwave spectrum',...
   'Soundings','Add colorbar to plot','Make .png plot','Exit');
if r == m(2)
file=strcat(sfile,'/omegat.out');
load(file)
b=max(max(omegat));
a=min(min(omegat));
c=omegat;
pcolor(x,t,c)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Level 9 Omega (mb/hour) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(1)
file=strcat(sfile,'/precip.out');
load(file)
b=max(max(precip));
a=min(min(precip));
c=precip;
pcolor(x,t,c)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Precipitation (mm/day) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(3)
file=strcat(sfile,'/ut.out');
load(file)
b=max(max(-ut));
a=min(min(-ut));
c2=-ut;
pcolor(x2,t,c2)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Surface v (m/s) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(4)
file=strcat(sfile,'/vt.out');
load(file)
b=max(max(vt));
a=min(min(vt));
c2=vt(:,1:ss);
pcolor(x2,t,c2)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Surface u (m/s) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(5)
file=strcat(sfile,'/sst.out');
load(file)
b=max(max(sst));
a=min(min(sst));
c=sst;
pcolor(x,t,c)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Surface temperature (C) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(6)
file=strcat(sfile,'/efrac.out');
load(file)
b=max(max(efrac));
a=min(min(efrac));
c=efrac;
pcolor(x,t,c)   
shading interp
set(gca,'fontweight','bold','fontsize',12)
title(['Fraction of potential evaporation, from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(7)
file=strcat(sfile,'/sw.out');
load(file)
b=max(max(sw));
a=min(min(sw));
c=sw;
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['Surface absorbed SW (W/m^2) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(8)
file=strcat(sfile,'/olr.out');
load(file)
b=max(max(olr));
a=min(min(olr));
c=olr;
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['Outgoing longwave radiation (W/m^2) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(9)
file=strcat(sfile,'/hc.out');
load(file)
b=max(max(hc));
a=min(min(hc));
c=hc;
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['High cloud fraction from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(10)
file=strcat(sfile,'/lc.out');
load(file)
b=max(max(lc));
a=min(min(lc));
c=lc;
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['Low cloud fraction from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(11)
file=strcat(sfile,'/cape.out');
load(file)
b=max(max(cape));
a=min(min(cape));
c=cape;
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['CAPE (J/Kg) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(12)
file=strcat(sfile,'/mpi.out');
load(file)
b=max(max(mpi));
a=min(min(mpi));
c=mpi;
set(gca,'fontweight','bold','fontsize',12)
pcolor(x,t,c)   
shading interp
%g=colorbar;
%set(g,'fontweight','bold')
set(gca,'fontweight','bold','fontsize',12)
title(['Potential intensity (m/s) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('time (days)')
elseif r == m(13)
file=strcat(sfile,'/omegal.out');
load(file)
b=max(max(omegal));
a=min(min(omegal));
pcolor(x,-p,omegal)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Omega (mb/hour) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(14)
file=strcat(sfile,'/mul.out');
load(file)
b=max(max(mul));
a=min(min(mul));
pcolor(x,-p,mul)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Updraft mass flux from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(15)
file=strcat(sfile,'/mdl.out');
load(file)
b=max(max(mdl));
a=min(min(mdl));
pcolor(x,-p,mdl)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Downdraft mass flux from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(16)
file=strcat(sfile,'/cld.out');
load(file)
b=max(max(cld));
a=min(min(cld));
pcolor(x,-p,cld)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Cloud fraction, from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(17)
file=strcat(sfile,'/psi.out');
load(file)
psi2=psi(:,1:ss);
b=max(max(psi2));
a=min(min(psi2));
pcolor(x2,-p,psi2)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Streamfunction from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(18)
file=strcat(sfile,'/ul.out');
load(file)
ul=-ul;
b=max(max(ul));
a=min(min(ul));
pcolor(x,-p,ul)   
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['v (m/s) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(19)
file=strcat(sfile,'/rh.out');
load(file)
b=max(max(rh));
a=min(min(rh));
pcolor(x,p,rh)   
shading interp
set(gca,'ydir','reverse')
set(gca,'fontweight','bold','fontsize',12)
title(['Relative humidity from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(20)
file=strcat(sfile,'/temp.out');
load(file)
b=max(max(temp));
a=min(min(temp));
pcolor(x,-p,temp)
shading interp
u=get(gca,'YTick');
u1=transpose(-u);
v=cellstr(num2str(u1));
set(gca, 'YTickLabel',v)
set(gca,'fontweight','bold','fontsize',12)
title(['Perturbation temperature (C) from ',num2str(a),' to ',num2str(b)])
xlabel('x (km)')
ylabel ('Pressure (mb)')
elseif r == m(21)
file=strcat(sfile,'/flux.out');
load(file)
aflux=flux(1:ss,2);
oflux=flux(1:ss,3);
nflux=flux(1:ss,4);
h=plot(x2,aflux,x2,oflux);   
set(h,'linewidth',3)
set(gca,'fontweight','bold','fontsize',12)
title('Energy Fluxes')
legend('Atmosphere','Ocean',0)
xlabel('x (km)','fontweight','bold','fontsize',12)
ylabel ('Flux (10^{15} W)','fontweight','bold','fontsize',12)
elseif r == m(22)
file=strcat(sfile,'/sst.out');
load(file)
sstm=mean(sst,1);
h=plot(x,sstm);   
set(h,'linewidth',3)
set(gca,'fontweight','bold','fontsize',12)
title('Time-averaged Surface Temperature')
xlabel('x (km)','fontweight','bold','fontsize',12)
ylabel ('Surface Temperature (^{o}C)','fontweight','bold','fontsize',12)
elseif r == m(23)
   jj=1;
   while jj == 1
   file=strcat(sfile,'/precip.out');
   load(file)
   nrow=menu('Choose column number',carray);
   if nrow == sam+1
      break
   end   
   nrows=num2str(nrow);
   var2=precip(:,nrow);
   spectrum(t,var2)
   set(gca,'fontweight','bold','fontsize',12)
   u=get(gca,'XTick');
   u1=transpose(1./u);
   u1=0.01.*round(100.*u1);
   v=cellstr(num2str(u1));
   set(gca, 'XTickLabel',v);
   tit=['Precipitation, row number ' nrows];
   title(tit)
   xlabel('Period (days)','fontweight','bold','fontsize',12)
   ylabel ('Power','fontweight','bold','fontsize',12)
   end
elseif r == m(24)
   jj=1;
   while jj == 1
   file=strcat(sfile,'/vt.out');
   load(file)
   nrow=menu('Choose column number',carray);
   if nrow == sam+1
      break
   end   
   nrows=num2str(nrow);
   var2=vt(:,nrow);
   spectrum(t,var2)
   set(gca,'fontweight','bold','fontsize',12)
   u=get(gca,'XTick');
   u1=transpose(1./u);
   u1=0.01.*round(100.*u1);
   v=cellstr(num2str(u1));
   set(gca, 'XTickLabel',v);
   tit=['Meridional wind, row number ' nrows];
   title(tit)
   xlabel('Period (days)','fontweight','bold','fontsize',12)
   ylabel ('Power','fontweight','bold','fontsize',12)
   end
elseif r == m(25)
   jj=1;
   while jj == 1
   file=strcat(sfile,'/sst.out');
   load(file)
   nrow=menu('Choose column number',carray);
   if nrow == sam+1
      break
   end   
   nrows=num2str(nrow);
   var2=sst(:,nrow);
   spectrum(t,var2)
   set(gca,'fontweight','bold','fontsize',12)
   u=get(gca,'XTick');
   u1=transpose(1./u);
   u1=0.01.*round(100.*u1);
   v=cellstr(num2str(u1));
   set(gca, 'XTickLabel',v);
   tit=['Surface temperature, row number ' nrows];
   title(tit)
   xlabel('Period (days)','fontweight','bold','fontsize',12)
   ylabel ('Power','fontweight','bold','fontsize',12)
   end
elseif r == m(26)
   jj=1;
   while jj == 1
   file=strcat(sfile,'/sw.out');
   load(file)
   nrow=menu('Choose column number',carray);
   if nrow == sam+1
      break
   end   
   nrows=num2str(nrow);
   var2=sw(:,nrow);
   spectrum(t,var2)
   set(gca,'fontweight','bold','fontsize',12)
   u=get(gca,'XTick');
   u1=transpose(1./u);
   u1=0.01.*round(100.*u1);
   v=cellstr(num2str(u1));
   set(gca, 'XTickLabel',v);
   tit=['Surface absorbed shortwave, row number ' nrows];
   title(tit)
   xlabel('Period (days)','fontweight','bold','fontsize',12)
   ylabel ('Power','fontweight','bold','fontsize',12)
   end
elseif r == m(27)
   jj=1;
   while jj == 1
   file=strcat(sfile,'/p.out');
   load(file)
   file=strcat(sfile,'/tempnet.out');
   load(file)
   file=strcat(sfile,'/rh.out');
   load(file)
   nsound=menu('Choose sounding column number',carray);
   if nsound == sam+1
      file='output/skewt.out';
      break
   end   
   psound=transpose(p);
   tsound=tempnet(:,nsound)-273.15;
   rhsound=0.01.*rh(:,nsound);
   success=skewt(psound,tsound,rhsound);
   titstring=['Sounding at Column ' num2str(nsound)];
   title(titstring,'fontweight','bold','fontsize',12)
   end
elseif r == m(28)
   g=colorbar;
   set(g,'fontweight','bold')
elseif r == m(29)
   mf=max(size(file))-4;
   gg=file(sfsize:mf);
   fig=strcat(gg,'.png');
   exportfig(gcf,fig,'format','png','color','rgb','bounds','loose','Renderer','Painters','Resolution',300);
elseif r == m(30)
   break
end 
end
