
mode=2;
folder  ='/lhome/sprenger/PV_Inversion_Tool/';
filename='Z1_20060115_18';

% First image (otherwise first image is not correctly written)
figname = 'test.eps';
close;
fh=figure('Units','pixels','Position',[100 100 900 900])
set(gcf, 'PaperPosition', [2 1 15 10]);
print('-depsc2','-r0',figname);

% -------------------------------------------------------------------------- 
% Plot Coriolis parameter and get grid parameters
% --------------------------------------------------------------------------

if ( mode == 2 ) 

  m_deltax = cdf_loadV(folder,filename,'DELTAX');
  m_deltay = cdf_loadV(folder,filename,'DELTAY');
  m_deltaz = cdf_loadV(folder,filename,'DELTAZ');
  
  m_corlat = cdf_loadV(folder,filename,'CORLAT');
  m_coriol = cdf_loadV(folder,filename,'CORIOL');
  
  plot(m_coriol.var,m_corlat.var,'LineWidth',2)
  ylabel('Latitude','FontSize',15);
  xlabel('Coriolis parameter f','FontSize',15);
  
  figname = [ 'coriolis.eps' ];
  set(gcf, 'PaperPosition', [2 1 15 10]);
  print('-depsc2','-r0',figname);
 
end


% -------------------------------------------------------------------------- 
% Plot reference profile
% --------------------------------------------------------------------------

if ( mode == 3 ) 

  m_zref     = cdf_loadV(folder,filename,'ZREF');
  m_preref   = cdf_loadV(folder,filename,'PREREF');
  m_nsqref   = cdf_loadV(folder,filename,'NSQREF');
  m_rhoref   = cdf_loadV(folder,filename,'RHOREF');
  m_thetaref = cdf_loadV(folder,filename,'THETAREF');

  title('Reference profile');
  
  subplot(2,3,1);plot(10000*m_nsqref.var,  m_zref.var/1000); 
  xlabel('N^2 [10^{-4}s^{-2}]','FontSize',12);ylabel('Z [km]','FontSize',12);ylim([0 20]);
  
  subplot(2,3,2);plot(m_rhoref.var,  m_zref.var/1000); 
  xlabel('\rho [kg/m^3]','FontSize',12);ylim([0 20]);  
  
  subplot(2,3,3);plot(m_thetaref.var,m_zref.var/1000); 
  xlabel('\theta [K]','FontSize',12); ylim([0 20]);
  
  subplot(2,3,4);plot(10000*m_nsqref.var,  m_preref.var); 
  xlabel('N^2 [10^-{-4}s^{-2}]','FontSize',12);ylabel('P [hPa]','FontSize',12);set(gca,'YDir','reverse'); ylim([0 1020]);
  
  subplot(2,3,5);plot(m_rhoref.var,  m_preref.var); 
  xlabel('\rho [kg/m^3]','FontSize',12);set(gca,'YDir','reverse'); ylim([0 1020]);
  
  subplot(2,3,6);plot(m_thetaref.var,m_preref.var); 
  xlabel('\theta [K]','FontSize',12);set(gca,'YDir','reverse'); ylim([0 1020]);
 
  figname = [ 'reference.eps' ];
  set(gcf, 'PaperPosition', [2 1 15 10]);
  print('-depsc2','-r0',figname);
 
end


