Select Git revision
test_map.py
readLRI.m 983 B
function LRI1B = readLRI(file)
% Input: ascii file containing GRACE Follow-On LRI1B data
% Output: matrix containing LRI1B data
%
% cf. GRACE Follow-On Level 1B Data Product User Handbook
%
% Example: LRI1B = readLRI('LRI1B_2002-12-02_X_02.asc')
% Counts header lines and removes them.
header=0;
fid = fopen(file);
while 1
line = fgetl(fid);
header = header+1;
if (~isempty(strfind(line,'END OF HEADER')))
break
end
end
% Reads the desired values from LRI1B data.
[gps_time, range, range_rate, range_acc, lighttime_corr, lighttime_rate, lighttime_accl, tma_corr, tma_rate, tma_accl, pitch_A, yaw_A, pitch_B, yaw_B] = textread(file,'%f %f %f %f %*f %f %f %f %f %f %f %f %f %f %f %*f %*f %*f %*f %*f','headerlines',header);
% Produces the matrix containing the desired values.
LRI1B = [gps_time, range, range_rate, range_acc, lighttime_corr, lighttime_rate, lighttime_accl, tma_corr, tma_rate, tma_accl, pitch_A, yaw_A, pitch_B, yaw_B];
end