Skip to content
Snippets Groups Projects
Commit c3095a03 authored by gael.alory_legos.obs-mip.fr's avatar gael.alory_legos.obs-mip.fr
Browse files

mise au propre des modifs pour lecture Astrolabe et exemple de fichiers de donnees

parent 518d4e8b
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
File added
function [error] = readAsciiTsg( hMainFig, filename )
% readAsciiTsg( hMainFig, filename )
% Function to read TSG data in ASCII format.
function [error] = readTsgDataAstrolabe( hMainFig, filename )
% readTsgDataAstrolabe( hMainFig, filename )
% Function to read TSG data from Astrolabe ship.
%
% Input
% -----
% hMainFig ........... Handle to the main user interface
% filename ........... Data filename
% type ............... Can read 3 types of data : WS, EXT, TSG
%
% Output
% ------
% error .............. 1: OK - -1 : an error occured
%
% $Id: readAsciiTsg.m 457 2009-03-23 14:00:24Z jgrelet $
% Get the data from the application GUI
% -------------------------------------
......@@ -38,7 +36,7 @@ fid = fopen( filename, 'rt' );
% Check file
% -----------
if fid == -1
msg_error = ['TSG_GOSUD file_lecture : Open file error : ' filename];
msg_error = ['TSG file : Open file error : ' filename];
warndlg( msg_error, 'ASCII error dialog');
sprintf('...cannot locate %s\n', filename);
error = -1;
......@@ -96,7 +94,7 @@ while ~OK
end
end
% Builld the format depending on the header parameters
% Build the format depending on the header parameters
% 1 - Decimate the HEADER - The 5th first parameters are always
% %HEADER YEAR MNTH DAYX hh mm ss
% 2 - The 4 Date and time parametes are read in %d
......@@ -119,10 +117,13 @@ clear cellData
% Date (y m d h m s) in the first 4 elements in data
% --------------------------------------------------
ddmmyy = char(s.(char(header(1)))) ;
%ddmmyy_str = sprintf('%06d', ddmmyy);
dd = str2num(ddmmyy(:,1:2));
mm = str2num(ddmmyy(:,3:4));
yy = 2000 + str2num(ddmmyy(:,5:6)); % Attn: valab apres 2000!
% Warning: for post-2000 files only!
% ----------------------------------
yy = 2000 + str2num(ddmmyy(:,5:6));
hh = double( s.(char(header(2))) );
mi = double( s.(char(header(3))) );
ss = double( s.(char(header(4))) );
......@@ -144,9 +145,28 @@ for i = 5 : nHeader
end
flagG=1;%par defaut, tout a Good
flagB=3;%par defaut, probably Bad avant correction
%by default, flag=probably Bad before correction
flagB=3;
%by default, flag=Good for all adjusted variables
flagG=1;
% Fill TSG attributes
% -------------------
tsg.PLATFORM_NAME='astrolabe';
tsg.SHIP_CALL_SIGN='FHZI';
tsg.PROJECT_NAME='SURVOSTRAL';
tsg.PI_NAME='Rosemary Morrow';
tsg.DATA_ACQUISITION='IPEV';
tsg.PROCESSING_CENTRE='SURVOSTRAL';
tsg.PROCESSING_STATES='2C+';
tsg.SAMPLING_PERIOD='60';
% Missing value to be replaced by NaNs
% ------------------------------------
miss=-90;
% Fill TSG variables
% ------------------
tsg.SSTP_QC=repmat(flagG,[length(tsg.DAYD) 1]);
tsg.SSPS_QC=repmat(flagB,[length(tsg.DAYD) 1]);
tsg.SSPS_ADJUSTED_QC=repmat(flagG,[length(tsg.DAYD) 1]);
......@@ -156,14 +176,6 @@ tsg.SSJT(tsg.SSJT<miss)=nan;
tsg.SSTP_QC(isnan(tsg.SSTP))=nan;
tsg.SSPS_QC(isnan(tsg.SSPS))=nan;
tsg.SSPS_ADJUSTED_QC(isnan(tsg.SSPS))=nan;
tsg.PLATFORM_NAME='astrolabe';
tsg.SHIP_CALL_SIGN='FHZI';
tsg.PROJECT_NAME='SURVOSTRAL';
tsg.PI_NAME='Rosemary Morrow';
tsg.DATA_ACQUISITION='IPEV';
tsg.PROCESSING_CENTRE='SURVOSTRAL';
tsg.PROCESSING_STATES='2C+';
tsg.SAMPLING_PERIOD='60';
% populate tsg.file structure
......
......@@ -1246,7 +1246,7 @@ hrbInterpCancel = uicontrol( ...
case 9 % read TSG Astrolabe text file *.ast
tsg_initialisation(hMainFig);
errTsg = readAsciiAstro( hMainFig, fullFileName);
errTsg = readTsgDataAstrolabe( hMainFig, fullFileName);
otherwise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment