0
|
1 |
%======================================================================
|
|
2 |
% L D E O _ L A D C P 2 A N T S . M
|
|
3 |
% doc: Sun Jan 22 15:19:00 2006
|
9
|
4 |
% dlm: Mon Jun 24 10:37:03 2013
|
0
|
5 |
% (c) 2006 A.M. Thurnherr
|
9
|
6 |
% uE-Info: 30 40 NIL 0 0 72 2 2 4 NIL ofnI
|
0
|
7 |
%======================================================================
|
|
8 |
%
|
|
9 |
% export LDEO LADCP output to ANTS file
|
|
10 |
%
|
9
|
11 |
% USAGE: LDEO_LADCP2ANTS(dr,f,p,ps,outBaseName)
|
0
|
12 |
%
|
|
13 |
|
|
14 |
% HISTORY:
|
|
15 |
% Jan 22, 2006: - created
|
|
16 |
% Feb 4, 2006: - added BT & SADCP profiles
|
|
17 |
% Feb 8, 2006: - made compatible with V7
|
|
18 |
% Feb 26, 2006: - made ensemble_vel_err optional (not set on ps.shear = 2)
|
|
19 |
% Apr 25, 2006: - suppress output of empty SADCP,BT files
|
|
20 |
% Aug 21, 2006: - added additional lat/lon output
|
|
21 |
% Nov 9, 2006: - added additional time output (requiring p input)
|
|
22 |
% Jul 17, 2008: - added cruise, software, magdecl, procdir info
|
|
23 |
% Apr 23, 2009: - added globarl var EXPORT_CTD_DATA
|
1
|
24 |
% Oct 12, 2009: - adapted to new struct2ANTS
|
9
|
25 |
% Mar 18, 2013: - added support for global STRUCT2ANTS.verb
|
|
26 |
% Jun 24, 2013: - added blen, nbin, blnk, dist to output (DL/UL separately); V10
|
|
27 |
% - added %depth_resolution %ADCP_superens_dz to output, requiring ps as
|
|
28 |
% additional input
|
0
|
29 |
|
9
|
30 |
function [] = LDEO_LADCP2ANTS(dr,f,p,ps,obn)
|
|
31 |
|
|
32 |
global STRUCT2ANTS; % suppress diagnostic messages
|
|
33 |
STRUCT2ANTS.verb = 0;
|
0
|
34 |
|
|
35 |
%----------------------------------------------------------------------
|
|
36 |
% INVERSE SOLUTION
|
|
37 |
%----------------------------------------------------------------------
|
|
38 |
|
|
39 |
prof.name = dr.name;
|
|
40 |
prof.cruise = p.cruise_id;
|
|
41 |
prof.software = p.software;
|
|
42 |
prof.magdecl = p.drot;
|
|
43 |
prof.procdir = pwd;
|
9
|
44 |
|
|
45 |
prof.DL_bin_length = p.blen_d;
|
|
46 |
prof.DL_bins = p.nbin_d;
|
|
47 |
prof.DL_blanking = p.blnk_d;
|
|
48 |
prof.DL_bin1_dist = p.dist_d;
|
|
49 |
|
|
50 |
if isfield(p,'nbin_u')
|
|
51 |
prof.UL_bin_length = p.blen_u;
|
|
52 |
prof.UL_bins = p.nbin_u;
|
|
53 |
prof.UL_blanking = p.blnk_u;
|
|
54 |
prof.UL_bin1_dist = p.dist_u;
|
|
55 |
end
|
|
56 |
|
|
57 |
prof.ADCP_superens_dz = p.avdz;
|
|
58 |
prof.depth_resolution = ps.dz;
|
0
|
59 |
|
|
60 |
prof.start_date = sprintf('%d/%02d/%02d',p.time_start(1),p.time_start(2),p.time_start(3));
|
|
61 |
prof.start_time = sprintf('%02d:%02d:%02d',p.time_start(4),p.time_start(5),p.time_start(6));
|
|
62 |
|
|
63 |
prof.end_date = sprintf('%d/%02d/%02d',p.time_end(1),p.time_end(2),p.time_end(3));
|
|
64 |
prof.end_time = sprintf('%02d:%02d:%02d',p.time_end(4),p.time_end(5),p.time_end(6));
|
|
65 |
|
|
66 |
prof.median_time = sprintf('%02d:%02d:%02d',dr.date(4),dr.date(5),dr.date(6));
|
|
67 |
|
|
68 |
prof.lat = dr.lat; prof.lon = dr.lon; % (start+end)/2
|
|
69 |
prof.mean_lat = mean(dr.shiplat); prof.mean_lon = mean(dr.shiplon);
|
|
70 |
prof.median_lat = median(dr.shiplat); prof.median_lon = median(dr.shiplon);
|
|
71 |
prof.start_lat = dr.shiplat(1); prof.start_lon = dr.shiplon(1);
|
|
72 |
prof.end_lat = dr.shiplat(end); prof.end_lon = dr.shiplon(end);
|
|
73 |
i_bot = find(dr.zctd==min(dr.zctd));
|
|
74 |
prof.bot_lat = dr.shiplat(i_bot); prof.bot_lon = dr.shiplon(i_bot);
|
|
75 |
|
|
76 |
prof.depth = dr.z;
|
|
77 |
prof.max_depth = max(prof.depth);
|
|
78 |
|
|
79 |
prof.u = dr.u;
|
|
80 |
prof.dn_u = dr.u_do;
|
|
81 |
prof.up_u = dr.u_up;
|
|
82 |
prof.v = dr.v;
|
|
83 |
prof.dn_v = dr.v_do;
|
|
84 |
prof.up_v = dr.v_up;
|
|
85 |
|
|
86 |
prof.u_fromshear = dr.u_shear_method;
|
|
87 |
prof.v_fromshear = dr.v_shear_method;
|
|
88 |
|
|
89 |
prof.samp = dr.nvel;
|
|
90 |
prof.err = dr.uerr;
|
|
91 |
prof.range = dr.range;
|
|
92 |
if existf(dr,'ensemble_vel_err')
|
|
93 |
prof.ensemble_vel_err = dr.ensemble_vel_err;
|
|
94 |
end
|
|
95 |
|
|
96 |
prof.temp = dr.ctd_t;
|
|
97 |
prof.salin = dr.ctd_s;
|
|
98 |
|
1
|
99 |
struct2ANTS(prof,sprintf('%s.mat',f.res),sprintf('%s.prof',obn));
|
0
|
100 |
|
|
101 |
%----------------------------------------------------------------------
|
|
102 |
% SADCP
|
|
103 |
%----------------------------------------------------------------------
|
|
104 |
|
|
105 |
if existf(dr,'u_sadcp')
|
|
106 |
|
|
107 |
SADCP.name = prof.name;
|
|
108 |
SADCP.cruise = prof.cruise;
|
|
109 |
SADCP.software = prof.software;
|
|
110 |
SADCP.magdecl = prof.magdecl;
|
|
111 |
SADCP.procdir = prof.procdir;
|
|
112 |
SADCP.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median
|
|
113 |
SADCP.time = prof.median_time;
|
|
114 |
SADCP.lat = prof.lat; SADCP.lon = prof.lon;
|
|
115 |
SADCP.start_lat = prof.start_lat; SADCP.start_lon = prof.start_lon;
|
|
116 |
SADCP.end_lat = prof.end_lat; SADCP.end_lon = prof.end_lon;
|
|
117 |
SADCP.mean_lat = prof.mean_lat; SADCP.mean_lon = prof.mean_lon;
|
|
118 |
SADCP.median_lat = prof.median_lat; SADCP.median_lon = prof.median_lon;
|
|
119 |
|
|
120 |
SADCP.depth = dr.z_sadcp;
|
|
121 |
SADCP.max_depth = max(dr.z_sadcp);
|
|
122 |
|
|
123 |
SADCP.u = dr.u_sadcp;
|
|
124 |
SADCP.v = dr.v_sadcp;
|
|
125 |
if existf(dr,'uerr_sadcp') % V7 does not have this
|
|
126 |
SADCP.err = dr.uerr_sadcp;
|
|
127 |
end
|
|
128 |
|
1
|
129 |
struct2ANTS(SADCP,sprintf('%s.mat',f.res),sprintf('%s.SADCP',obn));
|
0
|
130 |
|
|
131 |
end
|
|
132 |
|
|
133 |
%----------------------------------------------------------------------
|
|
134 |
% BT
|
|
135 |
%----------------------------------------------------------------------
|
|
136 |
|
|
137 |
if existf(dr,'ubot')
|
|
138 |
BT.name = prof.name;
|
|
139 |
BT.cruise = prof.cruise;
|
|
140 |
BT.software = prof.software;
|
|
141 |
BT.magdecl = prof.magdecl;
|
|
142 |
BT.procdir = prof.procdir;
|
|
143 |
BT.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median
|
|
144 |
BT.time = prof.median_time;
|
|
145 |
BT.lat = prof.bot_lat;
|
|
146 |
BT.lon = prof.bot_lon;
|
|
147 |
|
|
148 |
BT.depth = dr.zbot;
|
|
149 |
BT.max_depth = max(dr.zbot);
|
|
150 |
|
|
151 |
BT.u = dr.ubot;
|
|
152 |
BT.v = dr.vbot;
|
|
153 |
BT.err = dr.uerrbot;
|
|
154 |
|
1
|
155 |
struct2ANTS(BT,sprintf('%s.mat',f.res),sprintf('%s.BT',obn));
|
0
|
156 |
end
|
|
157 |
|
|
158 |
%----------------------------------------------------------------------
|
|
159 |
% CTD Data
|
|
160 |
%----------------------------------------------------------------------
|
|
161 |
|
|
162 |
global EXPORT_CTD_DATA;
|
|
163 |
if EXPORT_CTD_DATA
|
|
164 |
CTD.name = prof.name;
|
|
165 |
CTD.cruise = prof.cruise;
|
|
166 |
CTD.software = prof.software;
|
|
167 |
CTD.procdir = prof.procdir;
|
|
168 |
CTD.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median
|
|
169 |
CTD.time = prof.median_time;
|
|
170 |
CTD.lat = prof.bot_lat;
|
|
171 |
CTD.lon = prof.bot_lon;
|
|
172 |
CTD.ITS = 90;
|
|
173 |
CTD.depth = dr.z;
|
|
174 |
CTD.temp = dr.ctd_t;
|
|
175 |
CTD.salin = dr.ctd_s;
|
|
176 |
|
1
|
177 |
struct2ANTS(CTD,sprintf('%s.mat',f.res),sprintf('%s.CTD',obn));
|
0
|
178 |
end
|