From 441e573dfb7ff06eb94c3a90ffe2f55b1b60e145 Mon Sep 17 00:00:00 2001 From: Neda Darbeheshti <neda.darbeheshti@aei.mpg.de> Date: Thu, 13 Apr 2017 18:12:46 +0200 Subject: [PATCH] read lri was added --- readKBR.m | 2 +- readLRI.m | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 readLRI.m diff --git a/readKBR.m b/readKBR.m index 2e465da..3871aee 100644 --- a/readKBR.m +++ b/readKBR.m @@ -4,7 +4,7 @@ function KBR1B = readKBR(file) % % cf. GRACE Level 1B Data Product User Handbook % -% Example: KBR1B = readKBR('KBR1B_2002-12-02_A_02.asc') +% Example: KBR1B = readKBR('KBR1B_2002-12-02_X_02.asc') % Counts header lines and removes them. header=0; diff --git a/readLRI.m b/readLRI.m new file mode 100644 index 0000000..6602549 --- /dev/null +++ b/readLRI.m @@ -0,0 +1,26 @@ +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 \ No newline at end of file -- GitLab