Newer
Older

jacques.grelet_ird.fr
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
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$
% Get data
% -----------------------
tsg = getappdata( hMainFig, 'tsg_data' );
% Get line handles
% ----------------
hLine1 = get( hPlotAxes(1), 'UserData');
hLine2 = get( hPlotAxes(2), 'UserData');
% Read surface climatology (annual, seasonal or monthly)
% ------------------------------------------------------
read_climatology(hMainFig, tsg.levitus.type);
% select time dimension for climatology
dim_time = tsg.levitus.time;
% 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
% ----------------
axes( hPlotAxes(1) );
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(dim_time,1,ilat,ilon);
mean_ssps(ii) = tsg.levitus.data.WOA01_MEAN_SSPS(dim_time,1,ilat,ilon);
std_sstp(ii) = tsg.levitus.data.WOA01_STD_SSTP(dim_time,1,ilat,ilon);
std_ssps(ii) = tsg.levitus.data.WOA01_STD_SSPS(dim_time,1,ilat,ilon);
end
% Plot mean salinity climatology
% ------------------------------
hLine1.meanClim = line( ...
dayd, mean_ssps,'Linestyle', '-', 'Color','k');
% Plot with 3 standard deviation
% ------------------------------
hLine1.stdClimPlus = line( ...
dayd, mean_ssps + 3 * std_ssps ,'Linestyle', '-', 'Color','r');
hLine1.stdClimMinus = line( ...
dayd, mean_ssps - 3 * std_ssps ,'Linestyle', '-', 'Color','r');
% Plot mean temperature climatology
% ---------------------------------
axes( hPlotAxes(2));
hLine2.meanClim = line( ...
dayd, mean_sstp,'Linestyle', '-', 'Color','k');
hLine2.stdClimPlus = line( ...
dayd, mean_sstp + 3 * std_sstp ,'Linestyle', '-', 'Color','r');
hLine2.stdClimMinus = line( ...
dayd, mean_sstp - 3 * std_sstp ,'Linestyle', '-', 'Color','r');
% Store the handle of the bucketline
% ----------------------------------
set( hPlotAxes(1), 'UserData', hLine1 );
set( hPlotAxes(2), 'UserData', hLine2 );
% save tsg structure
% ------------------
setappdata( hMainFig, 'tsg_data', tsg );
end