Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
8fce165a
Commit
8fce165a
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
renomme le fichier
parent
70587cda
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsg_util/readTsgDataTxt.m
+105
-0
105 additions, 0 deletions
tsg_util/readTsgDataTxt.m
with
105 additions
and
0 deletions
tsg_util/readTsgDataTxt.m
0 → 100644
+
105
−
0
View file @
8fce165a
function
[
error
]
=
readTsgDataTxt
(
hTsgGUI
,
filename
)
% Function to read the TSG data. Should be a NetCDF file
%
% Input
% -----
% hTsgGUI ............ Handle to the main user interface
% filename ........... Data filename
%
% Output
% ------
% error .............. 1: OK - -1 : an error occured
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
%
% Caution : replace the fill-value with NaN
% $Id$
% Get the data from the application GUI
% -------------------------------------
tsg
=
getappdata
(
hTsgGUI
,
'tsg_data'
);
% Display read file info on console
% ---------------------------------
fprintf
(
'\nREAD_ASCII_FILE\n'
);
tic
;
% Open the file
% -------------
fid
=
fopen
(
filename
,
'r'
);
% Check file
% -----------
if
fid
==
-
1
msg_error
=
[
'TSG_GOSUD file_lecture : Open file error : '
filename
];
warndlg
(
msg_error
,
'ASCII error dialog'
);
sprintf
(
'...cannot locate %s\n'
,
filename
);
error
=
-
1
;
return
;
end
% Display more info about read file on console
% --------------------------------------------
fprintf
(
'...reading %s : '
,
filename
);
% Read the file
% -------------
tsgData
=
fscanf
(
fid
,
'%d/%d/%d %d:%d:%d %f %f %f %f %d %f %f'
,
...
[
13
Inf
])
'
;
% Every variable are put in a structure
% -------------------------------------
tsg
.
DAYD
=
datenum
(
tsgData
(:,
3
),
tsgData
(:,
2
),
tsgData
(:,
1
),
...
tsgData
(:,
4
),
tsgData
(:,
5
),
tsgData
(:,
6
));
% save original date
% ------------------
tsg
.
DATE
=
datestr
(
tsg
.
DAYD
,
'yyyymmddHHMMSS'
);
% convert with julian day with origin 1950
% -----------------------------------------
%% a supprimer !!!!!!!
% tsg.TIME_TSG = datenumToJulian(tsg.TIME_TSG);
tsg
.
LATX
=
tsgData
(:,
7
);
tsg
.
LONX
=
tsgData
(:,
8
);
tsg
.
SSJT
=
tsgData
(:,
9
);
tsg
.
SSPS
=
tsgData
(:,
10
);
tsg
.
SSPS_QC
=
tsgData
(:,
11
);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tsg
.
SSPS_ADJ
=
tsgData
(:,
12
);
tsg
.
SSPS_ERR
=
tsgData
(:,
13
);
% Compute ship velocity from positions if sog not available
% ---------------------------------------------------------
if
isempty
(
tsg
.
SPDC
)
range
=
m_lldist
(
tsg
.
LONX
,
tsg
.
LATX
);
ind
=
size
(
tsg
.
DAYD
);
tsg
.
SPDC
=
zeros
(
size
(
ind
));
for
i
=
1
:
length
(
tsg
.
DAYD
)
-
1
tsg
.
SPDC
(
i
)
=
range
(
i
)
/
((
tsg
.
DAYD
(
i
+
1
)
-
tsg
.
DAYD
(
i
))
*
24
*
1.854
);
end
tsg
.
SPDC
=
[
tsg
.
SPDC
'
;
0
];
end
% Save the data in the application GUI
% ------------------------------------
setappdata
(
hTsgGUI
,
'tsg_data'
,
tsg
);
% Clear the Workspace
% -------------------
clear
tsgdata
% Close the file
% --------------
fclose
(
fid
);
% Display time to read file on console
% ------------------------------------
t
=
toc
;
fprintf
(
'...done (%6.2f sec).\n\n'
,
t
);
% Everything OK
% -------------
error
=
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment