Skip to content
Snippets Groups Projects
Commit 548e3a6f authored by Yves Gouriou's avatar Yves Gouriou
Browse files

Crée une fonction indépendante pour le calcul de la

vitesse du navire
parent c6ede6e1
No related branches found
No related tags found
No related merge requests found
function shipVelocity( hMainFig )
%
% Compute the ship velocity
%
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
% 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 tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg);
end
......@@ -9,6 +9,13 @@ function updateTsgStruct(hMainFig)
%
% $Id$
% Compute ship velocity from positions if sog not available
% Must be done first as we use getappdata and setappdata within
% the function
% ---------------------------------------------------------
shipVelocity( hMainFig );
% Get the data from the application GUI
% -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
......@@ -16,6 +23,10 @@ tsg = getappdata( hMainFig, 'tsg_data');
nPARA = 2;
PARA = ['SSPS'; 'SSJT'];
% Get NO_CONTROL and INTERPOLATED_VALUE codes
% -------------------------------------------
NO_CONTROL = get(tsg.qc.hash, 'NO_CONTROL', 'code');
% get min and max values for position and set to globals attributes
% -----------------------------------------------------------------
tsg.SOUTH_LATX = min(tsg.LATX);
......@@ -30,28 +41,17 @@ tsg.DATE_START = [date(1:8) date(10:15)];
date = datestr(max(tsg.DAYD),30);
tsg.DATE_END = [date(1:8) date(10:15)];
% 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
% Varaibles must exists
% Variables must exists
% ---------------------
for i = 1: nPARA
para1 = PARA(i,:);
if isempty( tsg.(para1) )
msgbox(['You must initialise the tsg.' PARA(i,:) ' variable'],...
'function ''updateTsgStruct''', ....
'warn', 'modal');
if ~isempty( tsg.(para1) ) && isempty( tsg.([para1 '_QC']) )
% If QC variables are emptied, fill them with NO_CONTROL code value
% -----------------------------------------------------------------
tsg.([para1 '_QC']) = castByteQC( NO_CONTROL, tsg.DAYD );
end
end
......@@ -84,7 +84,8 @@ if isempty(tsg.SSTP_LINCOEF)
tsg.SSTP_LINCOEF(2) = 0;
end
% Save tsg structure
% Save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg);
\ No newline at end of file
end
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