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