author | A.M. Thurnherr <athurnherr@yahoo.com> |
Thu, 21 Nov 2013 11:25:53 +0000 | |
changeset 11 | 21c72df92e2c |
parent 9 | 79a432124b57 |
parent 10 | e7f16c6e18db |
child 12 | 19bf03af3c6e |
permissions | -rw-r--r-- |
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 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
4 |
% dlm: Thu Nov 21 11:25:26 2013 |
0 | 5 |
% (c) 2006 A.M. Thurnherr |
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
6 |
% uE-Info: 59 0 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 |
|
10 | 17 |
% Feb 8, 2006: - made compatible with ANTS V7 |
0 | 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 |
|
10 | 23 |
% Apr 23, 2009: - added global 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 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
27 |
% - added %depth_resolution %ADCP_superens_dz to output, requiring ps as |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
28 |
% additional input |
10 | 29 |
% Nov 10, 2013: - added prof.dayNo |
0 | 30 |
|
9 | 31 |
function [] = LDEO_LADCP2ANTS(dr,f,p,ps,obn) |
32 |
||
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
33 |
global STRUCT2ANTS; % suppress diagnostic messages |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
34 |
STRUCT2ANTS.verb = 0; |
0 | 35 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
36 |
%---------------------------------------------------------------------- |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
37 |
% INVERSE SOLUTION |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
38 |
%---------------------------------------------------------------------- |
0 | 39 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
40 |
prof.name = dr.name; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
41 |
prof.cruise = p.cruise_id; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
42 |
prof.software = p.software; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
43 |
prof.magdecl = p.drot; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
44 |
prof.procdir = pwd; |
0 | 45 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
46 |
prof.DL_bin_length = p.blen_d; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
47 |
prof.DL_bins = p.nbin_d; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
48 |
prof.DL_blanking = p.blnk_d; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
49 |
prof.DL_bin1_dist = p.dist_d; |
9 | 50 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
51 |
if isfield(p,'nbin_u') |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
52 |
prof.UL_bin_length = p.blen_u; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
53 |
prof.UL_bins = p.nbin_u; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
54 |
prof.UL_blanking = p.blnk_u; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
55 |
prof.UL_bin1_dist = p.dist_u; |
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
56 |
end |
9 | 57 |
|
11
21c72df92e2c
post US5 & merged with whoosher local copy
A.M. Thurnherr <athurnherr@yahoo.com>
diff
changeset
|
58 |
prof.ADCP_superens_dz = p.avdz; |
9 | 59 |
prof.depth_resolution = ps.dz; |
0 | 60 |
|
61 |
prof.start_date = sprintf('%d/%02d/%02d',p.time_start(1),p.time_start(2),p.time_start(3)); |
|
62 |
prof.start_time = sprintf('%02d:%02d:%02d',p.time_start(4),p.time_start(5),p.time_start(6)); |
|
10 | 63 |
prof.dayNo = datenum(p.time_start) - datenum(p.time_start(1),1,1) + 1; |
0 | 64 |
|
65 |
prof.end_date = sprintf('%d/%02d/%02d',p.time_end(1),p.time_end(2),p.time_end(3)); |
|
66 |
prof.end_time = sprintf('%02d:%02d:%02d',p.time_end(4),p.time_end(5),p.time_end(6)); |
|
67 |
||
68 |
prof.median_time = sprintf('%02d:%02d:%02d',dr.date(4),dr.date(5),dr.date(6)); |
|
69 |
||
70 |
prof.lat = dr.lat; prof.lon = dr.lon; % (start+end)/2 |
|
71 |
prof.mean_lat = mean(dr.shiplat); prof.mean_lon = mean(dr.shiplon); |
|
72 |
prof.median_lat = median(dr.shiplat); prof.median_lon = median(dr.shiplon); |
|
73 |
prof.start_lat = dr.shiplat(1); prof.start_lon = dr.shiplon(1); |
|
74 |
prof.end_lat = dr.shiplat(end); prof.end_lon = dr.shiplon(end); |
|
75 |
i_bot = find(dr.zctd==min(dr.zctd)); |
|
76 |
prof.bot_lat = dr.shiplat(i_bot); prof.bot_lon = dr.shiplon(i_bot); |
|
77 |
||
78 |
prof.depth = dr.z; |
|
79 |
prof.max_depth = max(prof.depth); |
|
80 |
||
81 |
prof.u = dr.u; |
|
82 |
prof.dn_u = dr.u_do; |
|
83 |
prof.up_u = dr.u_up; |
|
84 |
prof.v = dr.v; |
|
85 |
prof.dn_v = dr.v_do; |
|
86 |
prof.up_v = dr.v_up; |
|
87 |
||
88 |
prof.u_fromshear = dr.u_shear_method; |
|
89 |
prof.v_fromshear = dr.v_shear_method; |
|
90 |
||
91 |
prof.samp = dr.nvel; |
|
92 |
prof.err = dr.uerr; |
|
93 |
prof.range = dr.range; |
|
94 |
if existf(dr,'ensemble_vel_err') |
|
95 |
prof.ensemble_vel_err = dr.ensemble_vel_err; |
|
96 |
end |
|
97 |
||
98 |
prof.temp = dr.ctd_t; |
|
99 |
prof.salin = dr.ctd_s; |
|
100 |
||
1 | 101 |
struct2ANTS(prof,sprintf('%s.mat',f.res),sprintf('%s.prof',obn)); |
0 | 102 |
|
103 |
%---------------------------------------------------------------------- |
|
104 |
% SADCP |
|
105 |
%---------------------------------------------------------------------- |
|
106 |
||
107 |
if existf(dr,'u_sadcp') |
|
108 |
||
109 |
SADCP.name = prof.name; |
|
110 |
SADCP.cruise = prof.cruise; |
|
111 |
SADCP.software = prof.software; |
|
112 |
SADCP.magdecl = prof.magdecl; |
|
113 |
SADCP.procdir = prof.procdir; |
|
114 |
SADCP.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median |
|
115 |
SADCP.time = prof.median_time; |
|
116 |
SADCP.lat = prof.lat; SADCP.lon = prof.lon; |
|
117 |
SADCP.start_lat = prof.start_lat; SADCP.start_lon = prof.start_lon; |
|
118 |
SADCP.end_lat = prof.end_lat; SADCP.end_lon = prof.end_lon; |
|
119 |
SADCP.mean_lat = prof.mean_lat; SADCP.mean_lon = prof.mean_lon; |
|
120 |
SADCP.median_lat = prof.median_lat; SADCP.median_lon = prof.median_lon; |
|
121 |
||
122 |
SADCP.depth = dr.z_sadcp; |
|
123 |
SADCP.max_depth = max(dr.z_sadcp); |
|
124 |
||
125 |
SADCP.u = dr.u_sadcp; |
|
126 |
SADCP.v = dr.v_sadcp; |
|
127 |
if existf(dr,'uerr_sadcp') % V7 does not have this |
|
128 |
SADCP.err = dr.uerr_sadcp; |
|
129 |
end |
|
130 |
||
1 | 131 |
struct2ANTS(SADCP,sprintf('%s.mat',f.res),sprintf('%s.SADCP',obn)); |
0 | 132 |
|
133 |
end |
|
134 |
||
135 |
%---------------------------------------------------------------------- |
|
136 |
% BT |
|
137 |
%---------------------------------------------------------------------- |
|
138 |
||
139 |
if existf(dr,'ubot') |
|
140 |
BT.name = prof.name; |
|
141 |
BT.cruise = prof.cruise; |
|
142 |
BT.software = prof.software; |
|
143 |
BT.magdecl = prof.magdecl; |
|
144 |
BT.procdir = prof.procdir; |
|
145 |
BT.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median |
|
146 |
BT.time = prof.median_time; |
|
147 |
BT.lat = prof.bot_lat; |
|
148 |
BT.lon = prof.bot_lon; |
|
149 |
||
150 |
BT.depth = dr.zbot; |
|
151 |
BT.max_depth = max(dr.zbot); |
|
152 |
||
153 |
BT.u = dr.ubot; |
|
154 |
BT.v = dr.vbot; |
|
155 |
BT.err = dr.uerrbot; |
|
156 |
||
1 | 157 |
struct2ANTS(BT,sprintf('%s.mat',f.res),sprintf('%s.BT',obn)); |
0 | 158 |
end |
159 |
||
160 |
%---------------------------------------------------------------------- |
|
161 |
% CTD Data |
|
162 |
%---------------------------------------------------------------------- |
|
163 |
||
164 |
global EXPORT_CTD_DATA; |
|
165 |
if EXPORT_CTD_DATA |
|
166 |
CTD.name = prof.name; |
|
167 |
CTD.cruise = prof.cruise; |
|
168 |
CTD.software = prof.software; |
|
169 |
CTD.procdir = prof.procdir; |
|
170 |
CTD.date = sprintf('%d/%02d/%02d',dr.date(1),dr.date(2),dr.date(3)); % median |
|
171 |
CTD.time = prof.median_time; |
|
172 |
CTD.lat = prof.bot_lat; |
|
173 |
CTD.lon = prof.bot_lon; |
|
174 |
CTD.ITS = 90; |
|
175 |
CTD.depth = dr.z; |
|
176 |
CTD.temp = dr.ctd_t; |
|
177 |
CTD.salin = dr.ctd_s; |
|
178 |
||
1 | 179 |
struct2ANTS(CTD,sprintf('%s.mat',f.res),sprintf('%s.CTD',obn)); |
0 | 180 |
end |