diff --git a/readKBR.m b/readKBR.m index 2e465daf25400103e25e25b190dadb78a6286e8b..3871aee27eb390660df0367a1ecf56fcb115c530 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 0000000000000000000000000000000000000000..6602549b746feca30db7996b7766dca193980cdb --- /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