1 |
mlosch |
1.1 |
% m-file: mit_timesteps.m |
2 |
|
|
% sets up the the variables tname and timesteps for the 4x4 global runs |
3 |
|
|
|
4 |
|
|
deltat = mit_getparm('data','deltaTtracer'); |
5 |
|
|
if isempty(deltat) |
6 |
|
|
error('deltaTtracer is empty') |
7 |
|
|
end |
8 |
|
|
|
9 |
|
|
if strcmp(dname,'baseline.000') |
10 |
|
|
timesteps = [0:11]'*36e3; % one hundred years |
11 |
|
|
timesteps = [timesteps; [12:30]'*72e3]; % one hundred years (baseline experiment) |
12 |
|
|
elseif strcmp(dname,'etopo5.000') |
13 |
|
|
timesteps = [0:30]'*72e3; % one hundred years (etopo5 experiments) |
14 |
|
|
else |
15 |
|
|
if meanfields |
16 |
|
|
[dummy, timesteps] = rdmds('uVeltave',NaN); |
17 |
|
|
if isempty(timesteps) |
18 |
|
|
meanfields=0; |
19 |
|
|
error('There are no averaged fields, use meanfields=0') |
20 |
|
|
end |
21 |
|
|
timesteps = [0 timesteps]; |
22 |
|
|
else |
23 |
|
|
[dummy, timesteps] = rdmds('U',NaN); |
24 |
|
|
end |
25 |
|
|
timesteps = timesteps'; |
26 |
|
|
clear dummy |
27 |
|
|
end |
28 |
|
|
|
29 |
|
|
nt = length(timesteps); |
30 |
|
|
kt = 1:nt; |
31 |
|
|
tname = cell(nt,1); |
32 |
|
|
for k = kt |
33 |
|
|
tname{k} = sprintf('%010i',timesteps(k)); |
34 |
|
|
end |
35 |
|
|
|
36 |
|
|
%% alternative (unflexible way) |
37 |
|
|
% $$$ timesteps = [0:11]'*36e3; % one hundred years |
38 |
|
|
% $$$ timesteps = [timesteps; [12:30]'*72e3]; % one hundred years (baseline experiment) |
39 |
|
|
% $$$ clear timesteps tname kt nt |
40 |
|
|
% $$$ timesteps = [0:30]'*72e3; % one hundred years (etopo5 experiments) |
41 |
|
|
% $$$ %tincr = 20; timesteps = [0:36]'*20; % one hundred years |
42 |
|
|
% $$$ nt = length(timesteps); |
43 |
|
|
% $$$ kt = 1:nt; |
44 |
|
|
% $$$ tname = cell(nt,1); |
45 |
|
|
% $$$ for k = kt |
46 |
|
|
% $$$ tname{k} = sprintf('%010i',timesteps(k)); |
47 |
|
|
% $$$ end |
48 |
|
|
|
49 |
|
|
% create a time axis |
50 |
|
|
oneday = 3600*24; |
51 |
|
|
onemonth =oneday*30; |
52 |
|
|
oneyr=onemonth*12; |
53 |
|
|
msg_spinup = dir('spinup.tim'); |
54 |
|
|
if isempty(msg_spinup) |
55 |
|
|
tim = deltat*timesteps'; |
56 |
|
|
else |
57 |
|
|
tim = load('spinup.tim'); |
58 |
|
|
itim = find(diff(tim) == 0); |
59 |
|
|
tim(itim) = []; |
60 |
|
|
end |
61 |
|
|
% create reasonable unit; |
62 |
|
|
if max(tim(:))/oneday <= 360 |
63 |
|
|
tim = tim/oneday; |
64 |
|
|
timeunit = 'days'; |
65 |
|
|
tuname = 'day'; |
66 |
|
|
elseif max(tim(:))/onemonth <= 120 |
67 |
|
|
tim = tim/onemonth; |
68 |
|
|
timeunit = 'months'; |
69 |
|
|
tuname = 'month'; |
70 |
|
|
else |
71 |
|
|
tim = tim/oneyr; |
72 |
|
|
timeunit = 'yrs'; |
73 |
|
|
tuname = 'year'; |
74 |
|
|
end |
75 |
|
|
|
76 |
|
|
if ~exist('kmax','var') |
77 |
|
|
kmax=max(kt); |
78 |
|
|
end |
79 |
|
|
disp(['kmax = ' num2str(kmax) ', diplayed time = ' ... |
80 |
|
|
num2str(tim(kmax)) ' ' timeunit]) |
81 |
|
|
|