/[MITgcm]/MITgcm/verification/fizhi-cs-aqualev20/scripts/APEprocess2.m
ViewVC logotype

Contents of /MITgcm/verification/fizhi-cs-aqualev20/scripts/APEprocess2.m

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


Revision 1.1 - (show annotations) (download)
Mon Apr 3 20:55:28 2006 UTC (18 years ago) by molod
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint58l_post, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint58e_post, checkpoint58u_post, checkpoint58w_post, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint60, checkpoint61, checkpoint62, checkpoint63, checkpoint58r_post, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint58n_post, checkpoint58x_post, checkpoint58t_post, checkpoint58h_post, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint58q_post, checkpoint59q, checkpoint59p, checkpoint59r, checkpoint58j_post, checkpoint59e, checkpoint59d, checkpoint59g, checkpoint59f, checkpoint59a, checkpoint59c, checkpoint59b, checkpoint59m, checkpoint59l, checkpoint59o, checkpoint59n, checkpoint59i, checkpoint59h, checkpoint59k, checkpoint59j, checkpoint59, checkpoint58f_post, checkpoint58d_post, checkpoint58i_post, checkpoint58g_post, checkpoint58o_post, checkpoint62c, checkpoint62b, checkpoint62a, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint58y_post, checkpoint58k_post, checkpoint58v_post, checkpoint58s_post, checkpoint61f, checkpoint61g, checkpoint61d, checkpoint61e, checkpoint61b, checkpoint61c, checkpoint58p_post, checkpoint61a, checkpoint61n, checkpoint61o, checkpoint61l, checkpoint61m, checkpoint61j, checkpoint61k, checkpoint61h, checkpoint61i, checkpoint61v, checkpoint61w, checkpoint61t, checkpoint61u, checkpoint61r, checkpoint61s, checkpoint61p, checkpoint61q, checkpoint61z, checkpoint61x, checkpoint61y, checkpoint58m_post, HEAD
New check-in for fizhi aquaplanet experiment to match the APE control (will replace fizhi-cs-aqualev10)

