Skip to content
Snippets Groups Projects
Commit b845d5ee authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

Ajout de la climatology levitus

A tester
parent 3c5e0973
No related branches found
No related tags found
No related merge requests found
......@@ -103,14 +103,14 @@ function tsgqc_GUI
hToolbar = uitoolbar(... % Toolbar for Open and Print buttons
'Parent',hMainFig, ...
'HandleVisibility','callback');
hSavePushtool = uipushtool(... % Open toolbar button
hSavePushtool = uipushtool(... % Open Save toolbar button
'Parent',hToolbar,...
'TooltipString','Save file',...
'CData',iconRead( ...
[DEFAULT_PATH_FILE 'tsg_icon' filesep 'savedoc.mat']),...
'HandleVisibility','callback', ...
'ClickedCallback', @SaveMenuCallback);
hZoomPushtool = uipushtool(... % Open toolbar button
hZoomPushtool = uipushtool(... % Open Zoom toolbar button
'Parent',hToolbar,...
'Separator', 'on', ...
'TooltipString','Zoom',...
......@@ -118,14 +118,14 @@ function tsgqc_GUI
'/toolbox/matlab/icons/zoom.mat')),...
'HandleVisibility','callback', ...
'ClickedCallback', @ZoomMenuCallback);
hPanPushtool = uipushtool(... % Open toolbar button
hPanPushtool = uipushtool(... % Open Pan toolbar button
'Parent',hToolbar,...
'TooltipString','Pan',...
'CData',iconRead(fullfile(matlabroot, ...
'/toolbox/matlab/icons/pan.mat')),...
'HandleVisibility','callback', ...
'ClickedCallback', @PanMenuCallback);
hQCPushtool = uipushtool(... % Open toolbar button
hQCPushtool = uipushtool(... % Open QC toolbar button
'Parent',hToolbar,...
'TooltipString','Validation codes',...
'Separator', 'on', ...
......@@ -134,7 +134,7 @@ function tsgqc_GUI
[DEFAULT_PATH_FILE 'tsg_icon' filesep 'qcicon.mat']),...
'HandleVisibility','callback', ...
'ClickedCallback', @QCMenuCallback);
hMapPushtool = uipushtool(... % Open toolbar button
hMapPushtool = uipushtool(... % Open Map toolbar button
'Parent',hToolbar,...
'TooltipString','Map and ship track',...
'Separator', 'on', ...
......@@ -143,7 +143,7 @@ function tsgqc_GUI
[DEFAULT_PATH_FILE 'tsg_icon' filesep 'mapicon.mat']),...
'HandleVisibility','callback', ...
'ClickedCallback', @MapMenuCallback);
hClimPushtool = uipushtool(... % Open toolbar button
hClimPushtool = uipushtool(... % Open Climatology toolbar button
'Parent',hToolbar,...
'TooltipString','Climatology',...
'Separator', 'on', ...
......@@ -715,23 +715,92 @@ function tsgqc_GUI
% Climatology push button - Tag set to 'on'
% -----------------------------------------
set( hClimPushtool, 'Tag', 'on' );
% Test if the TSG and bucket files have been read
% -----------------------------------------------
if strcmp( get(hOpenMenu, 'Tag'), 'on' )
% Plot a Fake Climatology
% Get data
% -----------------------
tsg = getappdata( hMainFig, 'tsg_data' );
hLine = get( hPlotAxes(1), 'UserData');
% Read Climatology
% ----------------
if ~isfield( tsg, 'LEVITUS')
lev = read_file_woa01( 'woa01an.nc' );
if ~isstruct(lev)
errordlg({'NetCDF climatology file not present in you path',...
'Check your matlab path or download it from',...
'ftp://ftp.ifremer.fr/ifremer/ird/us191/oceano/lib/matlab/woa01an.nc'},...
'NetCDF climatology file access error');
return;
else
tsg.LEVITUS = lev;
end
setappdata( hMainFig, 'tsg_data', tsg );
end
% round positive latitude and Longitude toward zero
% -------------------------------------------------
ind = find(tsg.LATITUDE > 0);
lat(ind) = fix(tsg.LATITUDE(ind));
ind = find(tsg.LONGITUDE > 0);
lon(ind) = fix(tsg.LONGITUDE(ind));
% rounds negative latitude and Longitudeto the nearest lowest integers
% ---------------------------------------------------------------------
ind = find(tsg.LATITUDE <= 0);
lat(ind) = floor(tsg.LATITUDE(ind));
ind = find(tsg.LONGITUDE <= 0);
lon(ind) = floor(tsg.LONGITUDE(ind));
% Calculates differences between adjacent elements of X.
% 0 if adajacent latitude or longitude are equal
% - 1 or -1 otherwise
% ------------------------------------------------------------
lat_diff = [diff( lat )'; 0];
lon_diff = [diff( lon )'; 0];
% Select latitude and longitude
% -----------------------------
ind = find(abs(lat_diff) == 1 | abs(lon_diff == 1));
lat2 = lat( ind );
lon2 = lon( ind );
time = tsg.TIME( ind );
temp = tsg.TEMP_TSG( ind );
psal = tsg.PSAL( ind );
% Get Climatology, a tester et verifier
% LATX(80) = -0.5 et LATX(81) = 0.5
% LONX(180) = -0.5 et LONX(181) = 0.5
% ----------------
axes( hPlotAxes(1) );
hLine.stdClimMinus = line( ...
tsg.TIME, tsg.PSAL - .5,'Linestyle', '-', 'Color','r');
mean_temp=zeros(size(ind));
mean_psal=zeros(size(ind));
std_temp=zeros(size(ind));
std_psal=zeros(size(ind));
for i=1:length(ind)
ilat = find(tsg.LEVITUS.WOA01_LATX == floor(lat2(i))+0.5);
ilon = find(tsg.LEVITUS.WOA01_LONX == floor(lon2(i))+0.5);
mean_temp(i) = tsg.LEVITUS.WOA01_MEAN_TEMP(ilat,ilon,1);
mean_psal(i) = tsg.LEVITUS.WOA01_MEAN_PSAL(ilat,ilon,1);
std_temp(i) = tsg.LEVITUS.WOA01_STD_TEMP(ilat,ilon,1);
std_psal(i) = tsg.LEVITUS.WOA01_STD_PSAL(ilat,ilon,1);
end
% Plot mean salinity climatology
hLine.meanClim = line( ...
time, mean_psal,'Linestyle', '-', 'Color','k');
% Plot 2 standard deviation
hLine.stdClimPlus = line( ...
tsg.TIME, tsg.PSAL + .5,'Linestyle', '-', 'Color','r');
time, mean_psal + 3 * std_psal ,'Linestyle', '-', 'Color','r');
hLine.stdClimMinus = line( ...
time, mean_psal - 3 * std_psal ,'Linestyle', '-', 'Color','r');
% Store the handle of the bucketline
% ----------------------------------
set( hPlotAxes(1), 'UserData', hLine );
......@@ -745,9 +814,13 @@ function tsgqc_GUI
% Delete the bucket on figure
% ----------------------------------------------
hLine = get( hPlotAxes(1), 'UserData');
delete(hLine.stdClimMinus);
delete(hLine.stdClimPlus);
% bug......
try
delete(hLine.stdClimMinus);
delete(hLine.stdClimPlus);
delete(hLine.meanClim);
catch
end
end
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