/[MITgcm]/MITgcm_contrib/high_res_cube/eddy_flux/c22/plot_c22.m
ViewVC logotype

Annotation of /MITgcm_contrib/high_res_cube/eddy_flux/c22/plot_c22.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Mon Mar 28 02:22:20 2005 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
 initial check-in

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

  ViewVC Help
Powered by ViewVC 1.1.22