0
|
1 |
%======================================================================
|
|
2 |
% M M P 2 A N T S . M
|
|
3 |
% doc: Tue Apr 21 17:31:52 2009
|
1
|
4 |
% dlm: Tue Oct 13 10:04:17 2009
|
0
|
5 |
% (c) 2009 A.M. Thurnherr
|
1
|
6 |
% uE-Info: 16 54 NIL 0 0 72 2 2 4 NIL ofnI
|
0
|
7 |
%======================================================================
|
|
8 |
|
|
9 |
% HISTORY:
|
|
10 |
% Apr 21, 2009: - created
|
|
11 |
% May 15, 2009: - added meta data (requires modified [mmp_pgrid_main.m])
|
|
12 |
% - added ancillary data (hdg, etc)
|
|
13 |
% - added depth calc
|
|
14 |
% May 18, 2009: - added export of raw ACM file
|
|
15 |
% - BUG: hdg actually was vel_dir
|
1
|
16 |
% Oct 13, 2009: - adapted to new struct2ANTS (V4.0: dependencies)
|
0
|
17 |
|
|
18 |
function mmp2ANTS(plist,epoch)
|
|
19 |
|
|
20 |
if nargin ~= 2 % default epoch could be dangerous
|
|
21 |
error('Usage: mmp2ANTS(plist,epoch)'); % for year-end-spanning data sets
|
|
22 |
end
|
|
23 |
|
|
24 |
for p = plist
|
|
25 |
|
|
26 |
%--------------------------------
|
|
27 |
% EXPORT PRESSURE-GRIDDED PROFILE
|
|
28 |
%--------------------------------
|
|
29 |
|
|
30 |
okay = 1; % attempt to load data
|
|
31 |
eval(sprintf('load grd%04d',p),'okay = 0;');
|
|
32 |
|
|
33 |
if okay
|
|
34 |
|
|
35 |
disp(sprintf('exporting gridded profile %04d...',p)); % process
|
|
36 |
|
|
37 |
%----------
|
|
38 |
% META DATA
|
|
39 |
%----------
|
|
40 |
|
|
41 |
prof.MMP_id = MMP_id;
|
|
42 |
prof.ACM_id = ACM_id;
|
|
43 |
prof.experiment = experiment_name;
|
|
44 |
|
|
45 |
prof.min_press = gmin;
|
|
46 |
prof.max_press = gmax;
|
|
47 |
prof.press_step = gstep;
|
|
48 |
|
|
49 |
prof.ACM_calfile = acm_cal_filename;
|
|
50 |
|
|
51 |
prof.vel_l_bound = vel_bounds(1) / 100;
|
|
52 |
prof.vel_u_bound = vel_bounds(2) / 100;
|
|
53 |
|
|
54 |
pos = sscanf(mooring_position,'[%d %f,%d %f]');
|
|
55 |
if pos(1) >= 0, prof.lat = pos(1) + pos(2)/60;
|
|
56 |
else, prof.lat = pos(1) - pos(2)/60;
|
|
57 |
end
|
|
58 |
if pos(3) >= 0, prof.lon = pos(3) + pos(4)/60;
|
|
59 |
else, prof.lon = pos(3) - pos(4)/60;
|
|
60 |
end
|
|
61 |
|
|
62 |
prof.magdecl = 180 * mag_dev/pi;
|
|
63 |
|
|
64 |
eval(sprintf('prof.start_dn%02d = %f;',epoch-2000,... % start/stop times in ANTS dn format
|
|
65 |
startdaytime - datenum(sprintf('1-1-%d 00:00:00',epoch)) + 1));
|
|
66 |
eval(sprintf('prof.stop_dn%02d = %f;',epoch-2000,...
|
|
67 |
stopdaytime - datenum(sprintf('1-1-%d 00:00:00',epoch)) + 1));
|
|
68 |
|
|
69 |
%-----
|
|
70 |
% DATA
|
|
71 |
%-----
|
|
72 |
|
|
73 |
stimes = ctimave - datenum(sprintf('1-1-%d 00:00:00',epoch)) + 1; % bin-averaged time in dn format
|
|
74 |
igood = isfinite(stimes);
|
|
75 |
eval(sprintf('prof.dn%02d = stimes(igood);',epoch-2000));
|
|
76 |
|
|
77 |
prof.press = pgrid(igood); % center of bins used for gridding
|
|
78 |
if exist('sw_dpth','file')
|
|
79 |
prof.depth = sw_dpth(prof.press',prof.lat);
|
|
80 |
end
|
|
81 |
|
|
82 |
prof.binned_press = pave(igood); % bin-averaged CTD data
|
|
83 |
prof.temp = tave(igood);
|
|
84 |
prof.salin = s_ave(igood);
|
|
85 |
prof.theta0 = thetave(igood);
|
|
86 |
prof.sigma0 = sigthave(igood);
|
|
87 |
prof.cond = cave(igood);
|
|
88 |
prof.CTD_Nsamp = cscan2(igood) - cscan1(igood);
|
|
89 |
|
|
90 |
prof.u = uave(igood) / 100; % bin-averaged ACM data in [m/s]
|
|
91 |
prof.v = vave(igood) / 100;
|
|
92 |
prof.w = wave(igood) / 100;
|
|
93 |
|
|
94 |
tmp = 180 * mvpdirave(igood)/pi;
|
|
95 |
prof.hdg = (270-tmp)-(fix((270-tmp)/360)*360); % standard heading btw 0 and 360
|
|
96 |
prof.pitchx = aTxave(igood);
|
|
97 |
prof.pitchy = aTyave(igood);
|
|
98 |
|
|
99 |
prof.dpdt = dpdtave(igood);
|
|
100 |
prof.ACM_Nsamp = ascan2(igood) - ascan1(igood);
|
|
101 |
|
1
|
102 |
struct2ANTS(prof,sprintf('grd%04d.mat',p),sprintf('%04d.prof',p));
|
0
|
103 |
|
|
104 |
end % if grd file loaded
|
|
105 |
|
|
106 |
%--------------------
|
|
107 |
% EXPORT RAW PROFILES
|
|
108 |
%--------------------
|
|
109 |
|
|
110 |
okay = 1; % attempt to load data
|
|
111 |
eval(sprintf('load raw%04d',p),'okay = 0;');
|
|
112 |
|
|
113 |
if okay
|
|
114 |
|
|
115 |
disp(sprintf('exporting raw data %04d...',p)); % process
|
|
116 |
|
|
117 |
ACM.Vab = Vab;
|
|
118 |
ACM.Vcd = Vcd;
|
|
119 |
ACM.Vef = Vef;
|
|
120 |
ACM.Vgh = Vgh;
|
|
121 |
|
|
122 |
ACM.aHx = aHx;
|
|
123 |
ACM.aHy = aHy;
|
|
124 |
ACM.aHz = aHz;
|
|
125 |
|
|
126 |
ACM.aTx = aTx;
|
|
127 |
ACM.aTy = aTy;
|
|
128 |
|
1
|
129 |
struct2ANTS(ACM,sprintf('raw%04d.mat',p),sprintf('%04d.ACM',p));
|
0
|
130 |
|
|
131 |
end % if grd file loaded
|
|
132 |
|
|
133 |
end % for p
|