1 |
cnh |
1.1 |
% m-file: mit_plotmeandrift.m |
2 |
|
|
% mean temperature and salinity drift |
3 |
|
|
if ~isempty(msg_spinup) |
4 |
|
|
% extracted from the monitor output with a script by jmc |
5 |
|
|
global_mt = load('spinup.t_A'); |
6 |
|
|
global_ms = load('spinup.s_A'); |
7 |
|
|
global_mt(itim) = []; |
8 |
|
|
global_ms(itim) = []; |
9 |
|
|
else |
10 |
|
|
% or computed `on the fly' |
11 |
|
|
global_mt = zeros(size(kt)); |
12 |
|
|
global_ms = zeros(size(kt)); |
13 |
|
|
for k=kt; |
14 |
|
|
if meanfields |
15 |
|
|
% read the snapshots |
16 |
|
|
tk=rdmds('T',timesteps(k)); |
17 |
|
|
sk=rdmds('S',timesteps(k)); |
18 |
|
|
if strcmp(grd.buoyancy,'OCEANICP') |
19 |
|
|
% turn fields upside down |
20 |
|
|
tk=tk(:,:,end:-1:1).*grd.cmask; |
21 |
|
|
sk=sk(:,:,end:-1:1).*grd.cmask; |
22 |
|
|
end |
23 |
|
|
else |
24 |
|
|
% snapshots are already available |
25 |
|
|
if iscell(t) |
26 |
|
|
tk = t{k}; |
27 |
|
|
else |
28 |
|
|
tk = t(:,:,:,k); |
29 |
|
|
end |
30 |
|
|
if iscell(s) |
31 |
|
|
sk = s{k}; |
32 |
|
|
else |
33 |
|
|
sk = s(:,:,:,k); |
34 |
|
|
end |
35 |
|
|
end |
36 |
|
|
global_mt(k)= nansum(tk(:).*grd.volc(:))/nansum(grd.volc(:)); |
37 |
|
|
global_ms(k)= nansum(sk(:).*grd.volc(:))/nansum(grd.volc(:)); |
38 |
|
|
end |
39 |
|
|
end |
40 |
|
|
figure |
41 |
|
|
subplot(2,1,1); |
42 |
|
|
plot(tim,global_mt) |
43 |
|
|
title('Drift of Mean Temperature'); xlabel(['Time [' timeunit ']']); ylabel('T [degC]') |
44 |
|
|
subplot(2,1,2); |
45 |
|
|
plot(tim,global_ms) |
46 |
|
|
title('Drift of Mean Salinity'); xlabel(['Time [' timeunit ']']); ylabel('S [PSU]') |
47 |
|
|
suptitle(['experiment ' dname]) |
48 |
|
|
|