-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtimetracker.m
More file actions
51 lines (38 loc) · 1.83 KB
/
timetracker.m
File metadata and controls
51 lines (38 loc) · 1.83 KB
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
function [time]=timetracker(set)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Input: set
% Return: time
%
% Sets up time settings.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
time=timetrackerdef;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%if mod(loopsperhour,outtimesperhour) ~=0 then there will be no output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
time.loopsperhour=set.internalstep;
time.outtimesperhour=set.outputstep;
ncid=netcdf.open(set.fvcompath,'NC_NOWRITE');
time.starthour=set.start;
time.trackingtime=set.track;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%dti -> internal stepping
%instp -> stepping of input data
%dtout -> output stepping
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ttime = double(netcdf.getVar(ncid,netcdf.inqVarID(ncid,'time')));
[Y, M, D, H, MN, S]=datevec(ttime(3)-ttime(2));
tsec=(H*3600)+(MN*60)+S;
time.instp=tsec;
time.dti=time.instp/time.loopsperhour;
time.dtout=time.instp/time.outtimesperhour;
time.finishhour=time.starthour+time.trackingtime;
time.itout=0;
time.iint=0;
time.i2=floor(time.instp/time.dti);
time.int2=floor(time.dtout/time.dti);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%for setting size of x,y,z,u,v,w arrays
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
time.outt=((time.trackingtime)*time.outtimesperhour)+1;
netcdf.close(ncid);