/[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.2 - (hide annotations) (download)
Mon Mar 28 21:42:31 2005 UTC (20 years, 4 months ago) by edhill
Branch: MAIN
Changes since 1.1: +17 -14 lines
 o fix a few bugs and update for c22

1 edhill 1.1 %=======================================================
2     %
3 edhill 1.2 % $Id: plot_c22.m,v 1.1 2005/03/28 02:22:20 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_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 edhill 1.2 lpath = 'ave_1992-2004/';
255 edhill 1.1 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 edhill 1.2 vpbp = readcubelev(zidv,nslab,ne);
423     llupbp = upbp .* llux + vpbp .* llvx;
424 edhill 1.1 llvpbp = upbp .* lluy + vpbp .* llvy;
425     % surf(llvpbp(:,:,1)), view(2), shading interp, caxis([-.1 .1])
426     for jj = 1:nlatm1
427     eval( sprintf('clear inds; inds = inds%04d;',jj) );
428     tmp = llvpbp(inds);
429     nzinds = find(tmp ~= 0.0);
430     num(jj,iz) = length(nzinds);
431     acc(jj,iz) = sum(tmp(nzinds));
432     end
433     end
434     fclose(zidu);
435     fclose(zidv);
436     llzvpbp = acc ./ num;
437 edhill 1.2 % surf(llupbp(:,:,1)'), view(2), shading interp, caxis([-.1 .1])
438     % surf(llvpbp(:,:,1)'), view(2), shading interp, caxis([-.1 .1])
439     % surf(llzvpbp'), view(2), shading interp, caxis([-.1 .1])
440     % save primes_92_04/za_llvpbp.mat llzvpbp llupbp llvpbp
441 edhill 1.1
442     % zonally average ll_vpbp_dbdz
443     acc = zeros(nlatm1, nrm1);
444     num = zeros(size(acc));
445     zid = fopen('primes_92_04/vpbp_dbdz', 'r', 'ieee-be');
446     iz = 1;
447     for iz = 1:49,
448     disp(sprintf('iz = %d',iz));
449     fseek(zid, (iz - 1)*(ne*ne*6)*4, 'bof');
450     vpbpdbdz = readcubelev(zid,nslab,ne);
451     % surf(vpbpdbdz(:,:,1)), view(2), shading interp, caxis([-50 50])
452     for jj = 1:nlatm1
453     eval( sprintf('clear inds; inds = inds%04d;',jj) );
454     tmp = vpbpdbdz(inds);
455     nzinds = find(tmp ~= 0.0);
456     num(jj,iz) = length(nzinds);
457     acc(jj,iz) = sum(tmp(nzinds));
458     end
459     end
460     fclose(zid);
461     za_ll_vpbp_dbdz = acc ./ num;
462     % save primes_92_04/za_ll_vpbp_dbdz.mat za_ll_vpbp_dbdz
463    
464     % zonally average stress
465     acc = zeros(nlatm1, nrm1);
466     num = zeros(size(acc));
467     zid = fopen('primes_92_04/stress', 'r', 'ieee-be');
468     iz = 1;
469     for iz = 1:49,
470     disp(sprintf('iz = %d',iz));
471     fseek(zid, (iz - 1)*(ne*ne*6)*4, 'bof');
472     stress = readcubelev(zid,nslab,ne);
473     for jj = 1:nlatm1
474     eval( sprintf('clear inds; inds = inds%04d;',jj) );
475     tmp = stress(inds);
476     nzinds = find(tmp ~= 0.0);
477     num(jj,iz) = length(nzinds);
478     acc(jj,iz) = sum(tmp(nzinds));
479     end
480     end
481     fclose(zid);
482     stress = acc ./ num;
483     % save primes_92_04/stress.mat stress
484    
485 edhill 1.2
486 edhill 1.1
487     clear all
488     close all
489    
490     %==================================================================
491     % Read the tile00?.mitgrid files
492     gvars = { 'XC','YC','DXF','DYF','RA','XG','YG','DXV', ...
493     'DYU','RAZ','DXC','DYC','RAW','RAS','DXG','DYG' };
494    
495     ne = 510;
496     nep1 = ne + 1;
497     iface = 1;
498     for iface = 1:6
499     fname = sprintf('grid/tile%03d.mitgrid', iface);
500     gid = fopen(fname, 'r', 'ieee-be');
501     tmp = reshape(fread(gid,inf,'real*8',0,'ieee-be'),[nep1,nep1,16]);
502     fclose(gid);
503     % surf(tmp(:,:,1)), view(2), shading interp
504     % for jj = 1:length(gvars)
505     for jj = 1:7
506     comm = sprintf('%s(:,:,%d) = tmp(:,:,%d);', ...
507     [gvars{jj}], iface, jj);
508     eval(comm);
509     end
510     end
511     % surf(XC(:,:,1)), view(2), shading interp
512     % subplot(2,1,1), a = [1:10]; surf(XC(a,a,1)), view(2)
513     % subplot(2,1,2), a = [(nep1-10):nep1]; surf(XC(a,a,1)), view(2)
514     % surf(YC(:,:,1)), view(2), shading interp
515     % surf(XG(:,:,1)), view(2), shading interp
516     % surf(YG(:,:,1)), view(2), shading interp
517     is = [1:ne];
518     vs = { 'XC','YC','DXF','DYF','RA' };
519     for i = 1:length(vs)
520     eval(sprintf('%s = %s(is,is,:);',vs{i},vs{i}));
521     end
522    
523     delR = [ ...
524     10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ...
525     10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ...
526     31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ...
527     93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ...
528     139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ...
529     341.50,364.50,387.50,410.50,433.50,456.50 ];
530     R = cumsum(delR) - 0.5*delR;
531    
532     n1 = ne - 1;
533     dux = zeros(size(XC));
534     duy = zeros(size(XC));
535     dvx = zeros(size(XC));
536     dvy = zeros(size(XC));
537     dux(:,:,:) = diff(XG(:,1:ne,:),1,1);
538     dvx(:,:,:) = diff(XG(1:ne,:,:),1,2);
539     duy(:,:,:) = diff(YG(:,1:ne,:),1,1);
540     dvy(:,:,:) = diff(YG(1:ne,:,:),1,2);
541     dux = dux + 360*double(dux < 180);
542     dux = dux - 360*double(dux > 180); % [ min(min(dux)) max(max(dux)) ]
543     duy = duy + 360*double(duy < 180);
544     duy = duy - 360*double(duy > 180); % [ min(min(duy)) max(max(duy)) ]
545     dvx = dvx + 360*double(dvx < 180);
546     dvx = dvx - 360*double(dvx > 180); % [ min(min(dvx)) max(max(dvx)) ]
547     dvy = dvy + 360*double(dvy < 180);
548     dvy = dvy - 360*double(dvy > 180); % [ min(min(dvy)) max(max(dvy)) ]
549     llux = dux ./ sqrt(dux.^2 + duy.^2);
550     lluy = duy ./ sqrt(dux.^2 + duy.^2);
551     llvx = dvx ./ sqrt(dvx.^2 + dvy.^2);
552     llvy = dvy ./ sqrt(dvx.^2 + dvy.^2);
553    
554     %==================================================================
555     % Project fields to lower-res 1-degree Lat-Lon and write
556     % as NetCDF for viewing with Ingrid
557     %
558     ne = 510;
559     nf = 6;
560     nz = 50;
561     nslab = ne*ne*nf;
562     adir = 'primes_92_04';
563     lat = [-90:90];
564     lon = [0:360];
565 edhill 1.2 ir = [ 1 2 3 5 10 15 20 25 30 35 40 ];
566 edhill 1.1 xc360 = XC + 180;
567    
568 edhill 1.2 % ! rm -f cube_22_primes_at1deg.nc
569     nc = netcdf(['cube_22_primes_at1deg.nc'], 'clobber');
570     nc.reference = [ 'The cube_22 primes from Dimitris Menemenlis' ...
571     ' regridded to 1-deg Lat-Lon' ];
572 edhill 1.1 nc.author = 'Ed Hill <eh3@mit.edu>';
573 edhill 1.2 nc.date = 'March 27, 2005';
574 edhill 1.1 nc('X') = length(lon);
575     nc('Y') = length(lat);
576     nc('Z') = length(ir);
577     nc{'X'} = 'X';
578     nc{'Y'} = 'Y';
579     nc{'Z'} = 'Z';
580     nc{'X'}.uniquename = 'X';
581     nc{'X'}.long_name = 'longitude';
582     nc{'X'}.gridtype = ncint(1);
583     nc{'X'}.units = 'degree_east';
584     nc{'Y'}.uniquename = 'Y';
585     nc{'Y'}.long_name = 'latitude';
586     nc{'Y'}.gridtype = ncint(0);
587     nc{'Y'}.units = 'degree_north';
588     nc{'Z'}.uniquename = 'Z';
589     nc{'Z'}.long_name = 'depth';
590     nc{'Z'}.gridtype = ncint(0);
591     nc{'Z'}.units = 'm';
592     nc{'X'}(:) = lon;
593     nc{'Y'}(:) = lat;
594     nc{'Z'}(:) = R(ir);
595    
596     f_s_3d = { {'tp2'}, {'sp2'}, {'bp2'}, {'vpbp_dbdz'} };
597    
598     ifg = 1;
599     for ifg = 1:length(f_s_3d)
600    
601     acell = f_s_3d{ifg};
602     tname = acell{1};
603     disp([ ' ' tname ' :' ]);
604    
605     fname = sprintf('%s/%s',adir,tname);
606     fid = fopen(fname,'r','ieee-be');
607    
608     id = tname;
609     nc{ id } = { 'Z' 'Y' 'X' };
610     nc{ id }.missing_value = ncdouble(NaN);
611     nc{ id }.FillValue_ = ncdouble(0.0);
612    
613     ii = 1;
614     for ii = 1:length(ir)
615    
616     iz = ir(ii);
617     disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz)));
618    
619     fseek(fid,nslab*4*(iz-1),'bof');
620     tmp = fread(fid,nslab,'real*4',0,'ieee-be');
621     tr = reshape(tmp,[ 510 510 6 ]);
622     % surf(tr(:,:,1)), view(2), shading interp
623     trn = tr;
624     trn(find(tr == 0.0)) = NaN;
625     clear tmp tr
626     % v = sdac_regrid(xc360,YC,trn,lonm,latm);
627     v = ll_regrid(xc360,YC,trn,lon,lat);
628     % surf(lon,lat,v'), caxis([25 40]), view(2), shading interp, colorbar
629    
630     nc{ id }(ii,:,:) = permute(v,[2 1]);
631    
632     end
633    
634     fclose(fid);
635    
636     end
637    
638     id = 'sum_up2_vp2';
639     nc{ id } = { 'Z' 'Y' 'X' };
640     nc{ id }.missing_value = ncdouble(NaN);
641     nc{ id }.FillValue_ = ncdouble(0.0);
642     fidu = fopen(sprintf('%s/%s',adir,'up2'),'r','ieee-be');
643     fidv = fopen(sprintf('%s/%s',adir,'vp2'),'r','ieee-be');
644     for ii = 1:length(ir)
645     iz = ir(ii);
646     disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz)));
647     fseek(fidu,nslab*4*(iz-1),'bof');
648     fseek(fidv,nslab*4*(iz-1),'bof');
649     tru = reshape(fread(fidu,nslab,'real*4',0,'ieee-be'),[510 510 6]);
650     trv = reshape(fread(fidv,nslab,'real*4',0,'ieee-be'),[510 510 6]);
651     trnu = tru; trnu(find(tru == 0.0)) = NaN;
652     trnv = trv; trnv(find(trv == 0.0)) = NaN;
653     clear tmp tru trv
654     lluv = ll_regrid(xc360,YC,trnu+trnv,lon,lat);
655     nc{ id }(ii,:,:) = permute(lluv,[2 1]);
656     end
657     fclose(fidu);
658     fclose(fidv);
659    
660     f_v_3d = { {'up2','vp2'}, ...
661     {'uptp','vptp'}, {'upsp','vpsp'}, {'upbp','vpbp'} };
662     for ip = 1:length(f_v_3d)
663     cell = f_v_3d{ip};
664     idu = cell{1};
665     idv = cell{2};
666     disp([' ' idu ' ' idv]);
667     nc{ idu } = { 'Z' 'Y' 'X' };
668     nc{ idu }.missing_value = ncdouble(NaN);
669     nc{ idu }.FillValue_ = ncdouble(0.0);
670     nc{ idv } = { 'Z' 'Y' 'X' };
671     nc{ idv }.missing_value = ncdouble(NaN);
672     nc{ idv }.FillValue_ = ncdouble(0.0);
673     fidu = fopen(sprintf('%s/%s',adir,idu),'r','ieee-be');
674     fidv = fopen(sprintf('%s/%s',adir,idv),'r','ieee-be');
675     for ii = 1:length(ir)
676     iz = ir(ii);
677     disp(sprintf(' iz = %3d R(iz) = %g',iz,R(iz)));
678     fseek(fidu,nslab*4*(iz-1),'bof');
679     fseek(fidv,nslab*4*(iz-1),'bof');
680     tru = reshape(fread(fidu,nslab,'real*4',0,'ieee-be'),[510 510 6]);
681     trv = reshape(fread(fidv,nslab,'real*4',0,'ieee-be'),[510 510 6]);
682     trnu = tru; trnu(find(tru == 0.0)) = NaN;
683     trnv = trv; trnv(find(trv == 0.0)) = NaN;
684     clear tmp tru trv
685     llru = trnu .* llux + trnv .* llvx;
686     llrv = trnu .* lluy + trnv .* llvy;
687     llu = ll_regrid(xc360,YC,llru,lon,lat);
688     llv = ll_regrid(xc360,YC,llrv,lon,lat);
689     nc{ idu }(ii,:,:) = permute(llu,[2 1]);
690     nc{ idv }(ii,:,:) = permute(llv,[2 1]);
691     end
692     end
693     fclose(fidu);
694     fclose(fidv);
695    
696    
697    
698     nc = close(nc);
699    
700 edhill 1.2 % ! scp cube_22_primes_at1deg.nc channel.mit.edu:/home/edhill/INGRID_PEOPLE/EH3/eddy_flux/cube_22/
701     % ! mv cube_22_primes_at1deg.nc primes_92_04
702 edhill 1.1
703    
704    
705    
706    
707    
708     %------- UNUSED -----------------------
709    
710    
711     %=======================================================
712     % Calculate : (v'B')/(dB/dz)
713    
714     bid = fopen( 'b-ave-1992-2003', 'r', 'ieee-be');
715     bm1id = fopen('bm1-ave-1992-2003', 'r', 'ieee-be');
716    
717     iz = 1;
718     offset = (iz - 1)*nps*4;
719     fseek(upbpid, offset, 'bof');
720     fseek(vpbpid, offset, 'bof');
721     upbp = reshape(fread(upbpid, nps, 'real*4'),ne,ne,6);
722     vpbp = reshape(fread(vpbpid, nps, 'real*4'),ne,ne,6);
723     llvpbp = upbp .* lluy + vpbp .* llvy;
724     llvpbpm1 = llvpbp;
725     ne = 510; tx = 85; ty = 85; nt = 216;
726    
727     iz = 2;
728     iz = 15;
729     iz = 16;
730     for iz = 2:50,
731     izm1 = iz - 1;
732     disp(sprintf('iz = %d',iz));
733     % iz = 21;
734     offset = (iz - 1)*nps*4;
735     fseek(upbpid, offset, 'bof');
736     fseek(vpbpid, offset, 'bof');
737     upbp = reshape(fread(upbpid, nps, 'real*4'),ne,ne,6);
738     vpbp = reshape(fread(vpbpid, nps, 'real*4'),ne,ne,6);
739    
740     % v'B' on ll coords
741     llvpbp = upbp .* lluy + vpbp .* llvy;
742    
743     % B and Bm1
744     fseek(bid, offset, 'bof');
745     b = reshape(fread(bid, nps, 'real*4'),ne,ne,6);
746     offm1 = (iz - 2)*nps*4;
747     fseek(bm1id, offm1, 'bof');
748     bm1 =reshape(fread(bm1id, nps, 'real*4'),ne,ne,6);
749    
750     % ( v'B' )/( dB/dz )
751     dbdz = (b - bm1)/(R(iz) - R(izm1));
752     ind0 = find(dbdz==0.0);
753     dbdz(ind0) = 1.0;
754     rdbdz = 1.0 / (dbdz);
755     rdbdz(ind0) = 0.0;
756     vpbpdbdz = 0.5*(llvpbp + llvpbpm1) .* rdbdz;
757    
758     % Write the results
759     mid = fopen('vpbpdbdz-1992-2003', 'a', 'ieee-be');
760     fwrite(mid, vpbpdbdz, 'real*4');
761     fclose(mid);
762    
763     % Plot results
764     clow = [ -10 ]; % -20;
765     chigh = [ 10 ]; % 20;
766     ll = zeros(6*510,510);
767     for i = 1:6
768     xb = (i-1)*510 + 1; xe = xb + 510 - 1;
769     yb = 1; ye = 510;
770     ll(xb:xe,yb:ye) = vpbpdbdz(:,:,i);
771     end
772     shift=-1;
773     grph_CS(sq(ll),xcs,ycs,xgs,ygs,[clow],[chigh],shift);
774     title([ '(v''B'')/(dB/dz) at ' ...
775     sprintf('%g',Rmid(iz)) ...
776     'm depth on the 510x510x6 cubesphere for 1992--2003 ["cube5"]']);
777     % print('-painters', '-dpng', '-r650', ...
778     % ['vpTpdTdz_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_650.png'])
779     print('-painters', '-dpng', '-r150', ...
780     ['vpBpdBdz_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_150.png'])
781    
782    
783     % Stress: calc, write, and plot
784     stress = 1000 * (2*pi/(24*3600)*sin(pi*yc/180));
785     stress = stress .* vpbpdbdz;
786     sid = fopen('stress-b-1992-2003', 'a', 'ieee-be');
787     fwrite(sid, stress, 'real*4');
788     fclose(sid);
789     clow = []; % [ -1 ];
790     chigh = []; % [ 1 ];
791     ll = zeros(6*510,510);
792     for i = 1:6
793     xb = (i-1)*510 + 1; xe = xb + 510 - 1;
794     yb = 1; ye = 510;
795     ll(xb:xe,yb:ye) = stress(:,:,i);
796     end
797     shift=-1;
798     grph_CS(sq(ll),xcs,ycs,xgs,ygs,[clow],[chigh],shift);
799     title([ 'Stress at ' ...
800     sprintf('%g',Rmid(iz)) ...
801     'm depth on the 510x510x6 cubesphere for 1994--2003 ["cube5"]']);
802     % print('-painters', '-dpng', '-r650', ...
803     % ['stress_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_650.png'])
804     print('-painters', '-dpng', '-r150', ...
805     ['stress_' sprintf('%02d_%07.1f',iz,Rmid(iz)) 'm_150.png'])
806    
807    
808     % Next level
809     llvpbpm1 = llvpbp;
810    
811     end
812    
813    
814     %=======================================================
815     % Zonally average vpbpdbdz and stress
816    
817     clear all ; close all
818     tx = 85;
819     ty = 85;
820     nt = 216;
821     cx = 510;
822     cy = 510;
823     nz = 1;
824     ne = 510;
825     nps = ne * ne * 6;
826    
827     % XCS YCS XGS YGS
828     fnam = [ 'XC' ; 'YC'; 'XG'; 'YG' ];
829     for in = 1:4
830     uid = fopen([fnam(in,:) '.data'], 'r', 'ieee-be');
831     phi = unmangleJPL1( reshape(fread(uid, nps, 'real*4'), ...
832     tx*nt,ty), ne, tx );
833     fclose(uid);
834     eval([lower(fnam(in,:)) ' = phi;']);
835     a = zeros(6*510,510);
836     for i = 1:6
837     xb = (i-1)*510 + 1; xe = xb + 510 - 1;
838     yb = 1; ye = 510;
839     a(xb:xe,yb:ye) = phi(:,:,i);
840     end
841     eval([lower(fnam(in,:)) 's = a;'])
842     end
843     xcs = xcs + -360.0*(xcs > 180.0);
844     xgs = xgs + -360.0*(xgs > 180.0);
845     clear phi a
846    
847     nz = 1;
848     nr = 50;
849     nrm1 = nr - 1;
850     nlat = 181; nlatm1 = nlat - 1;
851    
852     hvals = linspace(-90,90,nlat);
853     % save indicies for zonal averages
854     i = 2;
855     for i = 2:nlat
856     inds = find(hvals(i-1)<yg & yg<hvals(i));
857     comm = sprintf('inds%04d = uint32(inds);',i-1);
858     eval(comm);
859     end
860    
861     % Zonally average vpbp
862     acc = zeros(nlatm1, nrm1);
863     num = zeros(size(acc));
864     ne = 510;
865     nps = ne * ne * 6;
866     zid = fopen('vpbpll-1992-2003', 'r', 'ieee-be');
867     iz = 1;
868     for iz = 1:50,
869     disp(sprintf('iz = %d',iz));
870     offset = (iz - 1)*nps*4;
871     fseek(zid, offset, 'bof');
872     vpbp = reshape(fread(zid, nps, 'real*4'),ne,ne,6);
873    
874     for jj = 1:nlatm1
875     eval( sprintf('clear inds; inds = inds%04d;',jj) );
876     tmp = vpbp(inds);
877     nzinds = find(tmp ~= 0.0);
878     num(jj,iz) = length(nzinds);
879     acc(jj,iz) = sum(tmp(nzinds));
880     end
881     end
882     fclose(zid);
883     zvpbp = acc ./ num;
884     % save zvpbp zvpbp
885    
886     % zonally average vpbpdbdz
887     acc = zeros(nlatm1, nrm1);
888     num = zeros(size(acc));
889     ne = 510;
890     nps = ne * ne * 6;
891     zid = fopen('vpbpdbdz-1992-2003', 'r', 'ieee-be');
892     iz = 1;
893     for iz = 1:49,
894     disp(sprintf('iz = %d',iz));
895     offset = (iz - 1)*nps*4;
896     fseek(zid, offset, 'bof');
897     vpbpdbdz = reshape(fread(zid, nps, 'real*4'),ne,ne,6);
898    
899     for jj = 1:nlatm1
900     eval( sprintf('clear inds; inds = inds%04d;',jj) );
901     tmp = vpbpdbdz(inds);
902     nzinds = find(tmp ~= 0.0);
903     num(jj,iz) = length(nzinds);
904     acc(jj,iz) = sum(tmp(nzinds));
905     end
906     end
907     fclose(zid);
908     zvpbpdbdz = acc ./ num;
909     % save zvpbpdbdz zvpbpdbdz
910    
911     % zonally average stress
912     acc = zeros(nlatm1, nrm1);
913     num = zeros(size(acc));
914     ne = 510;
915     nps = ne * ne * 6;
916     zid = fopen('stress-b-1992-2003', 'r', 'ieee-be');
917     iz = 1;
918     for iz = 1:49,
919     disp(sprintf('iz = %d',iz));
920     offset = (iz - 1)*nps*4;
921     fseek(zid, offset, 'bof');
922     stress = reshape(fread(zid, nps, 'real*4'),ne,ne,6);
923     jj = 22;
924     for jj = 1:nlatm1
925     eval( sprintf('clear inds; inds = inds%04d;',jj) );
926     tmp = stress(inds);
927     nzinds = find(tmp ~= 0.0);
928     num(jj,iz) = length(nzinds);
929     acc(jj,iz) = sum(tmp(nzinds));
930     end
931     end
932     fclose(zid);
933     stress = acc ./ num;
934     % save stress stress
935    
936     %------- UNUSED -----------------------
937     % zonally average u
938     acc = zeros(nlatm1, 50);
939     num = zeros(size(acc));
940     ne = 510;
941     nps = ne * ne * 6;
942     zid = fopen('Ull_ave_1994--2003', 'r', 'ieee-be');
943     iz = 1;
944     for iz = 1:50,
945     disp(sprintf('iz = %d',iz));
946     offset = (iz - 1)*nps*4;
947     fseek(zid, offset, 'bof');
948     U = reshape(fread(zid, nps, 'real*4'),ne,ne,6);
949     jj = 22;
950     for jj = 1:nlatm1
951     eval( sprintf('clear inds; inds = inds%04d;',jj) );
952     tmp = U(inds);
953     nzinds = find(tmp ~= 0.0);
954     num(jj,iz) = length(nzinds);
955     acc(jj,iz) = sum(tmp(nzinds));
956     end
957     end
958     fclose(zid);
959     zonalu = acc ./ num;
960     % save zonalu zonalu
961     %------- UNUSED -----------------------
962    
963     % zonally average B
964     acc = zeros(nlatm1, 50);
965     num = zeros(size(acc));
966     ne = 510;
967     nps = ne * ne * 6;
968     zid = fopen('b-ave-1992-2003', 'r', 'ieee-be');
969     iz = 1;
970     for iz = 1:50,
971     disp(sprintf('iz = %d',iz));
972     offset = (iz - 1)*nps*4;
973     fseek(zid, offset, 'bof');
974     B = reshape(fread(zid, nps, 'real*4'),ne,ne,6);
975     jj = 22;
976     for jj = 1:nlatm1
977     eval( sprintf('clear inds; inds = inds%04d;',jj) );
978     tmp = B(inds);
979     nzinds = find(tmp ~= 0.0);
980     num(jj,iz) = length(nzinds);
981     acc(jj,iz) = sum(tmp(nzinds));
982     end
983     end
984     fclose(zid);
985     zonalB = acc ./ num;
986     % save zonalB zonalB
987    
988     %------- UNUSED -----------------------
989     % Vertical gradient of zonally averaged B (dB/dz)
990     load zonalT
991     load allR
992     nz = size(zonalT,1);
993     dzaTdz = zeros(nz,size(zonalT,2)-1);
994     for iz = 2:50
995     dzaTdz(:,iz-1) = (zonalT(:,iz) - zonalT(:,iz-1)) ./ (R(iz) - R(iz-1));
996     end
997     % save dzaTdz dzaTdz
998     %------- UNUSED -----------------------
999    
1000    
1001     delR = [
1002     10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01, ...
1003     10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85, ...
1004     31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18, ...
1005     93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83, ...
1006     139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50, ...
1007     341.50,364.50,387.50,410.50,433.50,456.50 ];
1008     R = cumsum(delR) - 0.5*delR;
1009     Rmid = R(1:(length(R)-1)) + 0.5*diff(R);
1010     hmid = [ -89.5:1:89.5 ];
1011     % save allR delR R Rmid hmid
1012    
1013     %------- UNUSED -----------------------
1014     surf(hmid,-Rmid,num'), view(2), shading interp, colorbar
1015     caxis([ -1 1 ])
1016     caxis('manual')
1017     surf(hmid,-Rmid,mu'), view(2), shading interp, colorbar
1018     title('Zonally Averaged Stress for 1994--2003 [cube5]')
1019     xlabel('Latitude [deg]')
1020     zlabel('Depth [m]')
1021     axis([ -90 90 -5500 200 ])
1022    
1023     % print -dps -painters t_001.ps
1024     print('-painters', '-dpng', '-r150', 'za_str_94--03_r150.png')
1025     print('-painters', '-dpng', '-r650', 'za_str_94--03_r650.png')
1026    
1027     % plot and print bar(U)
1028     load zonalu
1029     surf(hmid,-R,zonalu'), view(2), shading interp, colorbar
1030     contour(hmid,-R,mu'), colorbar
1031     ac = 25;
1032     ac = [-0.3:.005:.3];
1033     [c,h] = contourf(hmid,-R,mu',ac); colorbar
1034     hold on, contour(hmid,-R,mu',ac), hold off
1035     title('Zonally Averaged U for 1994--2003 [cube5]')
1036     xlabel('Latitude [deg]')
1037     zlabel('Depth [m]')
1038     axis([ -90 90 -6000 200 ])
1039     print('-painters', '-dpng', '-r150', 'Ull_94--03_r150.png')
1040     print('-painters', '-dpng', '-r650', 'Ull_94--03_r650.png')
1041     %------- UNUSED -----------------------
1042    
1043    

  ViewVC Help
Powered by ViewVC 1.1.22