1 function [APEprocess2] = APEprocess2(dirsuffix)
2 % Complete processing of APE second moment decomposition
3 load mncdirlist
4 nsegments = size(mncdirlist,1);
5 eval(['cd ' 'mnc_out_',num2str(mncdirlist(1))])
6 griddata = rdmnc('grid.*');
7 XC = griddata.XC;
8 YC = griddata.YC;
9 XG = griddata.XG; XG = XG(1:end-1,1:end-1);
10 YG = griddata.YG; YG = YG(1:end-1,1:end-1);
11 dxC = griddata.dxC;
12 dyC = griddata.dyC;
13 dxG = griddata.dxG;
14 dyG = griddata.dyG;
15 RAC = griddata.rA;
16 HFacC = griddata.HFacC;
17 HFacW = griddata.HFacW;
18 HFacS = griddata.HFacS;
19 ZC = griddata.RC;
20 ZF = griddata.RF;
21 drC = griddata.drC;
22 drF = griddata.drF;
23 undef=1.e15;
24 eval(['cd ../'])
25 %
26 nx = size(HFacC,1);
27 ny = size(HFacC,2);
28 %nr = size(HFacC,3);
29 nr = 17;
30 nPg = nx*ny;
31 nlats = 64;
32 %
33 % load COS & SIN of rotation angle:
34 fid=fopen('/u/molod/proj_cs32_2uEvN.bin','r','b'); uvEN=fread(fid,nx*ny*2,'real*8'); fclose(fid);
35 uvEN=reshape(uvEN,[nPg 2]);
36 AngleCS=uvEN(:,1);
37 AngleSN=uvEN(:,2);
38 %
39 tempz=zeros(nlats,nr);
40 uzav=zeros(nlats,nr);
41 vzav=zeros(nlats,nr);
42 wzav=zeros(nlats,nr);
43 thetazav=zeros(nlats,nr);
44 saltzav=zeros(nlats,nr);
45 phizav=zeros(nlats,nr);
46 %
47 temp=zeros(nx,ny,nr);
48 uave=zeros(nx,ny,nr);
49 vave=zeros(nx,ny,nr);
50 wave=zeros(nx,ny,nr);
51 thetaave=zeros(nx,ny,nr);
52 saltave=zeros(nx,ny,nr);
53 phiave=zeros(nx,ny,nr);
54 hfactot=zeros(nx,ny,nr);
55 %
56 usqz=zeros(nlats,nr);
57 vsqz=zeros(nlats,nr);
58 thetasqz=zeros(nlats,nr);
59 phisqz=zeros(nlats,nr);
60 omegasqz=zeros(nlats,nr);
61 qsqz=zeros(nlats,nr);
62 uvz=zeros(nlats,nr);
63 uomegaz=zeros(nlats,nr);
64 vomegaz=zeros(nlats,nr);
65 vthetaz=zeros(nlats,nr);
66 omegathetaz=zeros(nlats,nr);
67 vqz=zeros(nlats,nr);
68 omegaqz=zeros(nlats,nr);
69 vphiz=zeros(nlats,nr);
70 %
71 UVtotz=zeros(nlats,nr);
72 U2totz=zeros(nlats,nr);
73 V2totz=zeros(nlats,nr);
74 wvelsqz=zeros(nlats,nr);
75 potempsqz=zeros(nlats,nr);
76 phihydsqz=zeros(nlats,nr);
77 saltsqz=zeros(nlats,nr);
78 wuEz=zeros(nlats,nr);
79 wvNz=zeros(nlats,nr);
80 vNthz=zeros(nlats,nr);
81 wvelthz=zeros(nlats,nr);
82 vNsltz=zeros(nlats,nr);
83 wvelsltz=zeros(nlats,nr);
84 vNphiz=zeros(nlats,nr);
85 hfacztot1=zeros(nlats,nr);
86 hfacztot2=zeros(nlats,nr);
87 %
88 % To do while leafing through all the 10-day segments:
89 for it = 1:nsegments
90 eval(['cd ' 'mnc_out_',num2str(mncdirlist(it))])
91 pwd
92 %
93 % 1) Stationary Mean: Products of zonal mean, time mean first moments
94 % Read in the time mean of zonal mean first moments:
95 % Compute running 3-year mean of zonal mean first moments:
96 %
97 fid=fopen('hfacztot1.interim','r','b');hfacz1=fread(fid,[nlats nr],'real*8');fclose(fid);hfacztot1 = hfacztot1 + hfacz1;
98 fid=fopen('thetazon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);thetazav=thetazav+tempz.*hfacz1;
99 fid=fopen('uzon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);uzav=uzav+tempz.*hfacz1;
100 fid=fopen('vzon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vzav=vzav+tempz.*hfacz1;
101 fid=fopen('wzon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wzav=wzav+tempz.*hfacz1;
102 fid=fopen('saltzon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);saltzav=saltzav+tempz.*hfacz1;
103 fid=fopen('phizon.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);phizav=phizav+tempz.*hfacz1;
104 %
105 % 2) Stationary Eddies: Total Stationary minus Stationary Mean
106 % Need zonal mean of products of 3-year mean first moments
107 % Read in time averages of first moments
108 % Compute running 3-year mean of first moments:
109 %
110 fid=fopen('hfactot1.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);hfac=reshape(temp,[nx ny nr]);hfactot = hfactot + hfac;
111 fid=fopen('thetaave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);thetaave=thetaave+temp.*hfac;
112 fid=fopen('uave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);uave=uave+temp.*hfac;
113 fid=fopen('vave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);vave=vave+temp.*hfac;
114 fid=fopen('wave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);wave=wave+temp.*hfac;
115 fid=fopen('saltave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);saltave=saltave+temp.*hfac;
116 fid=fopen('phiave.interim','r','b');temp=fread(fid,[nx*ny nr],'real*8');fclose(fid);temp=reshape(temp,[nx ny nr]);phiave=phiave+temp.*hfac;
117 %
118 % 3) Transient Mean: Total Mean minus Stationary Mean
119 % Need time mean of products of zonal mean first moments
120 % Read in (time averaged) products of zonal means
121 % Compute running 3-year mean of products of zonal means
122 %
123 fid=fopen('thetasqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);thetasqz=thetasqz+tempz.*hfacz1;
124 fid=fopen('usqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);usqz=usqz+tempz.*hfacz1;
125 fid=fopen('vsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vsqz=vsqz+tempz.*hfacz1;
126 fid=fopen('phisqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);phisqz=phisqz+tempz.*hfacz1;
127 fid=fopen('omegasqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);omegasqz=omegasqz+tempz.*hfacz1;
128 fid=fopen('qsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);qsqz=qsqz+tempz.*hfacz1;
129 fid=fopen('uvz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);uvz=uvz+tempz.*hfacz1;
130 fid=fopen('uomegaz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);uomegaz=uomegaz+tempz.*hfacz1;
131 fid=fopen('vomegaz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vomegaz=vomegaz+tempz.*hfacz1;
132 fid=fopen('vthetaz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vthetaz=vthetaz+tempz.*hfacz1;
133 fid=fopen('omegathetaz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);omegathetaz=omegathetaz+tempz.*hfacz1;
134 fid=fopen('vqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vqz=vqz+tempz.*hfacz1;
135 fid=fopen('omegaqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);omegaqz=omegaqz+tempz.*hfacz1;
136 fid=fopen('vphiz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vphiz=vphiz+tempz.*hfacz1;
137 %
138 % 4) Transient Eddy: Total Second Moment minus Total Mean minus Stationary Eddy
139 % Need time mean of zonal mean second moments
140 % Read in (time averaged) zonal mean second moments
141 % Compute running 3-year mean of zonal mean second moments
142 %
143 % Read in time averages of zonal mean second moments
144 fid=fopen('hfacztot2.interim','r','b');hfacz2=fread(fid,[nlats nr],'real*8');fclose(fid);hfacztot2 = hfacztot2 + hfacz2;
145 fid=fopen('potempsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);potempsqz=potempsqz+tempz.*hfacz2;
146 fid=fopen('uvtotz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);UVtotz=UVtotz+tempz.*hfacz2;
147 fid=fopen('u2totz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);U2totz=U2totz+tempz.*hfacz2;
148 fid=fopen('v2totz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);V2totz=V2totz+tempz.*hfacz2;
149 fid=fopen('wvelsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wvelsqz=wvelsqz+tempz.*hfacz2;
150 fid=fopen('phihydsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);phihydsqz=phihydsqz+tempz.*hfacz2;
151 fid=fopen('saltsqz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);saltsqz=saltsqz+tempz.*hfacz2;
152 fid=fopen('wuEz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wuEz=wuEz+tempz.*hfacz2;
153 fid=fopen('wvNz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wvNz=wvNz+tempz.*hfacz2;
154 fid=fopen('vNthz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vNthz=vNthz+tempz.*hfacz2;
155 fid=fopen('wvelthz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wvelthz=wvelthz+tempz.*hfacz2;
156 fid=fopen('vNsltz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vNsltz=vNsltz+tempz.*hfacz2;
157 fid=fopen('wvelsltz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);wvelsltz=wvelsltz+tempz.*hfacz2;
158 fid=fopen('vNphiz.interim','r','b');tempz=fread(fid,[nlats nr],'real*8');fclose(fid);vNphiz=vNphiz+tempz.*hfacz2;
159 eval(['cd ../'])
160 % End segment loop
161 end
162 % Divide by the appropriate counter to compute 3-year time average
163 inds1=find(hfactot~=0);
164 thetaave(inds1)=thetaave(inds1) ./ hfactot(inds1);
165 uave(inds1)=uave(inds1) ./ hfactot(inds1);
166 vave(inds1)=vave(inds1) ./ hfactot(inds1);
167 wave(inds1)=wave(inds1) ./ hfactot(inds1);
168 saltave(inds1)=saltave(inds1) ./ hfactot(inds1);
169 phiave(inds1)=phiave(inds1) ./ hfactot(inds1);
170 %
171 inds2=find(hfacztot1~=0);
172 thetazav(inds2)=thetazav(inds2) ./ hfacztot1(inds2);
173 uzav(inds2)=uzav(inds2) ./ hfacztot1(inds2);
174 vzav(inds2)=vzav(inds2) ./ hfacztot1(inds2);
175 wzav(inds2)=wzav(inds2) ./ hfacztot1(inds2);
176 saltzav(inds2)=saltzav(inds2) ./ hfacztot1(inds2);
177 phizav(inds2)=phizav(inds2) ./ hfacztot1(inds2);
178 usqz(inds2)=usqz(inds2) ./ hfacztot2(inds2);
179 vsqz(inds2)=vsqz(inds2) ./ hfacztot2(inds2);
180 thetasqz(inds2)=thetasqz(inds2) ./ hfacztot2(inds2);
181 phisqz(inds2)=phisqz(inds2) ./ hfacztot2(inds2);
182 omegasqz(inds2)=omegasqz(inds2) ./ hfacztot2(inds2);
183 qsqz(inds2)=qsqz(inds2) ./ hfacztot2(inds2);
184 uvz(inds2)=uvz(inds2) ./ hfacztot2(inds2);
185 uomegaz(inds2)=uomegaz(inds2) ./ hfacztot2(inds2);
186 vomegaz(inds2)=vomegaz(inds2) ./ hfacztot2(inds2);
187 vthetaz(inds2)=vthetaz(inds2) ./ hfacztot2(inds2);
188 omegathetaz(inds2)=omegathetaz(inds2) ./ hfacztot2(inds2);
189 vqz(inds2)=vqz(inds2) ./ hfacztot2(inds2);
190 omegaqz(inds2)=omegaqz(inds2) ./ hfacztot2(inds2);
191 vphiz(inds2)=vphiz(inds2) ./ hfacztot2(inds2);
192 %
193 inds3=find(hfacztot2~=0);
194 UVtotz(inds3)=UVtotz(inds3) ./ hfacztot2(inds3);
195 U2totz(inds3)=U2totz(inds3) ./ hfacztot2(inds3);
196 V2totz(inds3)=V2totz(inds3) ./ hfacztot2(inds3);
197 wvelsqz(inds3)=wvelsqz(inds3) ./ hfacztot2(inds3);
198 potempsqz(inds3)=potempsqz(inds3) ./ hfacztot2(inds3);
199 phihydsqz(inds3)=phihydsqz(inds3) ./ hfacztot2(inds3);
200 saltsqz(inds3)=saltsqz(inds3) ./ hfacztot2(inds3);
201 wuEz(inds3)=wuEz(inds3) ./ hfacztot2(inds3);
202 wvNz(inds3)=wvNz(inds3) ./ hfacztot2(inds3);
203 vNthz(inds3)=vNthz(inds3) ./ hfacztot2(inds3);
204 wvelthz(inds3)=wvelthz(inds3) ./ hfacztot2(inds3);
205 vNsltz(inds3)=vNsltz(inds3) ./ hfacztot2(inds3);
206 wvelsltz(inds3)=wvelsltz(inds3) ./ hfacztot2(inds3);
207 vNphiz(inds3)=vNphiz(inds3) ./ hfacztot2(inds3);
208 %
209 % To do after leafing through all the 10-day segments:
210 % Stationary Mean:
211 % 1a) Compute products of time mean zonal mean first moments
212 smusq = uzav.*uzav;
213 smvsq = vzav.*vzav;
214 smtsq = thetazav.*thetazav;
215 smwsq = wzav.*wzav;
216 smphisq = phizav.*phizav;
217 smqsq = saltzav.*saltzav;
218 smuv = uzav.*vzav;
219 smuw = uzav.*wzav;
220 smvw = vzav.*wzav;
221 smvt = vzav.*thetazav;
222 smwt = wzav.*thetazav;
223 smvq = vzav.*saltzav;
224 smwq = wzav.*saltzav;
225 smvphi = vzav.*phizav;
226 %
227 % Transient Mean: Time mean of products of zonal mean first moments minus Stationary Mean
228 tmusq = usqz - smusq;
229 tmvsq = vsqz - smvsq;
230 tmtsq = thetasqz - smtsq;
231 tmwsq = omegasqz - smwsq;
232 tmphisq = phisqz - smphisq;
233 tmqsq = qsqz - smqsq;
234 tmuv = uvz - smuv;
235 tmuw = uomegaz - smuw;
236 tmvw = vomegaz - smvw;
237 tmvt = vthetaz - smvt;
238 tmwt = omegathetaz - smwt;
239 tmvq = vqz - smvq;
240 tmwq = omegaqz - smwq;
241 tmvphi = vphiz - smvphi;
242 %
243 % Stationary Eddy:
244 % 2a) Compute products of time mean first moments
245 % 2b) Compute zonal mean of products of time mean first moments
246 % 2c) Compute SE as zonal mean of products of time mean first moments minus stationary mean
247 hfac4calcz = hfactot ./ nsegments;
248 [uEave,vNave] = rotate_uv2uvEN(uave,vave,AngleCS,AngleSN);
249 temp=uEave.*uEave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);seusq=tempZ(:,:,1)-smusq;
250 temp=vNave.*vNave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sevsq=tempZ(:,:,1)-smvsq;
251 temp=thetaave.*thetaave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);setsq=tempZ(:,:,1)-smtsq;
252 temp=wave.*wave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sewsq=tempZ(:,:,1)-smwsq;
253 temp=phiave.*phiave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sephisq=tempZ(:,:,1)-smphisq;
254 temp=saltave.*saltave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);seqsq=tempZ(:,:,1)-smqsq;
255 temp=uEave.*vNave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);seuv=tempZ(:,:,1)-smuv;
256 temp=uEave.*wave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);seuw=tempZ(:,:,1)-smuw;
257 temp=vNave.*wave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sevw=tempZ(:,:,1)-smvw;
258 temp=vNave.*thetaave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sevt=tempZ(:,:,1)-smvt;
259 temp=wave.*thetaave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sewt=tempZ(:,:,1)-smwt;
260 temp=vNave.*saltave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sevq=tempZ(:,:,1)-smvq;
261 temp=wave.*saltave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sewq=tempZ(:,:,1)-smwq;
262 temp=vNave.*phiave;[tempZ,dum1,dum2]=calc_ZonAv_CS(temp,1,1,0,XC,YC,XG,YG,RAC,'./',hfac4calcz);sevphi=tempZ(:,:,1)-smvphi;
263 %
264 % Transient Eddy: Time mean of zonal mean second moments minus Transient Mean minus Stationary Eddy
265 teusq = U2totz - usqz - seusq;
266 tevsq = V2totz - vsqz - sevsq;
267 tetsq = potempsqz - thetasqz - setsq;
268 tewsq = wvelsqz - omegasqz - sewsq;
269 tephisq = phihydsqz - phisqz - sephisq;
270 teqsq = saltsqz - qsqz - seqsq;
271 teuv = UVtotz - uvz - seuv;
272 teuw = wuEz - uomegaz - seuw;
273 tevw = wvNz - vomegaz - sevw;
274 tevt = vNthz - vthetaz - sevt;
275 tewt = wvelthz - omegathetaz - sewt;
276 tevq = vNsltz - vqz - sevq;
277 tewq = wvelsltz - omegaqz - sewq;
278 tevphi = vNphiz - vphiz - sevphi;
279 %
280 % Write out all the terms
281 eval(['cd mnc_out_processed'])
282 %
283 % Total:
284 fid = fopen('uvtotz.bin','w','b'); UVtotz(find(isnan(UVtotz)))=undef; fwrite(fid,UVtotz,'real*8'); fclose(fid);
285 fid = fopen('u2totz.bin','w','b'); U2totz(find(isnan(U2totz)))=undef; fwrite(fid,U2totz,'real*8'); fclose(fid);
286 fid = fopen('v2totz.bin','w','b'); V2totz(find(isnan(V2totz)))=undef; fwrite(fid,V2totz,'real*8'); fclose(fid);
287 fid = fopen('wvelsqz.bin','w','b'); wvelsqz(find(isnan(wvelsqz)))=undef; fwrite(fid,wvelsqz,'real*8'); fclose(fid);
288 fid = fopen('potempsqz.bin','w','b'); potempsqz(find(isnan(potempsqz)))=undef; fwrite(fid,potempsqz,'real*8'); fclose(fid);
289 fid = fopen('phihydsqz.bin','w','b'); phihydsqz(find(isnan(phihydsqz)))=undef; fwrite(fid,phihydsqz,'real*8'); fclose(fid);
290 fid = fopen('saltsqz.bin','w','b'); saltsqz(find(isnan(saltsqz)))=undef; fwrite(fid,saltsqz,'real*8'); fclose(fid);
291 fid = fopen('wuEz.bin','w','b'); wuEz(find(isnan(wuEz)))=undef; fwrite(fid,wuEz,'real*8'); fclose(fid);
292 fid = fopen('wvNz.bin','w','b'); wvNz(find(isnan(wvNz)))=undef; fwrite(fid,wvNz,'real*8'); fclose(fid);
293 fid = fopen('vNthz.bin','w','b'); vNthz(find(isnan(vNthz)))=undef; fwrite(fid,vNthz,'real*8'); fclose(fid);
294 fid = fopen('wvelthz.bin','w','b'); wvelthz(find(isnan(wvelthz)))=undef; fwrite(fid,wvelthz,'real*8'); fclose(fid);
295 fid = fopen('vNsltz.bin','w','b'); vNsltz(find(isnan(vNsltz)))=undef; fwrite(fid,vNsltz,'real*8'); fclose(fid);
296 fid = fopen('wvelsltz.bin','w','b'); wvelsltz(find(isnan(wvelsltz)))=undef; fwrite(fid,wvelsltz,'real*8'); fclose(fid);
297 fid = fopen('vNphiz.bin','w','b'); vNphiz(find(isnan(vNphiz)))=undef; fwrite(fid,vNphiz,'real*8'); fclose(fid);
298 %
299 % Some additional filtering to set some inconsistent values to undefined
300 %
301 indusq = find(smusq>U2totz); smusq(indusq)=undef;seusq(indusq)=undef;tmusq(indusq)=undef;teusq(indusq)=undef;
302 indvsq = find(smvsq>V2totz); smvsq(indvsq)=undef;sevsq(indvsq)=undef;tmvsq(indvsq)=undef;tevsq(indvsq)=undef;
303 indwsq = find(smwsq>wvelsqz); smwsq(indwsq)=undef;sewsq(indwsq)=undef;tmwsq(indwsq)=undef;tewsq(indwsq)=undef;
304 indtsq = find(smtsq>potempsqz); smtsq(indtsq)=undef;setsq(indtsq)=undef;tmtsq(indtsq)=undef;tetsq(indtsq)=undef;
305 indpsq = find(smphisq>phihydsqz); smphisq(indpsq)=undef;sephisq(indpsq)=undef;tmphisq(indpsq)=undef;tephisq(indpsq)=undef;
306 indqsq = find(smqsq>saltsqz); smqsq(indqsq)=undef;seqsq(indqsq)=undef;tmqsq(indqsq)=undef;teqsq(indqsq)=undef;
307 %
308 % Stationary Mean:
309 fid = fopen('smusq.bin','w','b'); smusq(find(isnan(smusq)))=undef; fwrite(fid,smusq,'real*8'); fclose(fid);
310 fid = fopen('smvsq.bin','w','b'); smvsq(find(isnan(smvsq)))=undef; fwrite(fid,smvsq,'real*8'); fclose(fid);
311 fid = fopen('smtsq.bin','w','b'); smtsq(find(isnan(smtsq)))=undef; fwrite(fid,smtsq,'real*8'); fclose(fid);
312 fid = fopen('smwsq.bin','w','b'); smwsq(find(isnan(smwsq)))=undef; fwrite(fid,smwsq,'real*8'); fclose(fid);
313 fid = fopen('smphisq.bin','w','b'); smphisq(find(isnan(smphisq)))=undef; fwrite(fid,smphisq,'real*8'); fclose(fid);
314 fid = fopen('smqsq.bin','w','b'); smqsq(find(isnan(smqsq)))=undef; fwrite(fid,smqsq,'real*8'); fclose(fid);
315 fid = fopen('smuv.bin','w','b'); smuv(find(isnan(smuv)))=undef; fwrite(fid,smuv,'real*8'); fclose(fid);
316 fid = fopen('smuw.bin','w','b'); smuw(find(isnan(smuw)))=undef; fwrite(fid,smuw,'real*8'); fclose(fid);
317 fid = fopen('smvw.bin','w','b'); smvw(find(isnan(smvw)))=undef; fwrite(fid,smvw,'real*8'); fclose(fid);
318 fid = fopen('smvt.bin','w','b'); smvt(find(isnan(smvt)))=undef; fwrite(fid,smvt,'real*8'); fclose(fid);
319 fid = fopen('smwt.bin','w','b'); smwt(find(isnan(smwt)))=undef; fwrite(fid,smwt,'real*8'); fclose(fid);
320 fid = fopen('smvq.bin','w','b'); smvq(find(isnan(smvq)))=undef; fwrite(fid,smvq,'real*8'); fclose(fid);
321 fid = fopen('smwq.bin','w','b'); smwq(find(isnan(smwq)))=undef; fwrite(fid,smwq,'real*8'); fclose(fid);
322 fid = fopen('smvphi.bin','w','b'); smvphi(find(isnan(smvphi)))=undef; fwrite(fid,smvphi,'real*8'); fclose(fid);
323 %
324 % Stationary Eddy:
325 fid = fopen('seusq.bin','w','b'); seusq(find(isnan(seusq)))=undef; fwrite(fid,seusq,'real*8'); fclose(fid);
326 fid = fopen('sevsq.bin','w','b'); sevsq(find(isnan(sevsq)))=undef; fwrite(fid,sevsq,'real*8'); fclose(fid);
327 fid = fopen('setsq.bin','w','b'); setsq(find(isnan(setsq)))=undef; fwrite(fid,setsq,'real*8'); fclose(fid);
328 fid = fopen('sewsq.bin','w','b'); sewsq(find(isnan(sewsq)))=undef; fwrite(fid,sewsq,'real*8'); fclose(fid);
329 fid = fopen('sephisq.bin','w','b'); sephisq(find(isnan(sephisq)))=undef; fwrite(fid,sephisq,'real*8'); fclose(fid);
330 fid = fopen('seqsq.bin','w','b'); seqsq(find(isnan(seqsq)))=undef; fwrite(fid,seqsq,'real*8'); fclose(fid);
331 fid = fopen('seuv.bin','w','b'); seuv(find(isnan(seuv)))=undef; fwrite(fid,seuv,'real*8'); fclose(fid);
332 fid = fopen('seuw.bin','w','b'); seuw(find(isnan(seuw)))=undef; fwrite(fid,seuw,'real*8'); fclose(fid);
333 fid = fopen('sevw.bin','w','b'); sevw(find(isnan(sevw)))=undef; fwrite(fid,sevw,'real*8'); fclose(fid);
334 fid = fopen('sevt.bin','w','b'); sevt(find(isnan(sevt)))=undef; fwrite(fid,sevt,'real*8'); fclose(fid);
335 fid = fopen('sewt.bin','w','b'); sewt(find(isnan(sewt)))=undef; fwrite(fid,sewt,'real*8'); fclose(fid);
336 fid = fopen('sevq.bin','w','b'); sevq(find(isnan(sevq)))=undef; fwrite(fid,sevq,'real*8'); fclose(fid);
337 fid = fopen('sewq.bin','w','b'); sewq(find(isnan(sewq)))=undef; fwrite(fid,sewq,'real*8'); fclose(fid);
338 fid = fopen('sevphi.bin','w','b'); sevphi(find(isnan(sevphi)))=undef; fwrite(fid,sevphi,'real*8'); fclose(fid);
339 %
340 % Transient Mean:
341 fid = fopen('tmusq.bin','w','b'); tmusq(find(isnan(tmusq)))=undef; fwrite(fid,tmusq,'real*8'); fclose(fid);
342 fid = fopen('tmvsq.bin','w','b'); tmvsq(find(isnan(tmvsq)))=undef; fwrite(fid,tmvsq,'real*8'); fclose(fid);
343 fid = fopen('tmtsq.bin','w','b'); tmtsq(find(isnan(tmtsq)))=undef; fwrite(fid,tmtsq,'real*8'); fclose(fid);
344 fid = fopen('tmwsq.bin','w','b'); tmwsq(find(isnan(tmwsq)))=undef; fwrite(fid,tmwsq,'real*8'); fclose(fid);
345 fid = fopen('tmphisq.bin','w','b'); tmphisq(find(isnan(tmphisq)))=undef; fwrite(fid,tmphisq,'real*8'); fclose(fid);
346 fid = fopen('tmqsq.bin','w','b'); tmqsq(find(isnan(tmqsq)))=undef; fwrite(fid,tmqsq,'real*8'); fclose(fid);
347 fid = fopen('tmuv.bin','w','b'); tmuv(find(isnan(tmuv)))=undef; fwrite(fid,tmuv,'real*8'); fclose(fid);
348 fid = fopen('tmuw.bin','w','b'); tmuw(find(isnan(tmuw)))=undef; fwrite(fid,tmuw,'real*8'); fclose(fid);
349 fid = fopen('tmvw.bin','w','b'); tmvw(find(isnan(tmvw)))=undef; fwrite(fid,tmvw,'real*8'); fclose(fid);
350 fid = fopen('tmvt.bin','w','b'); tmvt(find(isnan(tmvt)))=undef; fwrite(fid,tmvt,'real*8'); fclose(fid);
351 fid = fopen('tmwt.bin','w','b'); tmwt(find(isnan(tmwt)))=undef; fwrite(fid,tmwt,'real*8'); fclose(fid);
352 fid = fopen('tmvq.bin','w','b'); tmvq(find(isnan(tmvq)))=undef; fwrite(fid,tmvq,'real*8'); fclose(fid);
353 fid = fopen('tmwq.bin','w','b'); tmwq(find(isnan(tmwq)))=undef; fwrite(fid,tmwq,'real*8'); fclose(fid);
354 fid = fopen('tmvphi.bin','w','b'); tmvphi(find(isnan(tmvphi)))=undef; fwrite(fid,tmvphi,'real*8'); fclose(fid);
355 %
356 % Transient Eddy:
357 fid = fopen('teusq.bin','w','b'); teusq(find(isnan(teusq)))=undef; fwrite(fid,teusq,'real*8'); fclose(fid);
358 fid = fopen('tevsq.bin','w','b'); tevsq(find(isnan(tevsq)))=undef; fwrite(fid,tevsq,'real*8'); fclose(fid);
359 fid = fopen('tetsq.bin','w','b'); tetsq(find(isnan(tetsq)))=undef; fwrite(fid,tetsq,'real*8'); fclose(fid);
360 fid = fopen('tewsq.bin','w','b'); tewsq(find(isnan(tewsq)))=undef; fwrite(fid,tewsq,'real*8'); fclose(fid);
361 fid = fopen('tephisq.bin','w','b'); tephisq(find(isnan(tephisq)))=undef; fwrite(fid,tephisq,'real*8'); fclose(fid);
362 fid = fopen('teqsq.bin','w','b'); teqsq(find(isnan(teqsq)))=undef; fwrite(fid,teqsq,'real*8'); fclose(fid);
363 fid = fopen('teuv.bin','w','b'); teuv(find(isnan(teuv)))=undef; fwrite(fid,teuv,'real*8'); fclose(fid);
364 fid = fopen('teuw.bin','w','b'); teuw(find(isnan(teuw)))=undef; fwrite(fid,teuw,'real*8'); fclose(fid);
365 fid = fopen('tevw.bin','w','b'); tevw(find(isnan(tevw)))=undef; fwrite(fid,tevw,'real*8'); fclose(fid);
366 fid = fopen('tevt.bin','w','b'); tevt(find(isnan(tevt)))=undef; fwrite(fid,tevt,'real*8'); fclose(fid);
367 fid = fopen('tewt.bin','w','b'); tewt(find(isnan(tewt)))=undef; fwrite(fid,tewt,'real*8'); fclose(fid);
368 fid = fopen('tevq.bin','w','b'); tevq(find(isnan(tevq)))=undef; fwrite(fid,tevq,'real*8'); fclose(fid);
369 fid = fopen('tewq.bin','w','b'); tewq(find(isnan(tewq)))=undef; fwrite(fid,tewq,'real*8'); fclose(fid);
370 fid = fopen('tevphi.bin','w','b'); tevphi(find(isnan(tevphi)))=undef; fwrite(fid,tevphi,'real*8'); fclose(fid);
371 %

  ViewVC Help
Powered by ViewVC 1.1.22