1 |
edhill |
1.1 |
%======================================================= |
2 |
|
|
% |
3 |
edhill |
1.4 |
% $Header: /u/gcmpack/MITgcm_contrib/high_res_cube/eddy_flux/c20a/plot_c20a.m,v 1.3 2005/02/28 05:49:40 edhill Exp $ |
4 |
edhill |
1.1 |
% |
5 |
|
|
% Ed Hill |
6 |
|
|
% |
7 |
|
|
|
8 |
|
|
% The following are the MatLAB commands used to create the various |
9 |
|
|
% plots related to eddy fluxes using average velocities and densities |
10 |
|
|
% (called bouyancy or "b" in many of the variables) from Dimitris' |
11 |
|
|
% "cube_20a" or "c20a" integration. |
12 |
|
|
|
13 |
|
|
% Groups of commands contained within the following "UNUSED" comments |
14 |
|
|
% we not used in this analyssis. They are "left over" from the |
15 |
|
|
% previous temperature-based calculations and have been kept for |
16 |
|
|
% reference purposes only. |
17 |
|
|
|
18 |
|
|
%------- UNUSED ----------------------- |
19 |
|
|
% ...Commands... |
20 |
|
|
%------- UNUSED ----------------------- |
21 |
|
|
|
22 |
|
|
|
23 |
|
|
% ssh eddy |
24 |
|
|
% cd /r/r0/edhill/eddy_stats/eddy_flux_c20a |
25 |
|
|
|
26 |
|
|
% matlab -nojvm |
27 |
|
|
% matlab -nojvm -nodisplay |
28 |
|
|
|
29 |
|
|
clear all |
30 |
|
|
close all |
31 |
|
|
|
32 |
|
|
|
33 |
edhill |
1.2 |
%================================================================== |
34 |
|
|
% Read the tile00?.mitgrid files |
35 |
edhill |
1.1 |
gvars = { 'XC','YC','DXF','DYF','RA','XG','YG','DXV', ... |
36 |
|
|
'DYU','RAZ','DXC','DYC','RAW','RAS','DXG','DYG' }; |
37 |
|
|
|
38 |
edhill |
1.2 |
ne = 510; |
39 |
|
|
nep1 = ne + 1; |
40 |
edhill |
1.1 |
iface = 1; |
41 |
|
|
for iface = 1:6 |
42 |
|
|
fname = sprintf('grid/tile%03d.mitgrid', iface); |
43 |
|
|
gid = fopen(fname, 'r', 'ieee-be'); |
44 |
edhill |
1.2 |
tmp = reshape(fread(gid,inf,'real*8',0,'ieee-be'),[nep1,nep1,16]); |
45 |
edhill |
1.1 |
fclose(gid); |
46 |
|
|
% surf(tmp(:,:,1)), view(2), shading interp |
47 |
|
|
% for jj = 1:length(gvars) |
48 |
|
|
for jj = 1:7 |
49 |
|
|
comm = sprintf('%s(:,:,%d) = tmp(:,:,%d);', ... |
50 |
|
|
[gvars{jj}], iface, jj); |
51 |
|
|
eval(comm); |
52 |
|
|
end |
53 |
|
|
end |
54 |
|
|
% surf(XC(:,:,1)), view(2), shading interp |
55 |
|
|
% subplot(2,1,1), a = [1:10]; surf(XC(a,a,1)), view(2) |
56 |
edhill |
1.2 |
% subplot(2,1,2), a = [(nep1-10):nep1]; surf(XC(a,a,1)), view(2) |
57 |
edhill |
1.1 |
% surf(YC(:,:,1)), view(2), shading interp |
58 |
|
|
% surf(XG(:,:,1)), view(2), shading interp |
59 |
|
|
% surf(YG(:,:,1)), view(2), shading interp |
60 |
edhill |
1.2 |
is = [1:ne]; |
61 |
|
|
vs = { 'XC','YC','DXF','DYF','RA' }; |
62 |
|
|
for i = 1:length(vs) |
63 |
|
|
eval(sprintf('%s = %s(is,is,:);',vs{i},vs{i})); |
64 |
edhill |
1.1 |
end |
65 |
|
|
|
66 |
edhill |
1.2 |
delR = [ ... |
67 |
|
|
10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ... |
68 |
|
|
10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ... |
69 |
|
|
31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ... |
70 |
|
|
93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ... |
71 |
|
|
139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ... |
72 |
|
|
341.50,364.50,387.50,410.50,433.50,456.50 ]; |
73 |
|
|
R = cumsum(delR) - 0.5*delR; |
74 |
|
|
|
75 |
|
|
%================================================================== |
76 |
|
|
% Project fields to lower-res 1-degree Lat-Lon and write |
77 |
|
|
% as NetCDF for viewing with Ingrid |
78 |
|
|
% |
79 |
edhill |
1.1 |
% !echo `ls -1 ave__92_99 | sed -e 's|\.ave||g' \ |
80 |
|
|
% | sed -e "s|^|'|g" | sed -e "s|$|',|g"` |
81 |
edhill |
1.2 |
fields_3d = { ... |
82 |
|
|
'DRHODR', 'RHOANOSQ', 'RHOAnoma', 'SALT', ... |
83 |
|
|
'SALTSQ', ... |
84 |
|
|
'THETA', 'THETASQ', 'URHOMASS', ... |
85 |
edhill |
1.1 |
'USLTMASS', 'UTHMASS', 'UVEL', 'UVELMASS', 'UVELSQ', ... |
86 |
|
|
'UV_VEL_Z', 'VRHOMASS', 'VSLTMASS', 'VTHMASS', ... |
87 |
|
|
'VVEL', 'VVELMASS', 'VVELSQ', 'WRHOMASS', 'WSLTMASS', ... |
88 |
|
|
'WTHMASS', 'WU_VEL', 'WVELMASS', 'WVELSQ', 'WV_VEL' }; |
89 |
edhill |
1.2 |
fields_2d = { ... |
90 |
|
|
'ETANSQ', 'SFLUX', 'SRELAX', 'TAUX', 'TAUY', 'TFLUX', ... |
91 |
|
|
'TICE', 'TRELAX' }; |
92 |
|
|
% fid = fopen('ave__92_99/DRHODR.ave','r','ieee-be'); |
93 |
|
|
% tmp = fread(gid,inf,'real*4',0,'ieee-be'); |
94 |
|
|
% fclose(fid); |
95 |
|
|
|
96 |
|
|
ne = 510; |
97 |
|
|
nf = 6; |
98 |
|
|
nz = 50; |
99 |
|
|
nslab = ne*ne*nf; |
100 |
|
|
adir = 'ave__92_99'; |
101 |
|
|
lat = [-90:90]; |
102 |
|
|
lon = [0:360]; |
103 |
|
|
|
104 |
|
|
% ! rm -f cube_20a_*.nc |
105 |
|
|
|
106 |
|
|
ifld = 5; |
107 |
|
|
fields = union(fields_2d, fields_3d); |
108 |
|
|
for ifld = 1:length(fields) |
109 |
|
|
|
110 |
edhill |
1.4 |
ir = [ 1 2 3 5 10 15 20 25 30 35 40 50 ]; |
111 |
edhill |
1.2 |
if ismember(fields{ifld},fields_2d) |
112 |
|
|
ir = [ 1 ]; |
113 |
|
|
end |
114 |
|
|
|
115 |
|
|
disp([ ' ' fields{ifld} ' :' ]); |
116 |
|
|
|
117 |
|
|
nc = netcdf(['cube_20a_' fields{ifld} '.nc'], 'clobber'); |
118 |
|
|
nc.reference = [ 'Results from Dimitris Menemenlis''' ... |
119 |
|
|
'"cube 20a" integrations' ]; |
120 |
|
|
nc.author = 'Ed Hill <eh3@mit.edu>'; |
121 |
|
|
nc.date = 'Feb 24, 2005'; |
122 |
|
|
nc('X') = length(lon); |
123 |
|
|
nc('Y') = length(lat); |
124 |
|
|
nc('Z') = length(ir); |
125 |
|
|
nc{'X'} = 'X'; |
126 |
|
|
nc{'Y'} = 'Y'; |
127 |
|
|
nc{'Z'} = 'Z'; |
128 |
|
|
nc{'X'}.uniquename = 'X'; |
129 |
|
|
nc{'X'}.long_name = 'longitude'; |
130 |
|
|
nc{'X'}.gridtype = ncint(1); |
131 |
|
|
nc{'X'}.units = 'degree_east'; |
132 |
|
|
nc{'Y'}.uniquename = 'Y'; |
133 |
|
|
nc{'Y'}.long_name = 'latitude'; |
134 |
|
|
nc{'Y'}.gridtype = ncint(0); |
135 |
|
|
nc{'Y'}.units = 'degree_north'; |
136 |
|
|
nc{'Z'}.uniquename = 'Z'; |
137 |
|
|
nc{'Z'}.long_name = 'depth'; |
138 |
|
|
nc{'Z'}.gridtype = ncint(0); |
139 |
|
|
nc{'Z'}.units = 'm'; |
140 |
|
|
nc{'X'}(:) = lon; |
141 |
|
|
nc{'Y'}(:) = lat; |
142 |
|
|
nc{'Z'}(:) = R(ir); |
143 |
|
|
|
144 |
|
|
fname = sprintf('%s/%s.ave',adir,fields{ifld}); |
145 |
|
|
fid = fopen(fname,'r','ieee-be'); |
146 |
|
|
|
147 |
|
|
id = fields{ifld}; |
148 |
|
|
nc{ id } = { 'Z' 'Y' 'X' }; |
149 |
|
|
nc{ id }.missing_value = ncdouble(NaN); |
150 |
|
|
nc{ id }.FillValue_ = ncdouble(0.0); |
151 |
|
|
|
152 |
|
|
ii = 1; |
153 |
|
|
for ii = 1:length(ir) |
154 |
|
|
|
155 |
|
|
iz = ir(ii); |
156 |
|
|
disp(sprintf(' iz = %g',iz)); |
157 |
|
|
|
158 |
|
|
fseek(fid,nslab*4*(iz-1),'bof'); |
159 |
|
|
tmp = fread(fid,nslab,'real*4',0,'ieee-be'); |
160 |
|
|
tr = permute(reshape(tmp,[ 510 6 510 ]),[1 3 2]); |
161 |
|
|
% surf(tr(:,:,1)), view(2), shading interp |
162 |
|
|
xc360 = XC + 180; |
163 |
|
|
trn = tr; |
164 |
|
|
trn(find(tr == 0.0)) = NaN; |
165 |
|
|
clear tmp tr |
166 |
|
|
% v = sdac_regrid(xc360,YC,trn,lonm,latm); |
167 |
|
|
v = ll_regrid(xc360,YC,trn,lon,lat); |
168 |
|
|
% surf(lon,lat,v'), caxis([25 40]), view(2), shading interp, colorbar |
169 |
|
|
|
170 |
|
|
nc{ id }(ii,:,:) = permute(v,[2 1]); |
171 |
|
|
|
172 |
|
|
end |
173 |
|
|
|
174 |
|
|
fclose(fid); |
175 |
|
|
nc = close(nc); |
176 |
edhill |
1.4 |
|
177 |
edhill |
1.2 |
end |
178 |
edhill |
1.1 |
|
179 |
edhill |
1.3 |
% ! ncdump cube_20a.nc | more |
180 |
|
|
% ! rm -rf output_netCDF ; mkdir output_netCDF |
181 |
|
|
% ! scp output_netCDF/*.nc channel.mit.edu:/home/edhill/INGRID_PEOPLE/EH3/eddy_flux/cube_20a/ |
182 |
|
|
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
%======================================================= |
187 |
|
|
% Compute [uvw]'[tsb]' |
188 |
edhill |
1.1 |
|
189 |
edhill |
1.3 |
clear all ; close all |
190 |
edhill |
1.1 |
|
191 |
edhill |
1.3 |
lpath = 'ave__92_04/'; |
192 |
|
|
u__id = fopen( [lpath 'UVEL.ave'], 'r', 'ieee-be'); % 1 |
193 |
|
|
v__id = fopen( [lpath 'VVEL.ave'], 'r', 'ieee-be'); % 2 |
194 |
|
|
%w__id = fopen( [lpath 'WVEL.ave'], 'r', 'ieee-be'); |
195 |
|
|
u2_id = fopen( [lpath 'UVELSQ.ave'], 'r', 'ieee-be'); % 3 |
196 |
|
|
v2_id = fopen( [lpath 'VVELSQ.ave'], 'r', 'ieee-be'); % 4 |
197 |
|
|
w2_id = fopen( [lpath 'WVELSQ.ave'], 'r', 'ieee-be'); % 5 |
198 |
|
|
um_id = fopen( [lpath 'UVELMASS.ave'], 'r', 'ieee-be'); % 6 |
199 |
|
|
vm_id = fopen( [lpath 'VVELMASS.ave'], 'r', 'ieee-be'); % 7 |
200 |
|
|
wm_id = fopen( [lpath 'WVELMASS.ave'], 'r', 'ieee-be'); % 8 |
201 |
|
|
t__id = fopen( [lpath 'THETA.ave'], 'r', 'ieee-be'); % 9 |
202 |
|
|
t2_id = fopen( [lpath 'THETASQ.ave'], 'r', 'ieee-be'); % 10 |
203 |
|
|
s__id = fopen( [lpath 'SALT.ave'], 'r', 'ieee-be'); % 11 |
204 |
|
|
s2_id = fopen( [lpath 'SALTSQ.ave'], 'r', 'ieee-be'); % 12 |
205 |
|
|
b__id = fopen( [lpath 'RHOAnoma.ave'], 'r', 'ieee-be'); % 13 |
206 |
|
|
b2_id = fopen( [lpath 'RHOANOSQ.ave'], 'r', 'ieee-be'); % 14 |
207 |
|
|
ut_id = fopen( [lpath 'UTHMASS.ave'], 'r', 'ieee-be'); % 15 |
208 |
|
|
vt_id = fopen( [lpath 'VTHMASS.ave'], 'r', 'ieee-be'); % 16 |
209 |
|
|
wt_id = fopen( [lpath 'WTHMASS.ave'], 'r', 'ieee-be'); % 17 |
210 |
|
|
us_id = fopen( [lpath 'USLTMASS.ave'], 'r', 'ieee-be'); % 18 |
211 |
|
|
vs_id = fopen( [lpath 'VSLTMASS.ave'], 'r', 'ieee-be'); % 19 |
212 |
|
|
ws_id = fopen( [lpath 'WSLTMASS.ave'], 'r', 'ieee-be'); % 20 |
213 |
|
|
ub_id = fopen( [lpath 'URHOMASS.ave'], 'r', 'ieee-be'); % 21 |
214 |
|
|
vb_id = fopen( [lpath 'VRHOMASS.ave'], 'r', 'ieee-be'); % 22 |
215 |
|
|
wb_id = fopen( [lpath 'WRHOMASS.ave'], 'r', 'ieee-be'); % 23 |
216 |
|
|
dr_id = fopen( [lpath 'DRHODR.ave'], 'r', 'ieee-be'); % 24 |
217 |
|
|
%_id = fopen( [lpath '.ave'], 'r', 'ieee-be'); % |
218 |
|
|
|
219 |
|
|
iids = [ u__id v__id u2_id v2_id w2_id um_id vm_id wm_id ... |
220 |
|
|
t__id t2_id s__id s2_id b__id b2_id ... |
221 |
|
|
ut_id vt_id wt_id us_id vs_id ws_id ... |
222 |
|
|
ub_id vb_id wb_id dr_id ]; |
223 |
|
|
% !mkdir primes_92_04 |
224 |
|
|
opath = 'primes_92_04/'; |
225 |
|
|
up2___id = fopen([opath 'up2'], 'wb', 'ieee-be'); |
226 |
|
|
vp2___id = fopen([opath 'vp2'], 'wb', 'ieee-be'); |
227 |
|
|
wp2___id = fopen([opath 'wp2'], 'wb', 'ieee-be'); |
228 |
|
|
tp2___id = fopen([opath 'tp2'], 'wb', 'ieee-be'); |
229 |
|
|
sp2___id = fopen([opath 'sp2'], 'wb', 'ieee-be'); |
230 |
|
|
bp2___id = fopen([opath 'bp2'], 'wb', 'ieee-be'); |
231 |
|
|
uptp__id = fopen([opath 'uptp'], 'wb', 'ieee-be'); |
232 |
|
|
vptp__id = fopen([opath 'vptp'], 'wb', 'ieee-be'); |
233 |
|
|
wptp__id = fopen([opath 'wptp'], 'wb', 'ieee-be'); |
234 |
|
|
upsp__id = fopen([opath 'upsp'], 'wb', 'ieee-be'); |
235 |
|
|
vpsp__id = fopen([opath 'vpsp'], 'wb', 'ieee-be'); |
236 |
|
|
wpsp__id = fopen([opath 'wpsp'], 'wb', 'ieee-be'); |
237 |
|
|
upbp__id = fopen([opath 'upbp'], 'wb', 'ieee-be'); |
238 |
|
|
vpbp__id = fopen([opath 'vpbp'], 'wb', 'ieee-be'); |
239 |
|
|
wpbp__id = fopen([opath 'wpbp'], 'wb', 'ieee-be'); |
240 |
|
|
|
241 |
|
|
comm = [ 'permute(reshape(fread( id ,nslab,''real*4'',0,' ... |
242 |
|
|
'''ieee-be''),[ne 6 ne]),[1 3 2]);' ]; |
243 |
|
|
readslab = inline(comm,'id','nslab','ne'); |
244 |
|
|
|
245 |
|
|
ne = 510; |
246 |
|
|
nslab = 6 * ne * ne; |
247 |
|
|
nztot = 50; |
248 |
|
|
iz = 1; |
249 |
|
|
for iz = 1:nztot |
250 |
edhill |
1.1 |
|
251 |
edhill |
1.3 |
disp(sprintf(' iz = %d',iz)); |
252 |
|
|
|
253 |
|
|
offset = (iz - 1)*nslab*4; |
254 |
|
|
for iid = 1:length(iids) |
255 |
|
|
fseek(iids(iid), offset, 'bof'); |
256 |
|
|
end |
257 |
|
|
|
258 |
|
|
u = readslab(u__id,nslab,ne); u2 = readslab(u2_id,nslab,ne); |
259 |
|
|
v = readslab(v__id,nslab,ne); v2 = readslab(v2_id,nslab,ne); |
260 |
|
|
um = readslab(um_id,nslab,ne); |
261 |
|
|
vm = readslab(vm_id,nslab,ne); |
262 |
edhill |
1.4 |
wm = readslab(wm_id,nslab,ne); |
263 |
|
|
% surf(v2(:,:,1)), view(2), shading interp |
264 |
|
|
if (iz < nztot) |
265 |
|
|
wmp1 = readslab(wm_id,nslab,ne); |
266 |
|
|
else |
267 |
|
|
wmp1 = zeros(size(wm)); |
268 |
|
|
end |
269 |
|
|
wmp05 = (wm + wmp1)/2.0; |
270 |
|
|
w2 = readslab(w2_id,nslab,ne); |
271 |
edhill |
1.3 |
t = readslab(t__id,nslab,ne); t2 = readslab(t2_id,nslab,ne); |
272 |
|
|
s = readslab(s__id,nslab,ne); s2 = readslab(s2_id,nslab,ne); |
273 |
|
|
b = readslab(b__id,nslab,ne); b2 = readslab(b2_id,nslab,ne); |
274 |
|
|
|
275 |
|
|
% "simple squared" quantities |
276 |
|
|
up2 = u2 - u.^2; |
277 |
|
|
vp2 = v2 - v.^2; |
278 |
|
|
wp2 = w2 - wm.^2; |
279 |
|
|
fwrite(up2___id, up2, 'real*4'); |
280 |
|
|
fwrite(vp2___id, vp2, 'real*4'); |
281 |
|
|
fwrite(wp2___id, wp2, 'real*4'); |
282 |
|
|
clear up2 vp2 wp2 u2 v2 w2 |
283 |
|
|
tp2 = t2 - t.^2; |
284 |
|
|
sp2 = s2 - s.^2; |
285 |
|
|
bp2 = b2 - b.^2; |
286 |
|
|
fwrite(tp2___id, tp2, 'real*4'); |
287 |
|
|
fwrite(sp2___id, sp2, 'real*4'); |
288 |
|
|
fwrite(bp2___id, bp2, 'real*4'); |
289 |
|
|
clear tp2 sp2 bp2 t2 s2 b2 |
290 |
|
|
|
291 |
|
|
ut = readslab(ut_id,nslab,ne); vt = readslab(vt_id,nslab,ne); |
292 |
|
|
us = readslab(us_id,nslab,ne); vs = readslab(vs_id,nslab,ne); |
293 |
|
|
ub = readslab(ub_id,nslab,ne); vb = readslab(vb_id,nslab,ne); |
294 |
|
|
|
295 |
|
|
[ tonu, tonv ] = mass_on_u_v(t); |
296 |
|
|
[ sonu, sonv ] = mass_on_u_v(s); |
297 |
|
|
[ bonu, bonv ] = mass_on_u_v(b); |
298 |
|
|
uptp = ut - u .* tonu; vptp = vt - v .* tonv; |
299 |
|
|
upsp = us - u .* sonu; vpsp = vs - v .* sonv; |
300 |
|
|
upbp = ub - u .* bonu; vpbp = vb - v .* bonv; |
301 |
|
|
fwrite(uptp__id, uptp, 'real*4'); |
302 |
|
|
fwrite(vptp__id, vptp, 'real*4'); |
303 |
|
|
fwrite(upsp__id, upsp, 'real*4'); |
304 |
|
|
fwrite(vpsp__id, vpsp, 'real*4'); |
305 |
|
|
fwrite(upbp__id, upbp, 'real*4'); |
306 |
|
|
fwrite(vpbp__id, vpbp, 'real*4'); |
307 |
|
|
clear uptp vptp upsp vpsp upbp vpbp |
308 |
edhill |
1.1 |
|
309 |
edhill |
1.4 |
wt = readslab(wt_id,nslab,ne); wptp = wt - wmp05 .* t; |
310 |
|
|
ws = readslab(ws_id,nslab,ne); wpsp = ws - wmp05 .* s; |
311 |
|
|
wb = readslab(wb_id,nslab,ne); wpbp = wb - wmp05 .* b; |
312 |
|
|
fwrite(wptp__id, wptp, 'real*4'); |
313 |
|
|
fwrite(wpsp__id, wpsp, 'real*4'); |
314 |
|
|
fwrite(wpbp__id, wpbp, 'real*4'); |
315 |
|
|
|
316 |
edhill |
1.3 |
end |
317 |
|
|
|
318 |
edhill |
1.4 |
|
319 |
|
|
clear all |
320 |
|
|
close all |
321 |
edhill |
1.3 |
|
322 |
edhill |
1.4 |
%================================================================== |
323 |
|
|
% Read the tile00?.mitgrid files |
324 |
|
|
gvars = { 'XC','YC','DXF','DYF','RA','XG','YG','DXV', ... |
325 |
|
|
'DYU','RAZ','DXC','DYC','RAW','RAS','DXG','DYG' }; |
326 |
|
|
|
327 |
|
|
ne = 510; |
328 |
|
|
nep1 = ne + 1; |
329 |
|
|
iface = 1; |
330 |
|
|
for iface = 1:6 |
331 |
|
|
fname = sprintf('grid/tile%03d.mitgrid', iface); |
332 |
|
|
gid = fopen(fname, 'r', 'ieee-be'); |
333 |
|
|
tmp = reshape(fread(gid,inf,'real*8',0,'ieee-be'),[nep1,nep1,16]); |
334 |
|
|
fclose(gid); |
335 |
|
|
% surf(tmp(:,:,1)), view(2), shading interp |
336 |
|
|
% for jj = 1:length(gvars) |
337 |
|
|
for jj = 1:7 |
338 |
|
|
comm = sprintf('%s(:,:,%d) = tmp(:,:,%d);', ... |
339 |
|
|
[gvars{jj}], iface, jj); |
340 |
|
|
eval(comm); |
341 |
|
|
end |
342 |
|
|
end |
343 |
|
|
% surf(XC(:,:,1)), view(2), shading interp |
344 |
|
|
% subplot(2,1,1), a = [1:10]; surf(XC(a,a,1)), view(2) |
345 |
|
|
% subplot(2,1,2), a = [(nep1-10):nep1]; surf(XC(a,a,1)), view(2) |
346 |
|
|
% surf(YC(:,:,1)), view(2), shading interp |
347 |
|
|
% surf(XG(:,:,1)), view(2), shading interp |
348 |
|
|
% surf(YG(:,:,1)), view(2), shading interp |
349 |
|
|
is = [1:ne]; |
350 |
|
|
vs = { 'XC','YC','DXF','DYF','RA' }; |
351 |
|
|
for i = 1:length(vs) |
352 |
|
|
eval(sprintf('%s = %s(is,is,:);',vs{i},vs{i})); |
353 |
|
|
end |
354 |
|
|
|
355 |
|
|
delR = [ ... |
356 |
|
|
10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ... |
357 |
|
|
10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ... |
358 |
|
|
31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ... |
359 |
|
|
93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ... |
360 |
|
|
139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ... |
361 |
|
|
341.50,364.50,387.50,410.50,433.50,456.50 ]; |
362 |
|
|
R = cumsum(delR) - 0.5*delR; |
363 |
|
|
|
364 |
|
|
n1 = ne - 1; |
365 |
|
|
dux = zeros(size(XC)); |
366 |
|
|
duy = zeros(size(XC)); |
367 |
|
|
dvx = zeros(size(XC)); |
368 |
|
|
dvy = zeros(size(XC)); |
369 |
|
|
dux(:,:,:) = diff(XG(:,1:ne,:),1,1); |
370 |
|
|
dvx(:,:,:) = diff(XG(1:ne,:,:),1,2); |
371 |
|
|
duy(:,:,:) = diff(YG(:,1:ne,:),1,1); |
372 |
|
|
dvy(:,:,:) = diff(YG(1:ne,:,:),1,2); |
373 |
|
|
dux = dux + 360*double(dux < 180); |
374 |
|
|
dux = dux - 360*double(dux > 180); % [ min(min(dux)) max(max(dux)) ] |
375 |
|
|
duy = duy + 360*double(duy < 180); |
376 |
|
|
duy = duy - 360*double(duy > 180); % [ min(min(duy)) max(max(duy)) ] |
377 |
|
|
dvx = dvx + 360*double(dvx < 180); |
378 |
|
|
dvx = dvx - 360*double(dvx > 180); % [ min(min(dvx)) max(max(dvx)) ] |
379 |
|
|
dvy = dvy + 360*double(dvy < 180); |
380 |
|
|
dvy = dvy - 360*double(dvy > 180); % [ min(min(dvy)) max(max(dvy)) ] |
381 |
|
|
llux = dux ./ sqrt(dux.^2 + duy.^2); |
382 |
|
|
lluy = duy ./ sqrt(dux.^2 + duy.^2); |
383 |
|
|
llvx = dvx ./ sqrt(dvx.^2 + dvy.^2); |
384 |
|
|
llvy = dvy ./ sqrt(dvx.^2 + dvy.^2); |
385 |
|
|
|
386 |
|
|
%================================================================== |
387 |
|
|
% Project fields to lower-res 1-degree Lat-Lon and write |
388 |
|
|
% as NetCDF for viewing with Ingrid |
389 |
|
|
% |
390 |
|
|
ne = 510; |
391 |
|
|
nf = 6; |
392 |
|
|
nz = 50; |
393 |
|
|
nslab = ne*ne*nf; |
394 |
|
|
adir = 'primes_92_04'; |
395 |
|
|
lat = [-90:90]; |
396 |
|
|
lon = [0:360]; |
397 |
|
|
ir = [ 1 2 3 5 10 15 20 25 30 35 40 50 ]; |
398 |
|
|
xc360 = XC + 180; |
399 |
|
|
|
400 |
|
|
% ! rm -f cube_20a_primes.nc |
401 |
|
|
nc = netcdf(['cube_20a_primes.nc'], 'clobber'); |
402 |
|
|
nc.reference = [ 'Results from Dimitris Menemenlis''' ... |
403 |
|
|
'"cube 20a" integrations' ]; |
404 |
|
|
nc.author = 'Ed Hill <eh3@mit.edu>'; |
405 |
|
|
nc.date = 'Feb 28, 2005'; |
406 |
|
|
nc('X') = length(lon); |
407 |
|
|
nc('Y') = length(lat); |
408 |
|
|
nc('Z') = length(ir); |
409 |
|
|
nc{'X'} = 'X'; |
410 |
|
|
nc{'Y'} = 'Y'; |
411 |
|
|
nc{'Z'} = 'Z'; |
412 |
|
|
nc{'X'}.uniquename = 'X'; |
413 |
|
|
nc{'X'}.long_name = 'longitude'; |
414 |
|
|
nc{'X'}.gridtype = ncint(1); |
415 |
|
|
nc{'X'}.units = 'degree_east'; |
416 |
|
|
nc{'Y'}.uniquename = 'Y'; |
417 |
|
|
nc{'Y'}.long_name = 'latitude'; |
418 |
|
|
nc{'Y'}.gridtype = ncint(0); |
419 |
|
|
nc{'Y'}.units = 'degree_north'; |
420 |
|
|
nc{'Z'}.uniquename = 'Z'; |
421 |
|
|
nc{'Z'}.long_name = 'depth'; |
422 |
|
|
nc{'Z'}.gridtype = ncint(0); |
423 |
|
|
nc{'Z'}.units = 'm'; |
424 |
|
|
nc{'X'}(:) = lon; |
425 |
|
|
nc{'Y'}(:) = lat; |
426 |
|
|
nc{'Z'}(:) = R(ir); |
427 |
|
|
|
428 |
|
|
f_s_3d = { {'tp2'}, {'sp2'}, {'bp2'} }; |
429 |
|
|
|
430 |
|
|
ifg = 1; |
431 |
|
|
for ifg = 1:length(f_s_3d) |
432 |
|
|
|
433 |
|
|
acell = f_s_3d{ifg}; |
434 |
|
|
tname = acell{1}; |
435 |
|
|
disp([ ' ' tname ' :' ]); |
436 |
|
|
|
437 |
|
|
fname = sprintf('%s/%s',adir,tname); |
438 |
|
|
fid = fopen(fname,'r','ieee-be'); |
439 |
|
|
|
440 |
|
|
id = tname; |
441 |
|
|
nc{ id } = { 'Z' 'Y' 'X' }; |
442 |
|
|
nc{ id }.missing_value = ncdouble(NaN); |
443 |
|
|
nc{ id }.FillValue_ = ncdouble(0.0); |
444 |
|
|
|
445 |
|
|
ii = 1; |
446 |
|
|
for ii = 1:length(ir) |
447 |
|
|
|
448 |
|
|
iz = ir(ii); |
449 |
|
|
disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz))); |
450 |
|
|
|
451 |
|
|
fseek(fid,nslab*4*(iz-1),'bof'); |
452 |
|
|
tmp = fread(fid,nslab,'real*4',0,'ieee-be'); |
453 |
|
|
tr = reshape(tmp,[ 510 510 6 ]); |
454 |
|
|
% surf(tr(:,:,1)), view(2), shading interp |
455 |
|
|
trn = tr; |
456 |
|
|
trn(find(tr == 0.0)) = NaN; |
457 |
|
|
clear tmp tr |
458 |
|
|
% v = sdac_regrid(xc360,YC,trn,lonm,latm); |
459 |
|
|
v = ll_regrid(xc360,YC,trn,lon,lat); |
460 |
|
|
% surf(lon,lat,v'), caxis([25 40]), view(2), shading interp, colorbar |
461 |
|
|
|
462 |
|
|
nc{ id }(ii,:,:) = permute(v,[2 1]); |
463 |
|
|
|
464 |
|
|
end |
465 |
|
|
|
466 |
|
|
fclose(fid); |
467 |
|
|
|
468 |
|
|
end |
469 |
|
|
|
470 |
|
|
id = 'sum_up2_vp2'; |
471 |
|
|
nc{ id } = { 'Z' 'Y' 'X' }; |
472 |
|
|
nc{ id }.missing_value = ncdouble(NaN); |
473 |
|
|
nc{ id }.FillValue_ = ncdouble(0.0); |
474 |
|
|
fidu = fopen(sprintf('%s/%s',adir,'up2'),'r','ieee-be'); |
475 |
|
|
fidv = fopen(sprintf('%s/%s',adir,'vp2'),'r','ieee-be'); |
476 |
|
|
for ii = 1:length(ir) |
477 |
|
|
iz = ir(ii); |
478 |
|
|
disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz))); |
479 |
|
|
fseek(fidu,nslab*4*(iz-1),'bof'); |
480 |
|
|
fseek(fidv,nslab*4*(iz-1),'bof'); |
481 |
|
|
tru = reshape(fread(fidu,nslab,'real*4',0,'ieee-be'),[510 510 6]); |
482 |
|
|
trv = reshape(fread(fidv,nslab,'real*4',0,'ieee-be'),[510 510 6]); |
483 |
|
|
trnu = tru; trnu(find(tru == 0.0)) = NaN; |
484 |
|
|
trnv = trv; trnv(find(trv == 0.0)) = NaN; |
485 |
|
|
clear tmp tru trv |
486 |
|
|
lluv = ll_regrid(xc360,YC,trnu+trnv,lon,lat); |
487 |
|
|
nc{ id }(ii,:,:) = permute(lluv,[2 1]); |
488 |
|
|
end |
489 |
|
|
fclose(fidu); |
490 |
|
|
fclose(fidv); |
491 |
|
|
|
492 |
|
|
f_v_3d = { {'uptp','vptp'}, {'upsp','vpsp'}, {'upbp','vpbp'} }; |
493 |
|
|
for ip = 1:length(f_v_3d) |
494 |
|
|
cell = f_v_3d{ip}; |
495 |
|
|
idu = cell{1}; |
496 |
|
|
idv = cell{2}; |
497 |
|
|
nc{ idu } = { 'Z' 'Y' 'X' }; |
498 |
|
|
nc{ idu }.missing_value = ncdouble(NaN); |
499 |
|
|
nc{ idu }.FillValue_ = ncdouble(0.0); |
500 |
|
|
nc{ idv } = { 'Z' 'Y' 'X' }; |
501 |
|
|
nc{ idv }.missing_value = ncdouble(NaN); |
502 |
|
|
nc{ idv }.FillValue_ = ncdouble(0.0); |
503 |
|
|
fidu = fopen(sprintf('%s/%s',adir,idu),'r','ieee-be'); |
504 |
|
|
fidv = fopen(sprintf('%s/%s',adir,idv),'r','ieee-be'); |
505 |
|
|
for ii = 1:length(ir) |
506 |
|
|
iz = ir(ii); |
507 |
|
|
disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz))); |
508 |
|
|
fseek(fidu,nslab*4*(iz-1),'bof'); |
509 |
|
|
fseek(fidv,nslab*4*(iz-1),'bof'); |
510 |
|
|
tru = reshape(fread(fidu,nslab,'real*4',0,'ieee-be'),[510 510 6]); |
511 |
|
|
trv = reshape(fread(fidv,nslab,'real*4',0,'ieee-be'),[510 510 6]); |
512 |
|
|
trnu = tru; trnu(find(tru == 0.0)) = NaN; |
513 |
|
|
trnv = trv; trnv(find(trv == 0.0)) = NaN; |
514 |
|
|
clear tmp tru trv |
515 |
|
|
llru = trnu .* llux + trnv .* llvx; |
516 |
|
|
llrv = trnu .* lluy + trnv .* llvy; |
517 |
|
|
llu = ll_regrid(xc360,YC,llru,lon,lat); |
518 |
|
|
llv = ll_regrid(xc360,YC,llrv,lon,lat); |
519 |
|
|
nc{ idu }(ii,:,:) = permute(llu,[2 1]); |
520 |
|
|
nc{ idv }(ii,:,:) = permute(llv,[2 1]); |
521 |
|
|
end |
522 |
|
|
end |
523 |
|
|
fclose(fidu); |
524 |
|
|
fclose(fidv); |
525 |
|
|
|
526 |
|
|
nc = close(nc); |
527 |
|
|
|
528 |
|
|
% ! scp cube_20a_primes.nc channel.mit.edu:/home/edhill/INGRID_PEOPLE/EH3/eddy_flux/cube_20a/primes/ |
529 |
|
|
% ! mv cube_20a_primes.nc primes_92_04 |
530 |
|
|
|
531 |
|
|
%------- UNUSED ----------------------- |
532 |
edhill |
1.1 |
|
533 |
|
|
|
534 |
|
|
%======================================================= |
535 |
|
|
% Compute u'b' and v'b' |
536 |
|
|
|
537 |
|
|
clear all; close all |
538 |
|
|
|
539 |
|
|
bfid = fopen( 'b-ave-1992-2003', 'r', 'ieee-be'); |
540 |
|
|
ufid = fopen( 'U_ave_1992-2003', 'r', 'ieee-be'); |
541 |
|
|
vfid = fopen( 'V_ave_1992-2003', 'r', 'ieee-be'); |
542 |
|
|
ubfid = fopen('ub-ave-1992-2003', 'r', 'ieee-be'); |
543 |
|
|
vbfid = fopen('vb-ave-1992-2003', 'r', 'ieee-be'); |
544 |
|
|
|
545 |
|
|
afid = [ ufid vfid ]; |
546 |
|
|
av = [ 'ua'; 'va' ]; |
547 |
|
|
|
548 |
|
|
nztot = 50; |
549 |
|
|
ne = 510; |
550 |
|
|
nps = 6 * ne * ne; |
551 |
|
|
iz = 1; |
552 |
|
|
for iz = 1:nztot |
553 |
|
|
|
554 |
|
|
disp(sprintf('iz = %d', iz)); |
555 |
|
|
|
556 |
|
|
offset = (iz - 1)*nps*4; |
557 |
|
|
id = 1; |
558 |
|
|
for id = 1:length(afid) |
559 |
|
|
fseek(afid(id), offset, 'bof'); |
560 |
|
|
% Convert the horrible JPL mdsio layout to six saner faces |
561 |
|
|
ne = 510; tx = 85; ty = 85; nt = 216; |
562 |
|
|
phi = unmangleJPL1( reshape(fread(afid(id), nps, 'real*4'), ... |
563 |
|
|
tx*nt,ty), ne, tx ); |
564 |
|
|
comm = [ av(id,:) ' = phi;' ]; |
565 |
|
|
% disp(comm); |
566 |
|
|
eval(comm); |
567 |
|
|
end |
568 |
|
|
clear phi |
569 |
|
|
% surf(ua(:,:,1)), view(2), shading interp, axis equal |
570 |
|
|
% surf(va(:,:,1)), view(2), shading interp, axis equal |
571 |
|
|
|
572 |
|
|
fseek(bfid, offset, 'bof'); |
573 |
|
|
b = reshape(fread(bfid, nps, 'real*4'),ne,ne,6); |
574 |
|
|
% surf(b(:,:,1)), view(2), shading interp, axis equal |
575 |
|
|
fseek(ubfid, offset, 'bof'); |
576 |
|
|
ub = reshape(fread(ubfid, nps, 'real*4'),ne,ne,6); |
577 |
|
|
% surf(ub(:,:,1)), view(2), shading interp, axis equal |
578 |
|
|
fseek(vbfid, offset, 'bof'); |
579 |
|
|
vb = reshape(fread(vbfid, nps, 'real*4'),ne,ne,6); |
580 |
|
|
% surf(vb(:,:,1)), view(2), shading interp, axis equal |
581 |
|
|
|
582 |
|
|
% Fill the (ne+1)*(ne+1) grid with B values |
583 |
|
|
ni = ne; nip1 = ni + 1; |
584 |
|
|
nj = ne; njp1 = nj + 1; |
585 |
|
|
bcubep1 = zeros( [ nip1 njp1 6 ] ); |
586 |
|
|
for icf = 1:6 |
587 |
|
|
bcubep1(2:nip1,2:njp1,icf) = b(:,:,icf); |
588 |
|
|
end |
589 |
|
|
|
590 |
|
|
% Do the upwind-edge B exchanges |
591 |
|
|
bcubep1(1,2:njp1,1) = b(ni:-1:1,nj,5); % - |
592 |
|
|
bcubep1(2:nip1,1,1) = b(1:ni,nj,6); % - |
593 |
|
|
bcubep1(1,2:njp1,2) = b(ni,1:nj,1); % - |
594 |
|
|
bcubep1(2:nip1,1,2) = b(ni,nj:-1:1,6); % - |
595 |
|
|
bcubep1(1,2:njp1,3) = b(ni:-1:1,nj,1); % - |
596 |
|
|
bcubep1(2:nip1,1,3) = b(1:ni,nj,2); % - |
597 |
|
|
bcubep1(1,2:njp1,4) = b(ni,1:nj,3); % - |
598 |
|
|
bcubep1(2:nip1,1,4) = b(ni,nj:-1:1,2); % - |
599 |
|
|
bcubep1(1,2:njp1,5) = b(ni:-1:1,nj,3); % - |
600 |
|
|
bcubep1(2:nip1,1,5) = b(1:ni,nj,4); % - |
601 |
|
|
bcubep1(1,2:njp1,6) = b(ni,1:nj,5); % - |
602 |
|
|
bcubep1(2:nip1,1,6) = b(ni,nj:-1:1,4); % - |
603 |
|
|
|
604 |
|
|
% Get B values on the U grid points |
605 |
|
|
masku = 1.0 - abs(diff(double(bcubep1(2:nip1,:,:) == 0.0),1,2)); |
606 |
|
|
diffu = 0.5*diff(bcubep1(2:nip1,:,:),1,2); |
607 |
|
|
bonu = b(:,:,:) + masku.*diffu; |
608 |
|
|
|
609 |
|
|
% Get B values on the V grid points |
610 |
|
|
maskv = 1.0 - abs(diff(double(bcubep1(:,2:nip1,:) == 0.0),1,1)); |
611 |
|
|
diffv = 0.5*diff(bcubep1(:,2:nip1,:),1,1); |
612 |
|
|
bonv = b(:,:,:) + maskv.*diffv; |
613 |
|
|
|
614 |
|
|
% Compute u'B' and v'B' |
615 |
|
|
upbp = ub - ua .* bonu; |
616 |
|
|
vpbp = vb - va .* bonv; |
617 |
|
|
|
618 |
|
|
% Write the results |
619 |
|
|
ubid = fopen('upbp-1992-2003', 'a', 'ieee-be'); |
620 |
|
|
vbid = fopen('vpbp-1992-2003', 'a', 'ieee-be'); |
621 |
|
|
fwrite(ubid, upbp, 'real*4'); |
622 |
|
|
fwrite(vbid, vpbp, 'real*4'); |
623 |
|
|
fclose(ubid); |
624 |
|
|
fclose(vbid); |
625 |
|
|
|
626 |
|
|
end |
627 |
|
|
|
628 |
|
|
%======================================================= |
629 |
|
|
% Plot u'B' and v'B' on a Lat-Lon grid |
630 |
|
|
|
631 |
|
|
clear all, close all |
632 |
|
|
tx = 85; |
633 |
|
|
ty = 85; |
634 |
|
|
nt = 216; |
635 |
|
|
cx = 510; |
636 |
|
|
cy = 510; |
637 |
|
|
nz = 1; |
638 |
|
|
ne = 510; |
639 |
|
|
nps = ne * ne * 6; |
640 |
|
|
|
641 |
|
|
% XCS YCS XGS YGS |
642 |
|
|
fnam = [ 'XC' ; 'YC'; 'XG'; 'YG' ]; |
643 |
|
|
for in = 1:4 |
644 |
|
|
uid = fopen([fnam(in,:) '.data'], 'r', 'ieee-be'); |
645 |
|
|
phi = unmangleJPL1( reshape(fread(uid, nps, 'real*4'), ... |
646 |
|
|
tx*nt,ty), ne, tx ); |
647 |
|
|
fclose(uid); |
648 |
|
|
eval([lower(fnam(in,:)) ' = phi;']); |
649 |
|
|
a = zeros(6*510,510); |
650 |
|
|
for i = 1:6 |
651 |
|
|
xb = (i-1)*510 + 1; xe = xb + 510 - 1; |
652 |
|
|
yb = 1; ye = 510; |
653 |
|
|
a(xb:xe,yb:ye) = phi(:,:,i); |
654 |
|
|
end |
655 |
|
|
eval([lower(fnam(in,:)) 's = a;']) |
656 |
|
|
end |
657 |
|
|
xcs = xcs + -360.0*(xcs > 180.0); |
658 |
|
|
xgs = xgs + -360.0*(xgs > 180.0); |
659 |
|
|
clear phi a |
660 |
|
|
|
661 |
|
|
%======================================================= |
662 |
|
|
% Calculation rotations for Lat-Lon vector alignment |
663 |
|
|
|
664 |
|
|
ne = 510; |
665 |
|
|
n1 = ne - 1; |
666 |
|
|
dux = zeros(size(xg)); |
667 |
|
|
duy = zeros(size(xg)); |
668 |
|
|
dvx = zeros(size(xg)); |
669 |
|
|
dvy = zeros(size(xg)); |
670 |
|
|
dux(1:n1,:,:) = diff(xg,1,1); dux(ne,:,:) = dux(n1,:,:); |
671 |
|
|
dvx(:,1:n1,:) = diff(xg,1,2); dvx(:,ne,:) = dvx(:,n1,:); |
672 |
|
|
duy(1:n1,:,:) = diff(yg,1,1); duy(ne,:,:) = duy(n1,:,:); |
673 |
|
|
dvy(:,1:n1,:) = diff(yg,1,2); dvy(:,ne,:) = dvy(:,n1,:); |
674 |
|
|
dux = dux + 360*double(dux < 180); |
675 |
|
|
dux = dux - 360*double(dux > 180); % [ min(min(dux)) max(max(dux)) ] |
676 |
|
|
duy = duy + 360*double(duy < 180); |
677 |
|
|
duy = duy - 360*double(duy > 180); % [ min(min(duy)) max(max(duy)) ] |
678 |
|
|
dvx = dvx + 360*double(dvx < 180); |
679 |
|
|
dvx = dvx - 360*double(dvx > 180); % [ min(min(dvx)) max(max(dvx)) ] |
680 |
|
|
dvy = dvy + 360*double(dvy < 180); |
681 |
|
|
dvy = dvy - 360*double(dvy > 180); % [ min(min(dvy)) max(max(dvy)) ] |
682 |
|
|
llux = dux ./ sqrt(dux.^2 + duy.^2); |
683 |
|
|
lluy = duy ./ sqrt(dux.^2 + duy.^2); |
684 |
|
|
llvx = dvx ./ sqrt(dvx.^2 + dvy.^2); |
685 |
|
|
llvy = dvy ./ sqrt(dvx.^2 + dvy.^2); |
686 |
|
|
|
687 |
|
|
% surf(xg(:,:,2)), view(2), axis equal, shading interp, colorbar |
688 |
|
|
% surf(dux(:,:,2)), view(2), axis equal, shading interp, colorbar |
689 |
|
|
% surf(duy(:,:,2)), view(2), axis equal, shading interp, colorbar |
690 |
|
|
|
691 |
|
|
delR = [ |
692 |
|
|
10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ... |
693 |
|
|
10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ... |
694 |
|
|
31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ... |
695 |
|
|
93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ... |
696 |
|
|
139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ... |
697 |
|
|
341.50,364.50,387.50,410.50,433.50,456.50 ]; |
698 |
|
|
R = cumsum(delR) - 0.5*delR; |
699 |
|
|
Rmid = R(1:(length(R)-1)) + 0.5*diff(R); |
700 |
|
|
|
701 |
|
|
ne = 510; |
702 |
|
|
nps = ne * ne * 6; |
703 |
|
|
|
704 |
|
|
% u'T' and v'T' |
705 |
|
|
upbpid = fopen('upbp-1992-2003', 'r', 'ieee-be'); |
706 |
|
|
vpbpid = fopen('vpbp-1992-2003', 'r', 'ieee-be'); |
707 |
|
|
|
708 |
|
|
clow = [ -1.0 ]; % -0.2; |
709 |
|
|
chigh = [ 1.0 ]; % 0.2; |
710 |
|
|
|
711 |
|
|
iz = 1; |
712 |
|
|
iz = 15; |
713 |
|
|
iz = 25; |
714 |
|
|
for iz = [ 1:50 ] |
715 |
|
|
disp(sprintf('iz = %d',iz)); |
716 |
|
|
% iz = 21; |
717 |
|
|
offset = (iz - 1)*nps*4; |
718 |
|
|
fseek(upbpid, offset, 'bof'); |
719 |
|
|
fseek(vpbpid, offset, 'bof'); |
720 |
|
|
upbp = reshape(fread(upbpid, nps, 'real*4'),ne,ne,6); |
721 |
|
|
vpbp = reshape(fread(vpbpid, nps, 'real*4'),ne,ne,6); |
722 |
|
|
|
723 |
|
|
|
724 |
|
|
% Look at u'b' and v'b' on ll coords |
725 |
|
|
% surf(xg(:,:,2), yg(:,:,2), upbp(:,:,2)), view(2), shading interp, colorbar |
726 |
|
|
% surf(xg(:,:,3), yg(:,:,3), upbp(:,:,3)), view(2), shading interp, colorbar |
727 |
|
|
% surf(xg(:,:,4), yg(:,:,4), upbp(:,:,4)), view(2), shading interp, colorbar |
728 |
|
|
llupbp = upbp .* llux + vpbp .* llvx; |
729 |
|
|
llvpbp = upbp .* lluy + vpbp .* llvy; |
730 |
|
|
% surf(xg(:,:,2), yg(:,:,2), lluptp(:,:,2)), view(2), shading interp, colorbar |
731 |
|
|
% surf(xg(:,:,2), yg(:,:,2), llvptp(:,:,2)), view(2), shading |
732 |
|
|
% interp, colorbar |
733 |
|
|
|
734 |
|
|
% save for later use |
735 |
|
|
upbpllid = fopen('upbpll-1992-2003', 'a', 'ieee-be'); |
736 |
|
|
vpbpllid = fopen('vpbpll-1992-2003', 'a', 'ieee-be'); |
737 |
|
|
fwrite(upbpllid, llupbp, 'real*4'); |
738 |
|
|
fwrite(vpbpllid, llvpbp, 'real*4'); |
739 |
|
|
fclose(upbpllid); |
740 |
|
|
fclose(vpbpllid); |
741 |
|
|
|
742 |
|
|
% Look at lat-lon projections of u'T' and v'T' |
743 |
|
|
pllupbp = zeros(6*510,510); |
744 |
|
|
pllvpbp = zeros(6*510,510); |
745 |
|
|
for i = 1:6 |
746 |
|
|
xb = (i-1)*510 + 1; xe = xb + 510 - 1; |
747 |
|
|
yb = 1; ye = 510; |
748 |
|
|
pllupbp(xb:xe,yb:ye) = llupbp(:,:,i); |
749 |
|
|
pllvpbp(xb:xe,yb:ye) = llvpbp(:,:,i); |
750 |
|
|
end |
751 |
|
|
shift=-1; |
752 |
|
|
grph_CS(sq(pllupbp),xcs,ycs,xgs,ygs,[clow],[chigh],shift); |
753 |
|
|
title([ 'u''B'' at ' ... |
754 |
|
|
sprintf('%g',R(iz)) ... |
755 |
|
|
'm depth on the 510x510x6 cubesphere for 1992--2003 ["cube5"]']); |
756 |
|
|
% print('-painters', '-dpng', '-r650', ... |
757 |
|
|
% ['upTp_' sprintf('%02d_%07.1f',iz,R(iz)) 'm_650.png']) |
758 |
|
|
print('-painters', '-dpng', '-r150', ... |
759 |
|
|
['upBp_' sprintf('%02d_%07.1f',iz,R(iz)) 'm_150.png']) |
760 |
|
|
|
761 |
|
|
grph_CS(sq(pllvpbp),xcs,ycs,xgs,ygs,[clow],[chigh],shift); |
762 |
|
|
title([ 'v''B'' at ' ... |
763 |
|
|
sprintf('%g',R(iz)) ... |
764 |
|
|
'm depth on the 510x510x6 cubesphere for 1992--2003 ["cube5"]']); |
765 |
|
|
% print('-painters', '-dpng', '-r650', ... |
766 |
|
|
% ['vpTp_' sprintf('%02d_%07.1f',iz,R(iz)) 'm_650.png']) |
767 |
|
|
print('-painters', '-dpng', '-r150', ... |
768 |
|
|
['vpBp_' sprintf('%02d_%07.1f',iz,R(iz)) 'm_150.png']) |
769 |
|
|
|
770 |
|
|
end |
771 |
|
|
|
772 |
|
|
|
773 |
|
|
%======================================================= |
774 |
|
|
% Calculate : (v'B')/(dB/dz) |
775 |
|
|
|
776 |
|
|
bid = fopen( 'b-ave-1992-2003', 'r', 'ieee-be'); |
777 |
|
|
bm1id = fopen('bm1-ave-1992-2003', 'r', 'ieee-be'); |
778 |
|
|
|
779 |
|
|
iz = 1; |
780 |
|
|
offset = (iz - 1)*nps*4; |
781 |
|
|
fseek(upbpid, offset, 'bof'); |
782 |
|
|
fseek(vpbpid, offset, 'bof'); |
783 |
|
|
upbp = reshape(fread(upbpid, nps, 'real*4'),ne,ne,6); |
784 |
|
|
vpbp = reshape(fread(vpbpid, nps, 'real*4'),ne,ne,6); |
785 |
|
|
llvpbp = upbp .* lluy + vpbp .* llvy; |
786 |
|
|
llvpbpm1 = llvpbp; |
787 |
|
|
ne = 510; tx = 85; ty = 85; nt = 216; |
788 |
|
|
|
789 |
|
|
iz = 2; |
790 |
|
|
iz = 15; |
791 |
|
|
iz = 16; |
792 |
|
|
for iz = 2:50, |
793 |
|
|
izm1 = iz - 1; |
794 |
|
|
disp(sprintf('iz = %d',iz)); |
795 |
|
|
% iz = 21; |
796 |
|
|
offset = (iz - 1)*nps*4; |
797 |
|
|
fseek(upbpid, offset, 'bof'); |
798 |
|
|
fseek(vpbpid, offset, 'bof'); |
799 |
|
|
upbp = reshape(fread(upbpid, nps, 'real*4'),ne,ne,6); |
800 |
|
|
vpbp = reshape(fread(vpbpid, nps, 'real*4'),ne,ne,6); |
801 |
|
|
|
802 |
|
|
% v'B' on ll coords |
803 |
|
|
llvpbp = upbp .* lluy + vpbp .* llvy; |
804 |
|
|
|
805 |
|
|
% B and Bm1 |
806 |
|
|
fseek(bid, offset, 'bof'); |
807 |
|
|
b = reshape(fread(bid, nps, 'real*4'),ne,ne,6); |
808 |
|
|
offm1 = (iz - 2)*nps*4; |
809 |
|
|
fseek(bm1id, offm1, 'bof'); |
810 |
|
|
bm1 =reshape(fread(bm1id, nps, 'real*4'),ne,ne,6); |
811 |
|
|
|
812 |
|
|
% ( v'B' )/( dB/dz ) |
813 |
|
|
dbdz = (b - bm1)/(R(iz) - R(izm1)); |
814 |
|
|
ind0 = find(dbdz==0.0); |
815 |
|
|
dbdz(ind0) = 1.0; |
816 |
|
|
rdbdz = 1.0 / (dbdz); |
817 |
|
|
rdbdz(ind0) = 0.0; |
818 |
|
|
vpbpdbdz = 0.5*(llvpbp + llvpbpm1) .* rdbdz; |
819 |
|
|
|
820 |
|
|
% Write the results |
821 |
|
|
mid = fopen('vpbpdbdz-1992-2003', 'a', 'ieee-be'); |
822 |
|
|
fwrite(mid, vpbpdbdz, 'real*4'); |
823 |
|
|
fclose(mid); |
824 |
|
|
|
825 |
|
|
% Plot results |
826 |
|
|
clow = [ -10 ]; % -20; |
827 |
|
|
chigh = [ 10 ]; % 20; |
828 |
|
|
ll = zeros(6*510,510); |
829 |
|
|
for i = 1:6 |
830 |
|
|
xb = (i-1)*510 + 1; xe = xb + 510 - 1; |
831 |
|
|
yb = 1; ye = 510; |
832 |
|
|
ll(xb:xe,yb:ye) = vpbpdbdz(:,:,i); |
833 |
|
|
end |
834 |
|
|
shift=-1; |
835 |
|
|
grph_CS(sq(ll),xcs,ycs,xgs,ygs,[clow],[chigh],shift); |
836 |
|
|
title([ '(v''B'')/(dB/dz) at ' ... |
837 |
|
|
sprintf('%g',Rmid(iz)) ... |
838 |
|
|
'm depth on the 510x510x6 cubesphere for 1992--2003 ["cube5"]']); |
839 |
|
|
% print('-painters', '-dpng', '-r650', ... |
840 |
|
|
% ['vpTpdTdz_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_650.png']) |
841 |
|
|
print('-painters', '-dpng', '-r150', ... |
842 |
|
|
['vpBpdBdz_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_150.png']) |
843 |
|
|
|
844 |
|
|
|
845 |
|
|
% Stress: calc, write, and plot |
846 |
|
|
stress = 1000 * (2*pi/(24*3600)*sin(pi*yc/180)); |
847 |
|
|
stress = stress .* vpbpdbdz; |
848 |
|
|
sid = fopen('stress-b-1992-2003', 'a', 'ieee-be'); |
849 |
|
|
fwrite(sid, stress, 'real*4'); |
850 |
|
|
fclose(sid); |
851 |
|
|
clow = []; % [ -1 ]; |
852 |
|
|
chigh = []; % [ 1 ]; |
853 |
|
|
ll = zeros(6*510,510); |
854 |
|
|
for i = 1:6 |
855 |
|
|
xb = (i-1)*510 + 1; xe = xb + 510 - 1; |
856 |
|
|
yb = 1; ye = 510; |
857 |
|
|
ll(xb:xe,yb:ye) = stress(:,:,i); |
858 |
|
|
end |
859 |
|
|
shift=-1; |
860 |
|
|
grph_CS(sq(ll),xcs,ycs,xgs,ygs,[clow],[chigh],shift); |
861 |
|
|
title([ 'Stress at ' ... |
862 |
|
|
sprintf('%g',Rmid(iz)) ... |
863 |
|
|
'm depth on the 510x510x6 cubesphere for 1994--2003 ["cube5"]']); |
864 |
|
|
% print('-painters', '-dpng', '-r650', ... |
865 |
|
|
% ['stress_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_650.png']) |
866 |
|
|
print('-painters', '-dpng', '-r150', ... |
867 |
|
|
['stress_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_150.png']) |
868 |
|
|
|
869 |
|
|
|
870 |
|
|
% Next level |
871 |
|
|
llvpbpm1 = llvpbp; |
872 |
|
|
|
873 |
|
|
end |
874 |
|
|
|
875 |
|
|
|
876 |
|
|
%======================================================= |
877 |
|
|
% Zonally average vpbpdbdz and stress |
878 |
|
|
|
879 |
|
|
clear all ; close all |
880 |
|
|
tx = 85; |
881 |
|
|
ty = 85; |
882 |
|
|
nt = 216; |
883 |
|
|
cx = 510; |
884 |
|
|
cy = 510; |
885 |
|
|
nz = 1; |
886 |
|
|
ne = 510; |
887 |
|
|
nps = ne * ne * 6; |
888 |
|
|
|
889 |
|
|
% XCS YCS XGS YGS |
890 |
|
|
fnam = [ 'XC' ; 'YC'; 'XG'; 'YG' ]; |
891 |
|
|
for in = 1:4 |
892 |
|
|
uid = fopen([fnam(in,:) '.data'], 'r', 'ieee-be'); |
893 |
|
|
phi = unmangleJPL1( reshape(fread(uid, nps, 'real*4'), ... |
894 |
|
|
tx*nt,ty), ne, tx ); |
895 |
|
|
fclose(uid); |
896 |
|
|
eval([lower(fnam(in,:)) ' = phi;']); |
897 |
|
|
a = zeros(6*510,510); |
898 |
|
|
for i = 1:6 |
899 |
|
|
xb = (i-1)*510 + 1; xe = xb + 510 - 1; |
900 |
|
|
yb = 1; ye = 510; |
901 |
|
|
a(xb:xe,yb:ye) = phi(:,:,i); |
902 |
|
|
end |
903 |
|
|
eval([lower(fnam(in,:)) 's = a;']) |
904 |
|
|
end |
905 |
|
|
xcs = xcs + -360.0*(xcs > 180.0); |
906 |
|
|
xgs = xgs + -360.0*(xgs > 180.0); |
907 |
|
|
clear phi a |
908 |
|
|
|
909 |
|
|
nz = 1; |
910 |
|
|
nr = 50; |
911 |
|
|
nrm1 = nr - 1; |
912 |
|
|
nlat = 181; nlatm1 = nlat - 1; |
913 |
|
|
|
914 |
|
|
hvals = linspace(-90,90,nlat); |
915 |
|
|
% save indicies for zonal averages |
916 |
|
|
i = 2; |
917 |
|
|
for i = 2:nlat |
918 |
|
|
inds = find(hvals(i-1)<yg & yg<hvals(i)); |
919 |
|
|
comm = sprintf('inds%04d = uint32(inds);',i-1); |
920 |
|
|
eval(comm); |
921 |
|
|
end |
922 |
|
|
|
923 |
|
|
% Zonally average vpbp |
924 |
|
|
acc = zeros(nlatm1, nrm1); |
925 |
|
|
num = zeros(size(acc)); |
926 |
|
|
ne = 510; |
927 |
|
|
nps = ne * ne * 6; |
928 |
|
|
zid = fopen('vpbpll-1992-2003', 'r', 'ieee-be'); |
929 |
|
|
iz = 1; |
930 |
|
|
for iz = 1:50, |
931 |
|
|
disp(sprintf('iz = %d',iz)); |
932 |
|
|
offset = (iz - 1)*nps*4; |
933 |
|
|
fseek(zid, offset, 'bof'); |
934 |
|
|
vpbp = reshape(fread(zid, nps, 'real*4'),ne,ne,6); |
935 |
|
|
|
936 |
|
|
for jj = 1:nlatm1 |
937 |
|
|
eval( sprintf('clear inds; inds = inds%04d;',jj) ); |
938 |
|
|
tmp = vpbp(inds); |
939 |
|
|
nzinds = find(tmp ~= 0.0); |
940 |
|
|
num(jj,iz) = length(nzinds); |
941 |
|
|
acc(jj,iz) = sum(tmp(nzinds)); |
942 |
|
|
end |
943 |
|
|
end |
944 |
|
|
fclose(zid); |
945 |
|
|
zvpbp = acc ./ num; |
946 |
|
|
% save zvpbp zvpbp |
947 |
|
|
|
948 |
|
|
% zonally average vpbpdbdz |
949 |
|
|
acc = zeros(nlatm1, nrm1); |
950 |
|
|
num = zeros(size(acc)); |
951 |
|
|
ne = 510; |
952 |
|
|
nps = ne * ne * 6; |
953 |
|
|
zid = fopen('vpbpdbdz-1992-2003', 'r', 'ieee-be'); |
954 |
|
|
iz = 1; |
955 |
|
|
for iz = 1:49, |
956 |
|
|
disp(sprintf('iz = %d',iz)); |
957 |
|
|
offset = (iz - 1)*nps*4; |
958 |
|
|
fseek(zid, offset, 'bof'); |
959 |
|
|
vpbpdbdz = reshape(fread(zid, nps, 'real*4'),ne,ne,6); |
960 |
|
|
|
961 |
|
|
for jj = 1:nlatm1 |
962 |
|
|
eval( sprintf('clear inds; inds = inds%04d;',jj) ); |
963 |
|
|
tmp = vpbpdbdz(inds); |
964 |
|
|
nzinds = find(tmp ~= 0.0); |
965 |
|
|
num(jj,iz) = length(nzinds); |
966 |
|
|
acc(jj,iz) = sum(tmp(nzinds)); |
967 |
|
|
end |
968 |
|
|
end |
969 |
|
|
fclose(zid); |
970 |
|
|
zvpbpdbdz = acc ./ num; |
971 |
|
|
% save zvpbpdbdz zvpbpdbdz |
972 |
|
|
|
973 |
|
|
% zonally average stress |
974 |
|
|
acc = zeros(nlatm1, nrm1); |
975 |
|
|
num = zeros(size(acc)); |
976 |
|
|
ne = 510; |
977 |
|
|
nps = ne * ne * 6; |
978 |
|
|
zid = fopen('stress-b-1992-2003', 'r', 'ieee-be'); |
979 |
|
|
iz = 1; |
980 |
|
|
for iz = 1:49, |
981 |
|
|
disp(sprintf('iz = %d',iz)); |
982 |
|
|
offset = (iz - 1)*nps*4; |
983 |
|
|
fseek(zid, offset, 'bof'); |
984 |
|
|
stress = reshape(fread(zid, nps, 'real*4'),ne,ne,6); |
985 |
|
|
jj = 22; |
986 |
|
|
for jj = 1:nlatm1 |
987 |
|
|
eval( sprintf('clear inds; inds = inds%04d;',jj) ); |
988 |
|
|
tmp = stress(inds); |
989 |
|
|
nzinds = find(tmp ~= 0.0); |
990 |
|
|
num(jj,iz) = length(nzinds); |
991 |
|
|
acc(jj,iz) = sum(tmp(nzinds)); |
992 |
|
|
end |
993 |
|
|
end |
994 |
|
|
fclose(zid); |
995 |
|
|
stress = acc ./ num; |
996 |
|
|
% save stress stress |
997 |
|
|
|
998 |
|
|
%------- UNUSED ----------------------- |
999 |
|
|
% zonally average u |
1000 |
|
|
acc = zeros(nlatm1, 50); |
1001 |
|
|
num = zeros(size(acc)); |
1002 |
|
|
ne = 510; |
1003 |
|
|
nps = ne * ne * 6; |
1004 |
|
|
zid = fopen('Ull_ave_1994--2003', 'r', 'ieee-be'); |
1005 |
|
|
iz = 1; |
1006 |
|
|
for iz = 1:50, |
1007 |
|
|
disp(sprintf('iz = %d',iz)); |
1008 |
|
|
offset = (iz - 1)*nps*4; |
1009 |
|
|
fseek(zid, offset, 'bof'); |
1010 |
|
|
U = reshape(fread(zid, nps, 'real*4'),ne,ne,6); |
1011 |
|
|
jj = 22; |
1012 |
|
|
for jj = 1:nlatm1 |
1013 |
|
|
eval( sprintf('clear inds; inds = inds%04d;',jj) ); |
1014 |
|
|
tmp = U(inds); |
1015 |
|
|
nzinds = find(tmp ~= 0.0); |
1016 |
|
|
num(jj,iz) = length(nzinds); |
1017 |
|
|
acc(jj,iz) = sum(tmp(nzinds)); |
1018 |
|
|
end |
1019 |
|
|
end |
1020 |
|
|
fclose(zid); |
1021 |
|
|
zonalu = acc ./ num; |
1022 |
|
|
% save zonalu zonalu |
1023 |
|
|
%------- UNUSED ----------------------- |
1024 |
|
|
|
1025 |
|
|
% zonally average B |
1026 |
|
|
acc = zeros(nlatm1, 50); |
1027 |
|
|
num = zeros(size(acc)); |
1028 |
|
|
ne = 510; |
1029 |
|
|
nps = ne * ne * 6; |
1030 |
|
|
zid = fopen('b-ave-1992-2003', 'r', 'ieee-be'); |
1031 |
|
|
iz = 1; |
1032 |
|
|
for iz = 1:50, |
1033 |
|
|
disp(sprintf('iz = %d',iz)); |
1034 |
|
|
offset = (iz - 1)*nps*4; |
1035 |
|
|
fseek(zid, offset, 'bof'); |
1036 |
|
|
B = reshape(fread(zid, nps, 'real*4'),ne,ne,6); |
1037 |
|
|
jj = 22; |
1038 |
|
|
for jj = 1:nlatm1 |
1039 |
|
|
eval( sprintf('clear inds; inds = inds%04d;',jj) ); |
1040 |
|
|
tmp = B(inds); |
1041 |
|
|
nzinds = find(tmp ~= 0.0); |
1042 |
|
|
num(jj,iz) = length(nzinds); |
1043 |
|
|
acc(jj,iz) = sum(tmp(nzinds)); |
1044 |
|
|
end |
1045 |
|
|
end |
1046 |
|
|
fclose(zid); |
1047 |
|
|
zonalB = acc ./ num; |
1048 |
|
|
% save zonalB zonalB |
1049 |
|
|
|
1050 |
|
|
%------- UNUSED ----------------------- |
1051 |
|
|
% Vertical gradient of zonally averaged B (dB/dz) |
1052 |
|
|
load zonalT |
1053 |
|
|
load allR |
1054 |
|
|
nz = size(zonalT,1); |
1055 |
|
|
dzaTdz = zeros(nz,size(zonalT,2)-1); |
1056 |
|
|
for iz = 2:50 |
1057 |
|
|
dzaTdz(:,iz-1) = (zonalT(:,iz) - zonalT(:,iz-1)) ./ (R(iz) - R(iz-1)); |
1058 |
|
|
end |
1059 |
|
|
% save dzaTdz dzaTdz |
1060 |
|
|
%------- UNUSED ----------------------- |
1061 |
|
|
|
1062 |
|
|
|
1063 |
|
|
delR = [ |
1064 |
|
|
10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ... |
1065 |
|
|
10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ... |
1066 |
|
|
31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ... |
1067 |
|
|
93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ... |
1068 |
|
|
139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ... |
1069 |
|
|
341.50,364.50,387.50,410.50,433.50,456.50 ]; |
1070 |
|
|
R = cumsum(delR) - 0.5*delR; |
1071 |
|
|
Rmid = R(1:(length(R)-1)) + 0.5*diff(R); |
1072 |
|
|
hmid = [ -89.5:1:89.5 ]; |
1073 |
|
|
% save allR delR R Rmid hmid |
1074 |
|
|
|
1075 |
|
|
%------- UNUSED ----------------------- |
1076 |
|
|
surf(hmid,-Rmid,num'), view(2), shading interp, colorbar |
1077 |
|
|
caxis([ -1 1 ]) |
1078 |
|
|
caxis('manual') |
1079 |
|
|
surf(hmid,-Rmid,mu'), view(2), shading interp, colorbar |
1080 |
|
|
title('Zonally Averaged Stress for 1994--2003 [cube5]') |
1081 |
|
|
xlabel('Latitude [deg]') |
1082 |
|
|
zlabel('Depth [m]') |
1083 |
|
|
axis([ -90 90 -5500 200 ]) |
1084 |
|
|
|
1085 |
|
|
% print -dps -painters t_001.ps |
1086 |
|
|
print('-painters', '-dpng', '-r150', 'za_str_94--03_r150.png') |
1087 |
|
|
print('-painters', '-dpng', '-r650', 'za_str_94--03_r650.png') |
1088 |
|
|
|
1089 |
|
|
% plot and print bar(U) |
1090 |
|
|
load zonalu |
1091 |
|
|
surf(hmid,-R,zonalu'), view(2), shading interp, colorbar |
1092 |
|
|
contour(hmid,-R,mu'), colorbar |
1093 |
|
|
ac = 25; |
1094 |
|
|
ac = [-0.3:.005:.3]; |
1095 |
|
|
[c,h] = contourf(hmid,-R,mu',ac); colorbar |
1096 |
|
|
hold on, contour(hmid,-R,mu',ac), hold off |
1097 |
|
|
title('Zonally Averaged U for 1994--2003 [cube5]') |
1098 |
|
|
xlabel('Latitude [deg]') |
1099 |
|
|
zlabel('Depth [m]') |
1100 |
|
|
axis([ -90 90 -6000 200 ]) |
1101 |
|
|
print('-painters', '-dpng', '-r150', 'Ull_94--03_r150.png') |
1102 |
|
|
print('-painters', '-dpng', '-r650', 'Ull_94--03_r650.png') |
1103 |
|
|
%------- UNUSED ----------------------- |
1104 |
|
|
|
1105 |
|
|
|
1106 |
|
|
%======================================================= |
1107 |
|
|
% Put it all in NetCDF |
1108 |
|
|
|
1109 |
|
|
clear all ; close all |
1110 |
|
|
load allR |
1111 |
|
|
% load zonalu |
1112 |
|
|
load zvpbpdbdz |
1113 |
|
|
load stress |
1114 |
|
|
load zonalB |
1115 |
|
|
% load dzaTdz |
1116 |
|
|
load zvpbp |
1117 |
|
|
|
1118 |
|
|
% id0 = 'U'; |
1119 |
|
|
id1 = 'zvpbpdbdz'; |
1120 |
|
|
id2 = 'stress'; |
1121 |
|
|
id3 = 'B'; |
1122 |
|
|
% id4 = 'dzaTdz'; |
1123 |
|
|
id5 = 'zvpbp'; |
1124 |
|
|
% units0 = 'm/s'; |
1125 |
|
|
units1 = 'm^2/s'; |
1126 |
|
|
units2 = 'N/m^2'; |
1127 |
|
|
units3 = 'kg/m^3'; |
1128 |
|
|
% units4 = 'deg C/m'; |
1129 |
|
|
units5 = 'm*kg/m^3'; |
1130 |
|
|
|
1131 |
|
|
!rm -f Zonal_ave_92-03.nc |
1132 |
|
|
nc = netcdf('Zonal_ave_92-03.nc', 'clobber'); |
1133 |
|
|
nc.reference = 'Zonal averages from Dimitris "cube 5" integrations'; |
1134 |
|
|
nc.author = 'Ed Hill <eh3@mit.edu>'; |
1135 |
|
|
nc.date = 'Aug 11, 2004'; |
1136 |
|
|
|
1137 |
|
|
nc('X') = length(hmid); |
1138 |
|
|
nc('Y') = length(R); |
1139 |
|
|
nc('Ym1') = length(R) - 1; |
1140 |
|
|
nc{'X'} = 'X'; |
1141 |
|
|
nc{'Y'} = 'Y'; |
1142 |
|
|
nc{'Ym1'} = 'Ym1'; |
1143 |
|
|
% nc{ id0 } = { 'Y', 'X' }; |
1144 |
|
|
nc{ id1 } = { 'Ym1', 'X' }; |
1145 |
|
|
nc{ id2 } = { 'Ym1', 'X' }; |
1146 |
|
|
nc{ id3 } = { 'Y', 'X' }; |
1147 |
|
|
% nc{ id4 } = { 'Ym1', 'X' }; |
1148 |
|
|
nc{ id5 } = { 'Y', 'X' }; |
1149 |
|
|
nc{'X'}.uniquename = 'X'; |
1150 |
|
|
nc{'X'}.long_name = 'latitude'; |
1151 |
|
|
nc{'X'}.gridtype = ncint(0); |
1152 |
|
|
nc{'X'}.units = 'degree_north'; |
1153 |
|
|
nc{'Y'}.uniquename = 'Y'; |
1154 |
|
|
nc{'Y'}.long_name = 'depth'; |
1155 |
|
|
nc{'Y'}.gridtype = ncint(1); |
1156 |
|
|
nc{'Y'}.units = 'm'; |
1157 |
|
|
nc{'Ym1'}.uniquename = 'Ym1'; |
1158 |
|
|
nc{'Ym1'}.long_name = 'depth'; |
1159 |
|
|
nc{'Ym1'}.gridtype = ncint(1); |
1160 |
|
|
nc{'Ym1'}.units = 'm'; |
1161 |
|
|
% nc{ id0 }.units = units0; |
1162 |
|
|
% nc{ id0 }.long_name = id0; |
1163 |
|
|
% nc{ id0 }.missing_value = ncdouble(NaN); |
1164 |
|
|
% nc{ id0 }.FillValue_ = ncdouble(0.); |
1165 |
|
|
nc{ id1 }.units = units1; |
1166 |
|
|
nc{ id1 }.long_name = id1; |
1167 |
|
|
nc{ id1 }.missing_value = ncdouble(NaN); |
1168 |
|
|
nc{ id1 }.FillValue_ = ncdouble(0.); |
1169 |
|
|
nc{ id2 }.units = units2; |
1170 |
|
|
nc{ id2 }.long_name = id2; |
1171 |
|
|
nc{ id2 }.missing_value = ncdouble(NaN); |
1172 |
|
|
nc{ id2 }.FillValue_ = ncdouble(0.); |
1173 |
|
|
nc{ id3 }.units = units3; |
1174 |
|
|
nc{ id3 }.long_name = id3; |
1175 |
|
|
nc{ id3 }.missing_value = ncdouble(NaN); |
1176 |
|
|
nc{ id3 }.FillValue_ = ncdouble(0.); |
1177 |
|
|
% nc{ id4 }.units = units4; |
1178 |
|
|
% nc{ id4 }.long_name = id4; |
1179 |
|
|
% nc{ id4 }.missing_value = ncdouble(NaN); |
1180 |
|
|
% nc{ id4 }.FillValue_ = ncdouble(0.); |
1181 |
|
|
nc{ id5 }.units = units5; |
1182 |
|
|
nc{ id5 }.long_name = id5; |
1183 |
|
|
nc{ id5 }.missing_value = ncdouble(NaN); |
1184 |
|
|
nc{ id5 }.FillValue_ = ncdouble(0.); |
1185 |
|
|
nc{'X'}(:) = hmid; |
1186 |
|
|
nc{'Y'}(:) = -R; |
1187 |
|
|
nc{'Ym1'}(:) = -Rmid; |
1188 |
|
|
% nc{ id0 }(:) = permute(zonalu,[ 2 1 ]); |
1189 |
|
|
nc{ id1 }(:) = permute(zvpbpdbdz,[ 2 1 ]); |
1190 |
|
|
nc{ id2 }(:) = permute(stress,[ 2 1 ]); |
1191 |
|
|
nc{ id3 }(:) = permute(zonalB,[ 2 1 ]); |
1192 |
|
|
% nc{ id4 }(:) = permute(dzaTdz,[ 2 1 ]); |
1193 |
|
|
nc{ id5 }(:) = permute(zvpbp,[ 2 1 ]); |
1194 |
|
|
nc = close(nc); |
1195 |
|
|
|
1196 |
|
|
% !scp Zonal_ave_92-03.nc ingrid.mit.edu:INGRID_PEOPLE/EH3/eddy_flux/cube_5/ |