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
6ca994a6
Commit
6ca994a6
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
utilise les conventions NetCDF V1.4
parent
381190a2
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
tsgqc_GUI.m
+175
-84
175 additions, 84 deletions
tsgqc_GUI.m
with
175 additions
and
84 deletions
tsgqc_GUI.m
+
175
−
84
View file @
6ca994a6
...
@@ -62,13 +62,14 @@ function tsgqc_GUI
...
@@ -62,13 +62,14 @@ function tsgqc_GUI
'Resize'
,
'on'
,
...
'Resize'
,
'on'
,
...
'Menubar'
,
'none'
,
...
'Menubar'
,
'none'
,
...
'Toolbar'
,
'none'
,
...
'Toolbar'
,
'none'
,
...
'
Tag
'
,
'ButtonMotionOff'
,
...
'
UserData
'
,
'ButtonMotionOff'
,
...
'WindowButtonMotionFcn'
,
@
MouseMotion
,
...
'WindowButtonMotionFcn'
,
@
MouseMotion
,
...
'CloseRequestFcn'
,
@
QuitProgram
,
...
'CloseRequestFcn'
,
@
QuitProgram
,
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Visible'
,
'on'
,
...
'Visible'
,
'on'
,
...
'Units'
,
'normalized'
,
...
'Units'
,
'normalized'
,
...
'Position'
,
guiLimits
);
'Position'
,
guiLimits
,
...
'Color'
,
get
(
0
,
'DefaultUIControlBackgroundColor'
));
% Construct the Menu
% Construct the Menu
% -----------------
% -----------------
...
@@ -78,7 +79,7 @@ function tsgqc_GUI
...
@@ -78,7 +79,7 @@ function tsgqc_GUI
'Label'
,
'File'
);
'Label'
,
'File'
);
hOpenMenu
=
uimenu
(
...
hOpenMenu
=
uimenu
(
...
'Parent'
,
hFileMenu
,
...
'Parent'
,
hFileMenu
,
...
'
Tag
'
,
'off'
,
...
'
UserData
'
,
'off'
,
...
'Label'
,
'Open'
,
...
'Label'
,
'Open'
,
...
'Accelerator'
,
'O'
,
...
'Accelerator'
,
'O'
,
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
...
@@ -87,7 +88,7 @@ function tsgqc_GUI
...
@@ -87,7 +88,7 @@ function tsgqc_GUI
'Parent'
,
hFileMenu
,
...
'Parent'
,
hFileMenu
,
...
'Label'
,
'Save'
,
...
'Label'
,
'Save'
,
...
'Accelerator'
,
'S'
,
...
'Accelerator'
,
'S'
,
...
'
Tag
'
,
'off'
,
...
'
UserData
'
,
'off'
,
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Callback'
,
@
SaveMenuCallback
);
'Callback'
,
@
SaveMenuCallback
);
hQuitMenu
=
uimenu
(
...
hQuitMenu
=
uimenu
(
...
...
@@ -103,12 +104,24 @@ function tsgqc_GUI
...
@@ -103,12 +104,24 @@ function tsgqc_GUI
hToolbar
=
uitoolbar
(
...
% Toolbar for Open and Print buttons
hToolbar
=
uitoolbar
(
...
% Toolbar for Open and Print buttons
'Parent'
,
hMainFig
,
...
'Parent'
,
hMainFig
,
...
'HandleVisibility'
,
'callback'
);
'HandleVisibility'
,
'callback'
);
hOpenPushtool
=
uipushtool
(
...
% Opendoc toolbar button
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Open file'
,
...
'CData'
,
iconRead
(
fullfile
(
matlabroot
,
...
'/toolbox/matlab/icons/opendoc.mat'
)),
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_OPEN'
,
...
'UserData'
,
'off'
,
...
'Enable'
,
'on'
,
...
'ClickedCallback'
,
@
OpenMenuCallback
);
hSavePushtool
=
uipushtool
(
...
% Open Save toolbar button
hSavePushtool
=
uipushtool
(
...
% Open Save toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Save file'
,
...
'TooltipString'
,
'Save
NetCDF
file'
,
...
'CData'
,
iconRead
(
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'savedoc.mat'
]),
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'savedoc.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_SAVE'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
SaveMenuCallback
);
'ClickedCallback'
,
@
SaveMenuCallback
);
hZoomPushtool
=
uipushtool
(
...
% Open Zoom toolbar button
hZoomPushtool
=
uipushtool
(
...
% Open Zoom toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
...
@@ -117,6 +130,8 @@ function tsgqc_GUI
...
@@ -117,6 +130,8 @@ function tsgqc_GUI
'CData'
,
iconRead
(
fullfile
(
matlabroot
,
...
'CData'
,
iconRead
(
fullfile
(
matlabroot
,
...
'/toolbox/matlab/icons/zoom.mat'
)),
...
'/toolbox/matlab/icons/zoom.mat'
)),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_ZOOM'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
ZoomMenuCallback
);
'ClickedCallback'
,
@
ZoomMenuCallback
);
hPanPushtool
=
uipushtool
(
...
% Open Pan toolbar button
hPanPushtool
=
uipushtool
(
...
% Open Pan toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
...
@@ -124,43 +139,62 @@ function tsgqc_GUI
...
@@ -124,43 +139,62 @@ function tsgqc_GUI
'CData'
,
iconRead
(
fullfile
(
matlabroot
,
...
'CData'
,
iconRead
(
fullfile
(
matlabroot
,
...
'/toolbox/matlab/icons/pan.mat'
)),
...
'/toolbox/matlab/icons/pan.mat'
)),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_PAN'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
PanMenuCallback
);
'ClickedCallback'
,
@
PanMenuCallback
);
hQCPushtool
=
uipushtool
(
...
% Open QC toolbar button
hQCPushtool
=
uipushtool
(
...
% Open QC toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Validation codes'
,
...
'TooltipString'
,
'Validation codes'
,
...
'Separator'
,
'on'
,
...
'Separator'
,
'on'
,
...
'Tag'
,
'off'
,
...
'CData'
,
iconRead
(
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'qcicon.mat'
]),
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'qcicon.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'QC'
,
...
'UserData'
,
'off'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
QCMenuCallback
);
'ClickedCallback'
,
@
QCMenuCallback
);
hMapPushtool
=
uipushtool
(
...
% Open Map toolbar button
hMapPushtool
=
uipushtool
(
...
% Open Map toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Map and ship track'
,
...
'TooltipString'
,
'Map and ship track'
,
...
'Separator'
,
'on'
,
...
'Separator'
,
'on'
,
...
'Tag'
,
'off'
,
...
'CData'
,
iconRead
(
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'mapicon.mat'
]),
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'mapicon.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_MAP'
,
...
'UserData'
,
'off'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
MapMenuCallback
);
'ClickedCallback'
,
@
MapMenuCallback
);
hClimPushtool
=
uipushtool
(
...
% Open Climatology toolbar button
hClimPushtool
=
uipushtool
(
...
% Open Climatology toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Climatology'
,
...
'TooltipString'
,
'Climatology'
,
...
'Separator'
,
'on'
,
...
'Separator'
,
'on'
,
...
'Tag'
,
'off'
,
...
'CData'
,
iconRead
(
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'climicon.mat'
]),
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'climicon.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_CLIM'
,
...
'UserData'
,
'off'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
ClimMenuCallback
);
'ClickedCallback'
,
@
ClimMenuCallback
);
hBottlePushtool
=
uipushtool
(
...
% Open toolbar button
hBottlePushtool
=
uipushtool
(
...
% Open toolbar button
'Parent'
,
hToolbar
,
...
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Plot the Samples'
,
...
'TooltipString'
,
'Plot the Samples'
,
...
'Separator'
,
'on'
,
...
'Separator'
,
'on'
,
...
'Tag'
,
'off'
,
...
'CData'
,
iconRead
(
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'bottleicon.mat'
]),
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'bottleicon.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'BOTTLE'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
BottleMenuCallback
);
'ClickedCallback'
,
@
BottleMenuCallback
);
hHeaderPushtool
=
uipushtool
(
...
% Open headerForm button
'Parent'
,
hToolbar
,
...
'TooltipString'
,
'Fill the header form'
,
...
'Separator'
,
'on'
,
...
'CData'
,
iconRead
(
...
[
DEFAULT_PATH_FILE
'tsg_icon'
filesep
'hdricon.mat'
]),
...
'HandleVisibility'
,
'callback'
,
...
'Tag'
,
'PUSHTOOL_HEADER'
,
...
'Enable'
,
'off'
,
...
'ClickedCallback'
,
@
HeaderMenuCallback
);
% Static text that displays the position, salinity and temperature
% Static text that displays the position, salinity and temperature
% ----------------------------------------------------------------
% ----------------------------------------------------------------
...
@@ -208,11 +242,12 @@ function tsgqc_GUI
...
@@ -208,11 +242,12 @@ function tsgqc_GUI
'Units'
,
'normalized'
,
...
'Units'
,
'normalized'
,
...
'Visible'
,
'off'
,
...
'Visible'
,
'off'
,
...
'Color'
,
'none'
,
...
'Color'
,
'none'
,
...
'
Tag
'
,
'off'
,
...
'
UserData
'
,
'off'
,
...
'UserData'
,
[],
...
'UserData'
,
[],
...
'HandleVisibility'
,
'callback'
,
...
'HandleVisibility'
,
'callback'
,
...
'Position'
,[
.
05
,
.
05
,
.
9
,
.
9
]);
'Position'
,[
.
05
,
.
05
,
.
9
,
.
9
]);
% Construct the context menu for the Quality control codes
% Construct the context menu for the Quality control codes
% -------------------------------------------------------
% -------------------------------------------------------
hQcCmenu
=
uicontextmenu
(
...
hQcCmenu
=
uicontextmenu
(
...
...
@@ -275,6 +310,7 @@ function tsgqc_GUI
...
@@ -275,6 +310,7 @@ function tsgqc_GUI
error1
=
-
1
;
error1
=
-
1
;
error2
=
-
1
;
error2
=
-
1
;
if
~
isequal
(
filename
,
0
)
if
~
isequal
(
filename
,
0
)
% Read the data
% Read the data
...
@@ -287,6 +323,10 @@ function tsgqc_GUI
...
@@ -287,6 +323,10 @@ function tsgqc_GUI
error1
=
tsg_readTsgDataXML
(
hMainFig
,
filename
);
error1
=
tsg_readTsgDataXML
(
hMainFig
,
filename
);
case
3
case
3
error1
=
tsg_readTsgDataNetCDF
(
hMainFig
,
filename
);
error1
=
tsg_readTsgDataNetCDF
(
hMainFig
,
filename
);
%# a modifier
if
error1
==
1
error2
=
error1
;
end
case
4
case
4
error2
=
tsg_readBucketData
(
hMainFig
,
filename
);
error2
=
tsg_readBucketData
(
hMainFig
,
filename
);
otherwise
otherwise
...
@@ -300,12 +340,15 @@ function tsgqc_GUI
...
@@ -300,12 +340,15 @@ function tsgqc_GUI
% A TSG file has been open and read
% A TSG file has been open and read
% ---------------------------------
% ---------------------------------
set
(
hOpenMenu
,
'Tag'
,
'on'
);
set
(
hOpenMenu
,
'UserData'
,
'on'
);
hdl_pushtool
=
findobj
(
'-regexp'
,
'Tag'
,
'PUSHTOOL_'
);
set
(
hdl_pushtool
,
'Enable'
,
'on'
);
% The callback to detect the mouse motion can be set to on
% The callback to detect the mouse motion can be set to on
% --------------------------------------------------------
% --------------------------------------------------------
set
(
hMainFig
,
'
Tag
'
,
'ButtonMotionOn'
);
set
(
hMainFig
,
'
UserData
'
,
'ButtonMotionOn'
);
% Make the Salinity, temperature and velocity plot
% Make the Salinity, temperature and velocity plot
% ------------------------------------------------
% ------------------------------------------------
tsg_plot_SalTempVel
(
hMainFig
,
hPlotAxes
);
tsg_plot_SalTempVel
(
hMainFig
,
hPlotAxes
);
...
@@ -320,14 +363,22 @@ function tsgqc_GUI
...
@@ -320,14 +363,22 @@ function tsgqc_GUI
% Merge the different water sample (NetCdf or ASCII files) in
% Merge the different water sample (NetCdf or ASCII files) in
% a unique structure : 'sample'
% a unique structure : 'sample'
% -----------------------------------------------------------
% -----------------------------------------------------------
[
sample
]
=
tsg_mergesample
(
hMainFig
);
%@ desactive le merge pour l'instant en attente d'une structure de
%donnes validee
% Save the 'sample' struct. as an application data
%@[sample] = tsg_mergesample( hMainFig );
%@ Save the 'sample' struct. as an application data
% ------------------------------------------------
% ------------------------------------------------
if
~
isempty
(
sample
)
%if ~isempty( sample )
setappdata
(
hMainFig
,
'sample'
,
sample
);
% setappdata( hMainFig, 'sample', sample );
%end
% Plot Salinity bucket
% ------------------------------------------------
if
error2
~=
-
1
tsg_plot_SalTsgSample
(
hMainFig
,
hPlotAxes
);
end
end
% Pointer reset to arrow
% Pointer reset to arrow
% ----------------------
% ----------------------
set
(
hMainFig
,
'Pointer'
,
'arrow'
);
set
(
hMainFig
,
'Pointer'
,
'arrow'
);
...
@@ -348,7 +399,7 @@ function tsgqc_GUI
...
@@ -348,7 +399,7 @@ function tsgqc_GUI
zoomAdaptiveDateTicks
(
'off'
);
zoomAdaptiveDateTicks
(
'off'
);
case
'off'
case
'off'
pan
off
pan
off
set
(
hQCPushtool
,
'
Tag
'
,
'off'
);
set
(
hQCPushtool
,
'
UserData
'
,
'off'
);
zoom
on
zoom
on
zoomAdaptiveDateTicks
(
'on'
);
zoomAdaptiveDateTicks
(
'on'
);
...
@@ -371,7 +422,7 @@ function tsgqc_GUI
...
@@ -371,7 +422,7 @@ function tsgqc_GUI
panAdaptiveDateTicks
(
'off'
);
panAdaptiveDateTicks
(
'off'
);
case
'off'
case
'off'
zoom
off
zoom
off
set
(
hQCPushtool
,
'
Tag
'
,
'off'
);
set
(
hQCPushtool
,
'
UserData
'
,
'off'
);
pan
on
pan
on
panAdaptiveDateTicks
(
'on'
);
panAdaptiveDateTicks
(
'on'
);
...
@@ -394,26 +445,26 @@ function tsgqc_GUI
...
@@ -394,26 +445,26 @@ function tsgqc_GUI
% Toggle the tag of the Qc pushbutton to 'on' or 'off'
% Toggle the tag of the Qc pushbutton to 'on' or 'off'
% ----------------------------------------------------
% ----------------------------------------------------
switch
get
(
hQCPushtool
,
'
Tag
'
);
switch
get
(
hQCPushtool
,
'
UserData
'
);
case
'off'
case
'off'
set
(
hQCPushtool
,
'
Tag
'
,
'on'
);
set
(
hQCPushtool
,
'
UserData
'
,
'on'
);
set
(
hPlotAxes
(
1
),
'UIContextMenu'
,
hQcCmenu
);
set
(
hPlotAxes
(
1
),
'UIContextMenu'
,
hQcCmenu
);
set
(
hMainFig
,
'Pointer'
,
'crosshair'
);
set
(
hMainFig
,
'Pointer'
,
'crosshair'
);
case
'on'
case
'on'
set
(
hQCPushtool
,
'
Tag
'
,
'off'
);
set
(
hQCPushtool
,
'
UserData
'
,
'off'
);
set
(
hPlotAxes
(
1
),
'UIContextMenu'
,
[]);
set
(
hPlotAxes
(
1
),
'UIContextMenu'
,
[]);
set
(
hMainFig
,
'Pointer'
,
'arrow'
);
set
(
hMainFig
,
'Pointer'
,
'arrow'
);
end
end
qualityCode
=
-
1
;
qualityCode
=
-
1
;
ind
=
[];
ind
=
[];
while
strcmp
(
get
(
hQCPushtool
,
'
Tag
'
),
'on'
)
while
strcmp
(
get
(
hQCPushtool
,
'
UserData
'
),
'on'
)
k
=
waitforbuttonpress
;
k
=
waitforbuttonpress
;
% If the QC pushbutton is pressed we quit the callback
% If the QC pushbutton is pressed we quit the callback
% ----------------------------------------------------
% ----------------------------------------------------
if
strcmp
(
get
(
hQCPushtool
,
'
Tag
'
),
'off'
)
if
strcmp
(
get
(
hQCPushtool
,
'
UserData
'
),
'off'
)
% Desactivate the context menu use to choose the
% Desactivate the context menu use to choose the
% Quality Codes
% Quality Codes
...
@@ -437,7 +488,7 @@ function tsgqc_GUI
...
@@ -437,7 +488,7 @@ function tsgqc_GUI
% made. Otherwise there is a conflict with the map if it
% made. Otherwise there is a conflict with the map if it
% is activated
% is activated
% -------------------------------------------------------
% -------------------------------------------------------
set
(
hMainFig
,
'
Tag
'
,
'ButtonMotionOff'
);
set
(
hMainFig
,
'
UserData
'
,
'ButtonMotionOff'
);
% Selection of the data within the figure
% Selection of the data within the figure
% ---------------------------------------
% ---------------------------------------
...
@@ -451,17 +502,17 @@ function tsgqc_GUI
...
@@ -451,17 +502,17 @@ function tsgqc_GUI
p1
=
min
(
point1
,
point2
);
p1
=
min
(
point1
,
point2
);
p2
=
max
(
point1
,
point2
);
% calculate locations
p2
=
max
(
point1
,
point2
);
% calculate locations
ind
=
find
(
tsg
.
TIME
>
p1
(
1
,
1
)
&
tsg
.
TIME
<
p2
(
1
,
1
)
&
...
ind
=
find
(
tsg
.
DAYD
>
p1
(
1
,
1
)
&
tsg
.
DAYD
<
p2
(
1
,
1
)
&
...
tsg
.
PS
AL
>
p1
(
1
,
2
)
&
tsg
.
PS
AL
<
p2
(
1
,
2
));
tsg
.
SS
PS
>
p1
(
1
,
2
)
&
tsg
.
SS
PS
<
p2
(
1
,
2
));
% As soon as a modification took place the data should be
% As soon as a modification took place the data should be
% saved
% saved
% -------------------------------------------------------
% -------------------------------------------------------
set
(
hSaveMenu
,
'
Tag
'
,
'on'
);
set
(
hSaveMenu
,
'
UserData
'
,
'on'
);
% Selection made : Mouse motion callback re-activated
% Selection made : Mouse motion callback re-activated
% --------------------------------------------------
% --------------------------------------------------
set
(
hMainFig
,
'
Tag
'
,
'ButtonMotionOn'
);
set
(
hMainFig
,
'
UserData
'
,
'ButtonMotionOn'
);
end
end
...
@@ -472,7 +523,7 @@ function tsgqc_GUI
...
@@ -472,7 +523,7 @@ function tsgqc_GUI
quality
=
get
(
hQcCmenu
,
'UserData'
);
quality
=
get
(
hQcCmenu
,
'UserData'
);
tsg
.
PS
AL
_QC
(
ind
)
=
quality
.
Code
;
tsg
.
SS
PS_QC
(
ind
)
=
quality
.
Code
;
% Save the modifications
% Save the modifications
% ----------------------
% ----------------------
...
@@ -481,7 +532,7 @@ function tsgqc_GUI
...
@@ -481,7 +532,7 @@ function tsgqc_GUI
axes
(
hPlotAxes
(
1
));
axes
(
hPlotAxes
(
1
));
hold
on
hold
on
color
=
[
'.'
quality
.
Color
];
color
=
[
'.'
quality
.
Color
];
plot
(
tsg
.
TIME
(
ind
),
tsg
.
PS
AL
(
ind
),
color
);
plot
(
tsg
.
DAYD
(
ind
),
tsg
.
SS
PS
(
ind
),
color
);
hold
off
hold
off
end
end
...
@@ -578,7 +629,7 @@ function tsgqc_GUI
...
@@ -578,7 +629,7 @@ function tsgqc_GUI
% Test if the callback can be activated
% Test if the callback can be activated
% -------------------------------------
% -------------------------------------
if
strcmp
(
get
(
hMainFig
,
'
Tag
'
),
'ButtonMotionOn'
)
if
strcmp
(
get
(
hMainFig
,
'
UserData
'
),
'ButtonMotionOn'
)
% Retrieve named application data
% Retrieve named application data
% -------------------------------
% -------------------------------
...
@@ -595,19 +646,19 @@ function tsgqc_GUI
...
@@ -595,19 +646,19 @@ function tsgqc_GUI
% -----------------------------------------------------------
% -----------------------------------------------------------
[
x
,
y
]
=
gpos
(
hPlotAxes
(
1
));
[
x
,
y
]
=
gpos
(
hPlotAxes
(
1
));
if
x
>
tsg
.
TIME
(
1
)
&&
x
<
tsg
.
TIME
(
end
)
if
x
>
tsg
.
DAYD
(
1
)
&&
x
<
tsg
.
DAYD
(
end
)
indCursor
=
find
(
tsg
.
TIME
>
x
);
indCursor
=
find
(
tsg
.
DAYD
>
x
);
% use sprintf with format instead strcat & num2str but flag
% use sprintf with format instead strcat & num2str but flag
% - don't work with 0, eg %+07.4f
% - don't work with 0, eg %+07.4f
set
(
hInfoText
,
'String'
,
...
set
(
hInfoText
,
'String'
,
...
sprintf
([
'%s - Latitude = %s - Longitude = %s '
...
sprintf
([
'%s - Latitude = %s - Longitude = %s '
...
' - Salinity = %07.4f - Temperature = %07.4f'
],
...
' - Salinity = %07.4f - Temperature = %07.4f'
],
...
datestr
(
tsg
.
TIME
(
indCursor
(
1
)),
'dd/mm/yyyy HH:MM'
),
...
datestr
(
tsg
.
DAYD
(
indCursor
(
1
)),
'dd/mm/yyyy HH:MM'
),
...
dd2dm
(
tsg
.
LAT
ITUDE
(
indCursor
(
1
)),
0
),
...
dd2dm
(
tsg
.
LAT
X
(
indCursor
(
1
)),
0
),
...
dd2dm
(
tsg
.
LON
GITUDE
(
indCursor
(
1
)),
1
),
...
dd2dm
(
tsg
.
LON
X
(
indCursor
(
1
)),
1
),
...
tsg
.
PS
AL
(
indCursor
(
1
)),
...
tsg
.
SS
PS
(
indCursor
(
1
)),
...
tsg
.
TEMP_TSG
(
indCursor
(
1
))
...
tsg
.
SSJT
(
indCursor
(
1
))
...
));
));
% Plot the position on the map if this one is active
% Plot the position on the map if this one is active
...
@@ -620,17 +671,17 @@ function tsgqc_GUI
...
@@ -620,17 +671,17 @@ function tsgqc_GUI
if
isempty
(
get
(
hMapPanel
,
'UserData'
))
if
isempty
(
get
(
hMapPanel
,
'UserData'
))
hMarker
=
m_line
(
...
hMarker
=
m_line
(
...
tsg
.
LON
GITUDE
(
indCursor
(
1
)),
tsg
.
LAT
ITUDE
(
indCursor
(
1
)),
...
tsg
.
LON
X
(
indCursor
(
1
)),
tsg
.
LAT
X
(
indCursor
(
1
)),
...
'Marker'
,
'o'
,
'MarkerSize'
,
5
,
...
'Marker'
,
'o'
,
'MarkerSize'
,
5
,
...
'Color'
,
'r'
,
'MarkerFaceColor'
,
'r'
);
'Color'
,
'r'
,
'MarkerFaceColor'
,
'r'
);
set
(
hMapPanel
,
'UserData'
,
hMarker
)
set
(
hMapPanel
,
'UserData'
,
hMarker
)
else
else
delete
(
get
(
hMapPanel
,
'UserData'
));
delete
(
get
(
hMapPanel
,
'UserData'
));
hMarker
=
m_line
(
...
hMarker
=
m_line
(
...
tsg
.
LON
GITUDE
(
indCursor
(
1
)),
tsg
.
LAT
ITUDE
(
indCursor
(
1
)),
...
tsg
.
LON
X
(
indCursor
(
1
)),
tsg
.
LAT
X
(
indCursor
(
1
)),
...
'Marker'
,
'o'
,
'MarkerSize'
,
5
,
...
'Marker'
,
'o'
,
'MarkerSize'
,
5
,
...
'Color'
,
'r'
,
'MarkerFaceColor'
,
'r'
);
'Color'
,
'r'
,
'MarkerFaceColor'
,
'r'
);
set
(
hMapPanel
,
'UserData'
,
hMarker
);
set
(
hMapPanel
,
'UserData'
,
hMarker
);
end
end
end
end
end
end
...
@@ -661,11 +712,11 @@ function tsgqc_GUI
...
@@ -661,11 +712,11 @@ function tsgqc_GUI
% Test if the sample Push button has been pressed
% Test if the sample Push button has been pressed
% -----------------------------------------------
% -----------------------------------------------
if
strcmp
(
get
(
hBottlePushtool
,
'
Tag
'
),
'off'
)
if
strcmp
(
get
(
hBottlePushtool
,
'
UserData
'
),
'off'
)
% Sample Push button -
Tag
set to 'on'
% Sample Push button -
UserData
set to 'on'
% ------------------------------------
% ------------------------------------
set
(
hBottlePushtool
,
'
Tag
'
,
'on'
);
set
(
hBottlePushtool
,
'
UserData
'
,
'on'
);
% Test if tsg and sample data have been loaded
% Test if tsg and sample data have been loaded
% --------------------------------------------
% --------------------------------------------
...
@@ -688,7 +739,7 @@ function tsgqc_GUI
...
@@ -688,7 +739,7 @@ function tsgqc_GUI
% Plot the samples if the TSG file has been read
% Plot the samples if the TSG file has been read
% ----------------------------------------------
% ----------------------------------------------
% if strcmp( get(hOpenMenu, '
Tag
'), 'on' ) && ~isempty( sample )
% if strcmp( get(hOpenMenu, '
UserData
'), 'on' ) && ~isempty( sample )
% axes( hPlotAxes(1) );
% axes( hPlotAxes(1) );
% hLine.Sample = line( ...
% hLine.Sample = line( ...
% sample.TIME, sample.PSAL,...
% sample.TIME, sample.PSAL,...
...
@@ -702,7 +753,7 @@ function tsgqc_GUI
...
@@ -702,7 +753,7 @@ function tsgqc_GUI
% else
% else
set
(
hBottlePushtool
,
'
Tag
'
,
'off'
);
set
(
hBottlePushtool
,
'
UserData
'
,
'off'
);
% The bucket pushbutton has been pressed again :
% The bucket pushbutton has been pressed again :
% Delete the bucket on figure
% Delete the bucket on figure
...
@@ -724,16 +775,16 @@ function tsgqc_GUI
...
@@ -724,16 +775,16 @@ function tsgqc_GUI
% Test if the climatology Push button has been pressed
% Test if the climatology Push button has been pressed
% ----------------------------------------------------
% ----------------------------------------------------
if
strcmp
(
get
(
hClimPushtool
,
'
Tag
'
),
'off'
)
if
strcmp
(
get
(
hClimPushtool
,
'
UserData
'
),
'off'
)
% Climatology push button -
Tag
set to 'on'
% Climatology push button -
UserData
set to 'on'
% -----------------------------------------
% -----------------------------------------
set
(
hClimPushtool
,
'
Tag
'
,
'on'
);
set
(
hClimPushtool
,
'
UserData
'
,
'on'
);
% Test if the TSG and bucket files have been read
% Test if the TSG and bucket files have been read
% -----------------------------------------------
% -----------------------------------------------
if
strcmp
(
get
(
hOpenMenu
,
'
Tag
'
),
'on'
)
if
strcmp
(
get
(
hOpenMenu
,
'
UserData
'
),
'on'
)
% Get data
% Get data
% -----------------------
% -----------------------
...
@@ -743,35 +794,36 @@ function tsgqc_GUI
...
@@ -743,35 +794,36 @@ function tsgqc_GUI
% Read Climatology
% Read Climatology
% ----------------
% ----------------
if
~
is
field
(
tsg
,
'LEVITUS'
)
if
is
empty
(
tsg
.
levitus
.
data
)
lev
=
read_file_woa01
(
'woa01an.nc'
);
lev
itus
=
read_file_woa01
(
'woa01an.nc'
);
if
~
isstruct
(
lev
)
if
~
isstruct
(
lev
itus
)
errordlg
({
'NetCDF climatology file not present in you path'
,
...
errordlg
({
'NetCDF climatology file not present in you path'
,
...
'Check your matlab path or download it from'
,
...
'Check your matlab path or download it from'
,
...
'ftp://ftp.ifremer.fr/ifremer/ird/us191/oceano/lib/matlab/woa01an.nc'
},
...
'ftp://ftp.ifremer.fr/ifremer/ird/us191/oceano/lib/matlab/woa01an.nc'
},
...
'NetCDF climatology file access error'
);
'NetCDF climatology file access error'
);
return
;
return
;
else
else
tsg
.
LEVITUS
=
lev
;
tsg
.
levitus
.
data
=
levitus
;
tsg
.
levitus
.
type
=
'woa01an'
;
end
end
setappdata
(
hMainFig
,
'tsg_data'
,
tsg
);
setappdata
(
hMainFig
,
'tsg_data'
,
tsg
);
end
end
% round positive latitude and Longitude toward zero
% round positive latitude and Longitude toward zero
% -------------------------------------------------
% -------------------------------------------------
ind
=
find
(
tsg
.
LAT
ITUDE
>
0
);
ind
=
find
(
tsg
.
LAT
X
>
0
);
lat
(
ind
)
=
fix
(
tsg
.
LAT
ITUDE
(
ind
))
+
0.5
;
lat
(
ind
)
=
fix
(
tsg
.
LAT
X
(
ind
))
+
0.5
;
ind
=
find
(
tsg
.
LON
GITUDE
>
0
);
ind
=
find
(
tsg
.
LON
X
>
0
);
lon
(
ind
)
=
fix
(
tsg
.
LON
GITUDE
(
ind
))
+
0.5
;
lon
(
ind
)
=
fix
(
tsg
.
LON
X
(
ind
))
+
0.5
;
% rounds negative latitude and Longitudeto the nearest lowest integers
% rounds negative latitude and Longitudeto the nearest lowest integers
% ---------------------------------------------------------------------
% ---------------------------------------------------------------------
ind
=
find
(
tsg
.
LAT
ITUDE
<=
0
);
ind
=
find
(
tsg
.
LAT
X
<=
0
);
lat
(
ind
)
=
floor
(
tsg
.
LAT
ITUDE
(
ind
))
+
0.5
;
lat
(
ind
)
=
floor
(
tsg
.
LAT
X
(
ind
))
+
0.5
;
ind
=
find
(
tsg
.
LON
GITUDE
<=
0
);
ind
=
find
(
tsg
.
LON
X
<=
0
);
lon
(
ind
)
=
floor
(
tsg
.
LON
GITUDE
(
ind
))
+
0.5
;
lon
(
ind
)
=
floor
(
tsg
.
LON
X
(
ind
))
+
0.5
;
% Calculates differences between adjacent elements of X.
% Calculates differences between adjacent elements of X.
% 0 if adajacent latitude or longitude are equal
% 0 if adajacent latitude or longitude are equal
...
@@ -785,9 +837,9 @@ function tsgqc_GUI
...
@@ -785,9 +837,9 @@ function tsgqc_GUI
ind
=
find
(
abs
(
lat_diff
)
==
1
|
abs
(
lon_diff
==
1
));
ind
=
find
(
abs
(
lat_diff
)
==
1
|
abs
(
lon_diff
==
1
));
lat2
=
lat
(
ind
);
lat2
=
lat
(
ind
);
lon2
=
lon
(
ind
);
lon2
=
lon
(
ind
);
time
=
tsg
.
TIME
(
ind
);
time
=
tsg
.
DAYD
(
ind
);
temp
=
tsg
.
TEMP_TSG
(
ind
);
temp
=
tsg
.
SSJT
(
ind
);
psal
=
tsg
.
PS
AL
(
ind
);
psal
=
tsg
.
SS
PS
(
ind
);
% Get Climatology
% Get Climatology
% LATX(80) = -0.5 et LATX(81) = 0.5
% LATX(80) = -0.5 et LATX(81) = 0.5
...
@@ -799,12 +851,12 @@ function tsgqc_GUI
...
@@ -799,12 +851,12 @@ function tsgqc_GUI
std_temp
=
zeros
(
size
(
ind
));
std_temp
=
zeros
(
size
(
ind
));
std_psal
=
zeros
(
size
(
ind
));
std_psal
=
zeros
(
size
(
ind
));
for
i
=
1
:
length
(
ind
)
for
i
=
1
:
length
(
ind
)
ilat
=
find
(
tsg
.
LEVITUS
.
WOA01_LATX
==
lat2
(
i
));
ilat
=
find
(
tsg
.
levitus
.
data
.
WOA01_LATX
==
lat2
(
i
));
ilon
=
find
(
tsg
.
LEVITUS
.
WOA01_LONX
==
lon2
(
i
));
ilon
=
find
(
tsg
.
levitus
.
data
.
WOA01_LONX
==
lon2
(
i
));
mean_temp
(
i
)
=
tsg
.
LEVITUS
.
WOA01_MEAN_TEMP
(
ilat
,
ilon
,
1
);
mean_temp
(
i
)
=
tsg
.
levitus
.
data
.
WOA01_MEAN_TEMP
(
ilat
,
ilon
,
1
);
mean_psal
(
i
)
=
tsg
.
LEVITUS
.
WOA01_MEAN_PSAL
(
ilat
,
ilon
,
1
);
mean_psal
(
i
)
=
tsg
.
levitus
.
data
.
WOA01_MEAN_PSAL
(
ilat
,
ilon
,
1
);
std_temp
(
i
)
=
tsg
.
LEVITUS
.
WOA01_STD_TEMP
(
ilat
,
ilon
,
1
);
std_temp
(
i
)
=
tsg
.
levitus
.
data
.
WOA01_STD_TEMP
(
ilat
,
ilon
,
1
);
std_psal
(
i
)
=
tsg
.
LEVITUS
.
WOA01_STD_PSAL
(
ilat
,
ilon
,
1
);
std_psal
(
i
)
=
tsg
.
levitus
.
data
.
WOA01_STD_PSAL
(
ilat
,
ilon
,
1
);
end
end
% Plot mean salinity climatology
% Plot mean salinity climatology
...
@@ -832,7 +884,7 @@ function tsgqc_GUI
...
@@ -832,7 +884,7 @@ function tsgqc_GUI
else
else
set
(
hClimPushtool
,
'
Tag
'
,
'off'
);
set
(
hClimPushtool
,
'
UserData
'
,
'off'
);
% The bucket pushbutton has been pressed again :
% The bucket pushbutton has been pressed again :
% Delete the bucket on figure
% Delete the bucket on figure
...
@@ -852,31 +904,70 @@ function tsgqc_GUI
...
@@ -852,31 +904,70 @@ function tsgqc_GUI
end
end
end
end
% -----------------------------------------------------------------
% -------------------------------------------------------------------
function
HeaderMenuCallback
(
hObject
,
eventdata
)
% Callback function run when the headerForm tool bar item is selected
% call header form function
% -------------------------
headerForm
(
hMainFig
);
end
% -------------------------------------------------------------------
function
SaveMenuCallback
(
hObject
,
eventdata
)
function
SaveMenuCallback
(
hObject
,
eventdata
)
% Callback function run when the Save menu item is selected
% Callback function run when the Save menu item is selected
[
fileName
,
pathName
,
filterIndex
]
=
uiputfile
(
'*.txt'
,
...
% fill or append header form
% -------------------------
error
=
headerForm
(
hMainFig
);
% if user press continue button, ask for netcdf file
% ------------------------------------------------
if
error
~=
-
1
[
fileName
,
pathName
,
filterIndex
]
=
uiputfile
(
'*.nc'
,
...
'Save file name'
);
'Save file name'
);
% if user press cancel button, all var set to zero
% ------------------------------------------------
if
fileName
==
0
return
;
end
% Pointer set to watch during reading and plotting
% ------------------------------------------------
set
(
hMainFig
,
'Pointer'
,
'watch'
);
% flushes the event queue and updates the closed uiputfile window
% ---------------------------------------------------------------
drawnow
;
% write netcdf file
% -----------------
fileName
=
[
pathName
fileName
];
fileName
=
[
pathName
fileName
];
error
=
tsg_writeTsgData
(
hMainFig
,
fileName
);
error
=
tsg_writeTSGDataNetCDF
(
hMainFig
,
fileName
);
if
~
error
%
% Pointer reset to arrow
% ----------------------
set
(
hMainFig
,
'Pointer'
,
'arrow'
);
% Check for a writing pb to NetCDF
% must to be rewriting
% --------------------------------
if
error
==
-
1
warning
([
'NetCDF writing error:'
fileName
]);
end
end
end
end
end
% -----------------------------------------------------------------
% -----------------------------------------------------------------
function
QuitMenuCallback
(
hObject
,
eventdata
)
function
QuitMenuCallback
(
hObject
,
eventdata
)
% Callback function run when the Quit menu item is selected
% Callback function run when the Quit menu item is selected
% If the data have been modified and not save, the program
% If the data have been modified and not save, the program
% propose to save the data
% propose to save the data
% --------------------------------------------------------
% --------------------------------------------------------
if
strcmp
(
get
(
hSaveMenu
,
'
Tag
'
),
'on'
)
if
strcmp
(
get
(
hSaveMenu
,
'
UserData
'
),
'on'
)
selection
=
...
selection
=
...
questdlg
(
'The file has been modified. Do you want to save it ?'
,
...
questdlg
(
'The file has been modified. Do you want to save it ?'
,
...
'Save before Quit?'
,
...
'Save before Quit?'
,
...
...
...
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