Warning, /verification/tutorial_global_oce_latlon/diags_matlab/mit_timesteps.m is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
051ee7f715 Jean*0001 % m-file: mit_timesteps.m
0002 % sets up the the variables tname and timesteps for the 4x4 global runs
0003
0004 deltat = mit_getparm('data','deltaTtracer');
0005 if isempty(deltat)
0006 error('deltaTtracer is empty')
0007 end
0008
0009 if strcmp(dname,'baseline.000')
0010 timesteps = [0:11]'*36e3; % one hundred years
0011 timesteps = [timesteps; [12:30]'*72e3]; % one hundred years (baseline experiment)
0012 elseif strcmp(dname,'etopo5.000')
0013 timesteps = [0:30]'*72e3; % one hundred years (etopo5 experiments)
0014 else
0015 if meanfields
0016 [dummy, timesteps] = rdmds('uVeltave',NaN);
0017 if isempty(timesteps)
0018 meanfields=0;
0019 error('There are no averaged fields, use meanfields=0')
0020 end
0021 timesteps = [0 timesteps];
0022 else
0023 [dummy, timesteps] = rdmds('U',NaN);
0024 end
0025 timesteps = timesteps';
0026 clear dummy
0027 end
0028
0029 nt = length(timesteps);
0030 kt = 1:nt;
0031 tname = cell(nt,1);
0032 for k = kt
0033 tname{k} = sprintf('%010i',timesteps(k));
0034 end
0035
0036 %% alternative (unflexible way)
0037 % $$$ timesteps = [0:11]'*36e3; % one hundred years
0038 % $$$ timesteps = [timesteps; [12:30]'*72e3]; % one hundred years (baseline experiment)
0039 % $$$ clear timesteps tname kt nt
0040 % $$$ timesteps = [0:30]'*72e3; % one hundred years (etopo5 experiments)
0041 % $$$ %tincr = 20; timesteps = [0:36]'*20; % one hundred years
0042 % $$$ nt = length(timesteps);
0043 % $$$ kt = 1:nt;
0044 % $$$ tname = cell(nt,1);
0045 % $$$ for k = kt
0046 % $$$ tname{k} = sprintf('%010i',timesteps(k));
0047 % $$$ end
0048
0049 % create a time axis
0050 oneday = 3600*24;
0051 onemonth =oneday*30;
0052 oneyr=onemonth*12;
0053 msg_spinup = dir('spinup.tim');
0054 if isempty(msg_spinup)
0055 tim = deltat*timesteps';
0056 else
0057 tim = load('spinup.tim');
0058 itim = find(diff(tim) == 0);
0059 tim(itim) = [];
0060 end
0061 % create reasonable unit;
0062 if max(tim(:))/oneday <= 360
0063 tim = tim/oneday;
0064 timeunit = 'days';
0065 tuname = 'day';
0066 elseif max(tim(:))/onemonth <= 120
0067 tim = tim/onemonth;
0068 timeunit = 'months';
0069 tuname = 'month';
0070 else
0071 tim = tim/oneyr;
0072 timeunit = 'yrs';
0073 tuname = 'year';
0074 end
0075
0076 if ~exist('kmax','var')
0077 kmax=max(kt);
0078 end
0079 disp(['kmax = ' num2str(kmax) ', diplayed time = ' ...
0080 num2str(tim(kmax)) ' ' timeunit])
0081