Skip to content
Snippets Groups Projects
Commit 4a1f704c authored by Axel Schnitger's avatar Axel Schnitger
Browse files

Initial commit.

parents
No related branches found
No related tags found
No related merge requests found
# Created by https://www.gitignore.io/api/matlab
### Matlab ###
##---------------------------------------------------
## Remove autosaves generated by the Matlab editor
## We have git for backups!
##---------------------------------------------------
# Windows default autosave extension
*.asv
# OSX / *nix default autosave extension
*.m~
# Compiled MEX binaries (all platforms)
*.mex*
# Simulink Code Generation
slprj/
# Session info
octave-workspace
function ACC1B = readACC(file)
% Input: ascii file containing GRACE ACC1B data
% Output: matrix containing ACC1B data
%
% cf. GRACE Level 1B Data Product User Handbook
%
% Example: ACC1B = readACC('ACC1B_2002-12-02_A_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 ACC1B data.
[gps_time, lin_acc_x, lin_acc_y, lin_acc_z, ang_acc_x, ang_acc_y, ang_acc_z] = textread(file,'%f %*s %f %f %f %f %f %f %*f %*f %*f %*f','headerlines',header);
% Produces the matrix containing the desired values.
ACC1B = [gps_time, lin_acc_x, lin_acc_y, lin_acc_z, ang_acc_x, ang_acc_y, ang_acc_z];
end
\ No newline at end of file
function GNV1B = readGNV(file)
% Input: ascii file containing GRACE GNV1B data
% Output: matrix containing GNV1B data
%
% cf. GRACE Level 1B Data Product User Handbook
%
% Example: GNV1B = readGNV('GNV1B_2002-12-02_A_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 GNV1B data.
[gps_time, xpos, ypos, zpos, xvel, yvel, zvel] = textread(file,'%f %*s %*s %f %f %f %*f %*f %*f %f %f %f %*f %*f %*f %*f ','headerlines',header);
% Produces the matrix containing the desired values.
GNV1B = [gps_time, xpos, ypos, zpos, xvel, yvel, zvel];
end
\ No newline at end of file
function KBR1B = readKBR(file)
% Input: ascii file containing GRACE KBR1B data
% Output: matrix containing KBR1B data
%
% cf. GRACE Level 1B Data Product User Handbook
%
% Example: KBR1B = readKBR('KBR1B_2002-12-02_A_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 KBR1B data.
[gps_time, range, range_rate, range_acc, lighttime_corr, lighttime_rate, lighttime_accl, ant_centr_corr, ant_centr_rate, ant_centr_accl] = textread(file,'%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.
KBR1B = [gps_time, range, range_rate, range_acc, lighttime_corr, lighttime_rate, lighttime_accl, ant_centr_corr, ant_centr_rate, ant_centr_accl];
end
\ No newline at end of file
function SCA1B = readSCA(file)
% Input: ascii file containing GRACE SCA1B data
% Output: matrix containing SCA1B data
%
% cf. GRACE Level 1B Data Product User Handbook
%
% Example: SCA1B = readSCA('SCA1B_2002-12-02_A_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 SCA1B data.
[gps_time, quatangle, quaticoeff, quatjcoeff, quatkcoeff, qual_rss] = textread(file,'%f %*s %*f %f %f %f %f %f %*f','headerlines',header);
% Produces the matrix containing the desired values.
SCA1B = [gps_time, quatangle, quaticoeff, quatjcoeff, quatkcoeff, qual_rss];
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment