Newer
Older
%TSGQC Thermosalinograph (TSG) Quality Control software
% TSGQC is a software for interactive analysis and validation of
% underway SST / SSS (Sea Surface Temperature and Sea Surface Salinity)

jacques.grelet_ird.fr
committed
% measurements from a SeaBird Thermosalinograph (TSG).
% It has been developed under Matlab.
% Usage:
% tsgqc help
%
% See:
% Documentation: http://www.ird.fr/us191/spip.php?article63
% Source code: https://git.outils-is.ird.fr/grelet/TSG-QC
%
% Tips:
% To get and check tsg structure anywhere during debug:
% tsg = getappdata( findobj('Tag', 'TAG_TSG-QC_GUI'), 'tsg_data')
% Copyright 2007-2018 - IRD US191, all rights reserved.
% This file is part of tsgqc.
% TSG-QC is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as publDisplayished by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% tsgqc is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Datagui; if not, write to the Free Software
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

jacques.grelet_ird.fr
committed
%% Define global variables for VERSIONING
% ---------------------------------------

jacques.grelet_ird.fr
committed
global CHAR_VERSION

jacques.grelet_ird.fr
committed
global GOSUD_FORMAT_VERSION

jacques.grelet_ird.fr
committed
% version number, may be used to initialize some files when it change
% 0.90x -> 1.0RCx

jacques.grelet_ird.fr
committed
% if you modify the tsgqc.preference structure, you need to increment
% or modify the version number to load a new default structure

jacques.grelet_ird.fr
committed
% -------------------------------------------------------------------
DATE_VERSION = '07/01/2019';

jacques.grelet_ird.fr
committed
% netcdf file version, see DATA FORMAT TSG document:

jacques.grelet_ird.fr
committed
% --------------------------------------------------

jacques.grelet_ird.fr
committed
GOSUD_FORMAT_VERSION = '3.02';

jacques.grelet_ird.fr
committed
%% Initialization tasks
% ********************
% Clear Command Window display, giving up a "clean screen."
% ---------------------------------------------------------
clc;
% Find program directory.
% functions (icons) should be store at a lower level
% add directories to Matlab search path, works on UNIX
% and Windows host
% ---------------------------------------------------
tsgqcname = mfilename;
fulltsgqcname = mfilename('fullpath');

jacques.grelet_ird.fr
committed
% regular expression expr if it occurs at the end of the input string
% -------------------------------------------------------------------

jacques.grelet_ird.fr
committed
expr = strcat(tsgqcname, '$');

jacques.grelet_ird.fr
committed
% get pathname
% ------------
DEFAULT_PATH_FILE = regexprep(fulltsgqcname, expr, '');
% update Matlab pathdef only for session
% addpath isn't mandatory and failed with compiled applications
% -------------------------------------------------------------
if (~isdeployed)
p = [pathsep,...
DEFAULT_PATH_FILE,[ 'tsg_util' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_data' pathsep],...

jacques.grelet_ird.fr
committed
DEFAULT_PATH_FILE,[ 'tsg_io' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_icon' pathsep],...

jacques.grelet_ird.fr
committed
DEFAULT_PATH_FILE,[ 'tsg_climato' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_map' pathsep]
];
addpath( p, '-end' );
rehash;
end
% define 'HandleVisibility' property for all objects
% --------------------------------------------------
handleVisibility = 'on';

jacques.grelet_ird.fr
committed
% % get screen dimensions (pixels)
% % ------------------------------
% set(0,'Units','pixels');
% screenSize = get(0,'ScreenSize');

jacques.grelet_ird.fr
committed
% % set default font size
% % ---------------------
% if screenSize(3) <= 1024
% tsg.fontSize = 9;
% else
% tsg.fontSize = 11;
% end
% Screen limits for the GUI
% -------------------------

jacques.grelet_ird.fr
committed
if verLessThan('matlab','8.4')
set(0,'Units','normalized');
guiLimits = get(0,'ScreenSize');
else
r = groot;
r.Units = 'normalized';
guiLimits = r.ScreenSize;
end
guiLimits(1) = guiLimits(1) + 0.01;
guiLimits(2) = guiLimits(2) + 0.05;
guiLimits(3) = guiLimits(3) - 0.02;
guiLimits(4) = guiLimits(4) - 0.15;
%% Optional arguments
% --------------------
inputFile = '';
outputFile = '';
display = false;
DEBUGGING = false;
help = false;
% parse and set optional arguments with couple 'property', 'value'
% -----------------------------------------------------------------
if length(varargin) == 1
inputFile = varargin{1};
end
while length(property_argin) >= 2
property = property_argin{1};
value = property_argin{2};
property_argin = property_argin(3:end);
switch lower(property)
case {'inputfile', 'input', 'file'}
inputFile = value;
case {'outputfile', 'output'}
outputFile = value;
case 'display'
display = value;
case 'help'
help = value;
error('Unknow property: %s', property);
end
end
% if property display is set to display, display them and quit
% -----------------------------------------------------------
fprintf('inputFile: %s\noutpuFile: %s\n', inputFile, outputFile);
return;
end
% if property help is set to on, display help and quit
% -----------------------------------------------------------
if strcmp(help, 'on') || ~isempty(strfind(inputFile,'help'))
fprintf('tsgqc usage:\n');
fprintf('tsgqc(''<file>'')\n');
fprintf('tsgqc(''inputfile'', <file>, ''outputfile'', <file>)\n');
fprintf('tsgqc(''inputfile'', <file>, ''outputfile'', <file>),''display'',''true''\n');
fprintf('tsgqc(''help'',''true'')\n');
fprintf('tsgqc(''<file>'', ''debug'', 1)\n');
return;
end
%% Main TSGQC GUI
% ---------------
% Check if main TSGQC figure exist
% --------------------------------
hMainFig = findobj('Tag', 'TAG_TSG-QC_GUI');
% if TSGQC figure exist and still running, don't create a new instance
% --------------------------------------------------------------------
if ~isempty(hMainFig)
Loading
Loading full blame...