% compare_interp_profiles.m
%  plots vertical profiles of zinterp, pinterp, and model grid pinterp

clear;
close all;

data_path = '/Users/byronb/Raw_Data_Files.noindex/ENRR_2016/Fairall_processing/data2';
load(fullfile(data_path,'ENRR_G4_sonde_all_zinterp.mat'));
load(fullfile(data_path,'ENRR_G4_sonde_all_pinterp.mat'));
load(fullfile(data_path,'ENRR_G4_sonde_all_pinterp_modelGrid.mat'));

% set flight number and drop number
RF = 8; RFstr = sprintf('%02i',RF);
drop = 15; drop_str = sprintf('%02i',drop);
ii = snd_zinterp.RF==RF & snd_zinterp.drop_idx == drop;

error_p = ones(41,1)*10;
error_p_mGrid_pos = ones(21,1)*25;
error_p_mGrid_neg = ones(21,1)*25;
error_p_mGrid_pos(1:5) = [15;12.5;12.5;12.5;12.5];
error_p_mGrid_neg(1:5) = [12.5;12.5;12.5;12.5;25];

figure; plot(snd_zinterp.U(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.U(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.U(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('U m/s'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);

figure; plot(snd_zinterp.Un(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.Un(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.Un(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('Un m/s'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);

figure; plot(snd_zinterp.Ue(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.Ue(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.Ue(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('Ue m/s'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);

figure; plot(snd_zinterp.rh(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.rh(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.rh(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('RH %'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);

figure; plot(snd_zinterp.qa(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.qa(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.qa(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('q g/kg'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);

figure; plot(snd_zinterp.ta(:,ii),snd_zinterp.P(:,ii),'b-'); hold on;
errorbar(snd_pinterp.ta(:,ii),snd_pinterp.P,error_p,'ro');
errorbar(snd_pinterp_modelGrid.ta(:,ii),snd_pinterp_modelGrid.P,error_p_mGrid_neg,error_p_mGrid_pos,'gd');
hold off; grid; set(gca,'yDir','reverse');  xlabel('Tair, C'); ylabel('P, mb');
legend('zinterp','pinterp','modelGrid','location','best');
title(['ENRR G4 RF',RFstr,' drop sonde #',drop_str]);



