% gfd_profile_plot % plots variables versus height for a profile % calls gfd_flightlevel_set_variables.m % based on airplotyy (Ian Renfrew 1997), clamp_aws_plot, and dplot2 (Dave Sproson) %---------------------------------------------- % *** set up and load data set %---------------------------------------------- idata = 268; data_name = 'B268'; if (idata == 268) filea = 'C:\data\gfd\FAAM\B268\B268_flightlevel_1hz_v1.mat'; fileb = 'C:\data\gfd\FAAM\B268\B268_flightlevel_diagnostics_1hz_v1.mat'; dirp = 'C:\data\gfd\B268_RTJ\flightlevel_pics'; tleg = [13 30 00; 13 37 37;]; tlegb = [13 39 04; 13 46 00;]; profile_name = ' Profile 1'; isplit=1; % tleg = [14 17 32; 14 35 00;]; profile_name = ' Profile 2'; isplit=0; end; cd(dirp) disp(['loading ' filea]); load(filea); disp(['loading ' fileb]); load(fileb); %-------------------------------------------------------------- % find indices for the profile (either split or unsplit) % if profile is interrupted, add sections together % find start and end times of profile: hhmm_start, hhmm_end % set up z-axis as height (plot as z though) % Note: at present same z for all panels %-------------------------------------------------------------- if (isplit==1) disp('Split profile used'); time_leg = [tleg(1,1)*3600+tleg(1,2)*60+tleg(1,3) tleg(2,1)*3600+tleg(2,2)*60+tleg(2,3)]; % Convert to seconds time_legb = [tlegb(1,1)*3600+tlegb(1,2)*60+tlegb(1,3) tlegb(2,1)*3600+tlegb(2,2)*60+tlegb(2,3)]; % Convert to seconds e1a = find(time_leg(1)<=time & time<=time_leg(2)); e1b = find(time_legb(1)<=time & time<=time_legb(2)); e1 = [e1a' e1b']; else time_leg = [tleg(1,1)*3600+tleg(1,2)*60+tleg(1,3) tleg(2,1)*3600+tleg(2,2)*60+tleg(2,3)]; % Convert to seconds e1 = find(time_leg(1)<=time & time<=time_leg(2)); end; hhmm_start = [num2str(hh(e1(1))) ':' num2str(mi(e1(1)))]; if (mi(e1(1))<10) hhmm_start = [num2str(hh(e1(1))) ':0' num2str(mi(e1(1)))]; end; hhmm_end = [num2str(hh(e1(length(e1)))) ':' num2str(mi(e1(length(e1))))]; if (mi(e1(length(e1)))<10) hhmm_end = [num2str(hh(e1(length(e1)))) ':0' num2str(mi(e1(length(e1))))]; end; z_lim = [0 5000]; z.data = gps_alt(e1)-50; z.label ='gps height (m)'; z.lim = z_lim; disp([z.label ' used as z axis, with offset = ' num2str(50) ' m']); %----------------------------------------------------------------- % *** Set number of panels to plot: npanels % *** Set number of lines to plot in each panel: nlines % *** Set number of axes for each panel: naxes = 1 for profile_plot % *** Set plotting variables for each line: i %------------------------------------------------------------------ npanels = 4; % set as 4 for profile plots for j=1:npanels if (j==1) nlines=2; naxes=1; i=[61 63]; end; if (j==2) nlines=2; naxes=1; i=[60 62]; end; if (j==3) nlines=3; naxes=1; i=[50 51 52]; end; if (j==4) nlines=1; naxes=1; i=[48]; end; if ((naxes==2)&(nlines ~=2)) disp('Problem in gfd_run_plot: nlines not equal to 2'); end; if (nlines ~= length(i)) disp('Problem in gfd_run_plot: nlines not equal to no. of variables set'); end; %------------------------------------------------------------- % loop over nlines to plot in each panel (max of 3) % put variable details into a structure y(k) %------------------------------------------------------------- for k = 1:nlines gfd_flightlevel_set_variables; % *** Define plotting variables here y(k).data = yd(e1); y(k).label = y_label; y(k).label2 = y_label2; y(k).lim = y_lim; y(k).tick = y_tick; end; %----------------------------------------------------------- % plot with single axes: axes limits should be the same for each line %------------------------------------------------------------ pstyle = char('b-','r-','g-'); % plotline style for k = 1:nlines subplot(2,2,j), plot(y(k).data, z.data, pstyle(k,:)); hold on; end; hold off; h = gca; grid on; set(h, 'ylim', z.lim) set(h, 'xlim', y(k).lim) set(h, 'xtick', [y(k).lim(1): y(k).tick: y(k).lim(2)]) ylabel(z.label) xlabel(y(k).label) if (nlines == 2) legend(y(1).label2, y(2).label2) elseif (nlines ==3) legend(y(1).label2, y(2).label2, y(3).label2) end; if (j==1) title([data_name profile_name ' - ' hhmm_start ' to ' hhmm_end]); end; end % j loop over no. of panels orient tall