% Simple MABEL data reader; reads in MABEL time and elevation data and plots % this information in two figures: (1) time of flight vs. vertical elevation; % and (2) ground distance covered during flight vs. vertical elevation. % The plots will show the entire returned photon set, so zoom in accordingly % to see the apparent ground returns (they should be fairly obvious, even in % noisy figures, with some minor searching). clear all; close all; % for instance, h5filename = 'mabel_l2_20120402t092900_008_1.h5'; h5filename = 'insert MABEL filename here'; % generates a single-column array of all returned-photon elevations elev_initial = hdf5read(h5filename,'/channel003/photon/ph_h'); % generates a single-column array of all corresponding returned-photon times time_initial = hdf5read(h5filename,'/channel003/photon/delta_time'); % plot up returned photon data with respect to time figure(1) plot(time_initial,elev_initial,'b.','MarkerSize',0.10) title(h5filename) xlabel('time (sec') ylabel('elevation (meters)') % use GPS-derived velocity and time to calculate approximate distance covered on the ground time_novatel = hdf5read(h5filename,'/novatel_ins/delta_time'); velocity_east = hdf5read(h5filename,'/novatel_ins/velocity/ins_v_east'); velocity_north = hdf5read(h5filename,'/novatel_ins/velocity/ins_v_north'); velocity_total = sqrt((velocity_east).^2.+(velocity_north).^2); % convert from m/s to km/hr velocity_kmhr = (velocity_total.*3600)./1000; % calculate maximum and minimum aircraft velocities from the 30-second data % segment min_vel = min(velocity_total); max_vel = max(velocity_total); % set threshold for continuing to determine distance -- if velocity in the % data segment varies by or less than 10 km/hr (2.8 m/s), calculate the average % velocity and move forward to calculate the distance covered in the data % segment if max_vel-min_vel > 20; break else avg_vel = mean(velocity_total); end % determine distance covered in 30-second data segment distance = avg_vel*max(time_initial); % determine distance covered in each consecutive time step (necessary for % plotting against elevation data) distance_initial = time_initial*(distance/max(time_novatel)); % plot returned photon data with respect to distance figure(2) plot(distance_initial,elev_initial,'r.','MarkerSize',0.10) title(h5filename) xlabel('distance (km)') ylabel('elevation (meters)')