Newer
Older

jacques.grelet_ird.fr
committed
function plot_Climatology(hMainFig, hPlotAxes)
% Function to plot mean climatology and standard deviation
%
% Input
% -----
% hTsgGUI ............ Handel to the main user interface
% hPlotAxes .......... Handels to the 3 graphic axes
%
% Output
% ------
% none
%
% $Id$
% Read surface climatology (annual, seasonal or monthly)
% ------------------------------------------------------
read_Climatology(hMainFig);
% Get data after read_Climatology because it could be change tsg.levitus.type
% -------------------------------------------------------------------------
tsg = getappdata( hMainFig, 'tsg_data' );
% if reading error, tsg.levitus.data is empty, no action
% ------------------------------------------------------
if isempty(tsg.levitus.data)
return
end

jacques.grelet_ird.fr
committed
% get last selected climatology structure
% ---------------------------------------
s = get(findobj('Tag', 'TAG_UIMENU_CLIMATO_MAIN'), 'Userdata');
% select time dimension for climatology form saved structure s
% ------------------------------------------------------------
time_dim = s.time;

jacques.grelet_ird.fr
committed
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
% round positive latitude and Longitude toward zero
% -------------------------------------------------
ind = find(tsg.LATX > 0);
lat(ind) = fix(tsg.LATX(ind)) + 0.5;
ind = find(tsg.LONX > 0);
lon(ind) = fix(tsg.LONX(ind)) + 0.5;
% rounds negative latitude and Longitudeto the nearest lowest integers
% ---------------------------------------------------------------------
ind = find(tsg.LATX <= 0);
lat(ind) = floor(tsg.LATX(ind)) + 0.5;
ind = find(tsg.LONX <= 0);
lon(ind) = floor(tsg.LONX(ind)) + 0.5;
% 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 );
dayd = tsg.DAYD( ind );
ssjt = tsg.SSJT( ind );
ssps = tsg.SSPS( ind );
% Get Climatology
% LATX(80) = -0.5 et LATX(81) = 0.5
% LONX(180) = -0.5 et LONX(181) = 0.5
% ----------------
mean_sstp = zeros(size(ind));
mean_ssps = zeros(size(ind));
std_sstp = zeros(size(ind));
std_ssps = zeros(size(ind));
for ii=1:length(ind)
ilat = find(tsg.levitus.data.WOA01_LATX == lat2(ii));
ilon = find(tsg.levitus.data.WOA01_LONX == lon2(ii));
mean_sstp(ii) = tsg.levitus.data.WOA01_MEAN_SSTP(time_dim,1,ilat,ilon);
mean_ssps(ii) = tsg.levitus.data.WOA01_MEAN_SSPS(time_dim,1,ilat,ilon);
std_sstp(ii) = tsg.levitus.data.WOA01_STD_SSTP(time_dim,1,ilat,ilon);
std_ssps(ii) = tsg.levitus.data.WOA01_STD_SSPS(time_dim,1,ilat,ilon);

jacques.grelet_ird.fr
committed
end

jacques.grelet_ird.fr
committed
% get handle of axe when SSPS is plotted
% --------------------------------------
hdls = findobj('-regexp','Tag', 'TAG_PLOT\d_LINE_SSPS');
if ~isempty(hdls)
hdl_current_axes = get(hdls(1),'parent');
axes( hdl_current_axes );
% Plot mean salinity climatology
% ------------------------------
line(dayd, mean_ssps, ...
'Tag', 'TAG_LINE_CLIMATO_MEAN_SSPS', 'Linestyle', '-', 'Color','k');
% Plot with 3 standard deviation
% ------------------------------
line(dayd, mean_ssps + 3 * std_ssps, ...
'Tag', 'TAG_LINE_CLIMATO_STDDEV_PLUS_SSPS', 'Linestyle', '-', 'Color','r');
line(dayd, mean_ssps - 3 * std_ssps, ...
'Tag', 'TAG_LINE_CLIMATO_STDDEV_MINUS_SSPS', 'Linestyle', '-', 'Color','r');
end

jacques.grelet_ird.fr
committed

jacques.grelet_ird.fr
committed
% get handle of axe when SSTP is plotted
% --------------------------------------
hdls = findobj('-regexp','Tag', 'TAG_PLOT\d_LINE_SSJT');
if isempty(hdls)
hdls = findobj('-regexp','Tag', 'TAG_PLOT\d_LINE_SSTP');

jacques.grelet_ird.fr
committed
end
if ~isempty(hdls)
hdl_current_axes = get(hdls(1),'parent');
axes( hdl_current_axes );
% Plot mean temperature climatology
% ---------------------------------
line(dayd, mean_sstp, ...
'Tag', 'TAG_LINE_CLIMATO_MEAN_SSTP', 'Linestyle', '-', 'Color','k');
line(dayd, mean_sstp + 3 * std_sstp, ...
'Tag', 'TAG_LINE_CLIMATO_STDDEV_PLUS_SSTP', 'Linestyle', '-', 'Color','r');
line(dayd, mean_sstp - 3 * std_sstp, ...
'Tag', 'TAG_LINE_CLIMATO_STDDEV_MINUS_SSTP', 'Linestyle', '-', 'Color','r');
end

jacques.grelet_ird.fr
committed
% Store the handle of the bucketline
% ----------------------------------
%set( hPlotAxes(1), 'UserData', hLine1 );
%set( hPlotAxes(2), 'UserData', hLine2 );

jacques.grelet_ird.fr
committed
% save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg );