University of Edinburgh, 04-09-2014 Author: Luca Foresta This file is a guide for reading L2Swath binary files. Once loaded the file as 'float32', the last two bytes give information on how to unpack the single fields. Namely: last byte = rec_size (amount of waveforms in file) last byte -1 = meas_size (amount of lon/lat/elev measurements in file) The fields in the binary file are saved in the following order (their size in bytes is given in square brackets): 1. [meas_size] Longitude 2. [meas_size] Latitude 3. [meas_size] Elevation 4. [meas_size] Waveform number of measurement (identifies the original waveform number of the given measurement) 5. [512*rec_size] Power matrix 6. [512*rec_size] Phase matrix (unwrapped, masked) 7. [512*rec_size] Coherence matrix 8. [rec_size] Linear phase fit error 9. [rec_size] Quadratic phase fit error Example code to read the files is given here: % fid2 = fopen(filename); % data = fread(fid2,'float32'); % fclose(fid2); % % % reconstruct fields % % record_size = data(end); % measurement_size = data(end-1); % % longitude = data(1:measurement_size); % latitude = data(measurement_size+1:measurement_size*2); % elevation = data(measurement_size*2+1:measurement_size*3); % waveform_number = data(measurement_size*3+1:measurement_size*4); % % marker1 = measurement_size*4 +1; % datastep = record_size*512; % power_data = data(marker1:marker1+datastep-1); % power_data = reshape(power_data, 512, record_size); % phase_data = data(marker1+datastep:marker1+datastep*2-1); % phase_data = reshape(phase_data, 512, record_size); % coh_data = data(marker1+datastep*2:marker1+datastep*3-1); % coh_data = reshape(coh_data, 512, record_size); % % marker2 = marker1+datastep*3 + 1; % phaseLin_err = data(marker2:marker2+record_size); % phaseQuad_err = data(marker2+1+record_size:marker2+record_size*2);