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

Contents of /MITgcm/verification/fizhi-cs-aqualev20/scripts/assemble_MF.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, 1 month 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 %
2 % $Id: assemble_MF.m,v 1.8 2006/03/24 21:56:27 edhill Exp $
3 %
4 % Ed Hill
5 %
6 % Generate the APE MF fields:
7 %
8 % Read all variables:
9 % Convert units as necessary:
10 % Regrid onto lat-lon:
11 % Write netCDF output with all attributes:
12 %
13
14
15 %======================================================================
16 %
17 % Define the connections between the APE "ML" variables and the
18 % MITgcm diagnostics output
19 %
20 oname = { 'MF_fields.nc' };
21 title = 'Averages variance quantities as 3D fields';
22 nl = 64;
23 np = 17;
24
25
26 % Get the following from:
27 % ! (cd ../../ape_data_specs/ ; ./mf_parse_v2.sh)
28 vars = {};
29 vars{1} = {'MF01','mf_uu','u2totz','zonal_wind_variance','m2 s-2'};
30 vars{2} = {'MF02','mf_vv','v2totz','meridional_wind_variance','m2 s-2'};
31 vars{3} = {'MF03','mf_tt','potempsqz','temperature_variance','K2'};
32 vars{4} = {'MF04','mf_omom','wvelsqz','omega_variance','Pa2 s-2'};
33 vars{5} = {'MF05','mf_phiphi','phihydsqz','geopotential_variance','(m2 s-2)2'};
34 vars{6} = {'MF06','mf_qq','saltsqz','specific_humidity_variance','(kg kg-1)2'};
35 vars{7} = {'MF07','mf_uv','uvtotz','poleward_zonal_momentum_flux','m2 s-2'};
36 vars{8} = {'MF08','mf_uom','wuEz','vertical_zonal_momentum_flux','m Pa s-2'};
37 vars{9} = {'MF09','mf_vom','wvNz','vertical_meridional_momentum_flux','m Pa s-2'};
38 vars{10} = {'MF10','mf_vt','vNthz','poleward_temperature_flux','m s-1 K'};
39 vars{11} = {'MF11','mf_omt','wvelthz','vertical_temperature_flux','Pa s-1 K'};
40 vars{12} = {'MF12','mf_vq','vNsltz','poleward_moisture_flux','m s-1 kg kg-1'};
41 vars{13} = {'MF13','mf_omq','wvelsltz','vertical_moisture_flux','Pa s-1 kg kg-1'};
42 vars{14} = {'MF14','mf_vphi','vNphiz','poleward_geopotential_flux','m3 s-3'};
43 vars{15} = {'MF15','mf_sm_uu','smusq','zonal_wind_variance_stationary_mean','m2 s-2'};
44 vars{16} = {'MF16','mf_sm_vv','smvsq','meridional_wind_variance_stationary_mean','m2 s-2'};
45 vars{17} = {'MF17','mf_sm_tt','smtsq','temperature_variance_stationary_mean','K2'};
46 vars{18} = {'MF18','mf_sm_omom','smwsq','omega_variance_stationary_mean','Pa2 s-2'};
47 vars{19} = {'MF19','mf_sm_phiphi','smphisq','geopotential_variance_stationary_mean','(m2 s-2)2'};
48 vars{20} = {'MF20','mf_sm_qq','smqsq','specific_humidity_variance_stationary_mean','(kg kg-1)2'};
49 vars{21} = {'MF21','mf_sm_uv','smuv','poleward_zonal_momentum_flux_stationary_mean','m2 s-2'};
50 vars{22} = {'MF22','mf_sm_uom','smuw','vertical_zonal_momentum_flux_stationary_mean','m Pa s-2'};
51 vars{23} = {'MF23','mf_sm_vom','smvw','vertical_meridional_momentum_flux_stationary_mean','m Pa s-2'};
52 vars{24} = {'MF24','mf_sm_vt','smvt','poleward_temperature_flux_stationary_mean','m s-1 K'};
53 vars{25} = {'MF25','mf_sm_omt','smwt','vertical_temperature_flux_stationary_mean','Pa s-1 K'};
54 vars{26} = {'MF26','mf_sm_vq','smvq','poleward_moisture_flux_stationary_mean','m s-1 kg kg-1'};
55 vars{27} = {'MF27','mf_sm_omq','smwq','vertical_moisture_flux_stationary_mean','Pa s-1 kg kg-1'};
56 vars{28} = {'MF28','mf_sm_vphi','smvphi','poleward_geopotential_flux_stationary_mean','m3 s-3'};
57 vars{29} = {'MF29','mf_se_uu','seusq','zonal_wind_variance_stationary_eddy','m2 s-2'};
58 vars{30} = {'MF30','mf_se_vv','sevsq','meridional_wind_variance__stationary_eddy','m2 s-2'};
59 vars{31} = {'MF31','mf_se_tt','setsq','temperature_variance_stationary_eddy','K2'};
60 vars{32} = {'MF32','mf_se_omom','sewsq','omega_variance_stationary_eddy','Pa2 s-2'};
61 vars{33} = {'MF33','mf_se_phiphi','sephisq','geopotential_variance_stationary_eddy','(m2 s-2)2'};
62 vars{34} = {'MF34','mf_se_qq','seqsq','specific_humidity_variance_stationary_eddy','(kg kg-1)2'};
63 vars{35} = {'MF35','mf_se_uv','seuv','poleward_zonal_momentum_flux_stationary_eddy','m2 s-2'};
64 vars{36} = {'MF36','mf_se_uom','seuw','vertical_zonal_momentum_flux_stationary_eddy','m Pa s-2'};
65 vars{37} = {'MF37','mf_se_vom','sevw','vertical_meridional_momentum_flux_stationary_eddy','m Pa s-2'};
66 vars{38} = {'MF38','mf_se_vt','sevt','poleward_temperature_flux_stationary_eddy','m s-1 K'};
67 vars{39} = {'MF39','mf_se_omt','sewt','vertical_temperature_flux_stationary_eddy','Pa s-1 K'};
68 vars{40} = {'MF40','mf_se_vq','sevq','poleward_moisture_flux_stationary_eddy','m s-1 kg kg-1'};
69 vars{41} = {'MF41','mf_se_omq','sewq','vertical_moisture_flux_stationary_eddy','Pa s-1 kg kg-1'};
70 vars{42} = {'MF42','mf_se_vphi','sevphi','poleward_geopotential_flux_stationary_eddy','m3 s-3'};
71 vars{43} = {'MF43','mf_tm_uu','tmusq','zonal_wind_variance_transient_mean_merdional','m2 s-2'};
72 vars{44} = {'MF44','mf_tm_vv','tmvsq','meridional_wind_variance_transient_mean_merdional','m2 s-2'};
73 vars{45} = {'MF45','mf_tm_tt','tmtsq','temperature_variance_transient_mean_merdional','K2'};
74 vars{46} = {'MF46','mf_tm_omom','tmwsq','omega_variance_transient_mean_merdional','Pa2 s-2'};
75 vars{47} = {'MF47','mf_tm_phiphi','tmphisq','geopotential_variance_transient_mean_merdional','(m2 s-2)2'};
76 vars{48} = {'MF48','mf_tm_qq','tmqsq','specific_humidity_variance_transient_mean_merdional','(kg kg-1)2'};
77 vars{49} = {'MF49','mf_tm_uv','tmuv','poleward_zonal_momentum_flux_transient_mean_merdional','m2 s-2'};
78 vars{50} = {'MF50','mf_tm_uom','tmuw','vertical_zonal_momentum_flux_transient_mean_merdional','m Pa s-2'};
79 vars{51} = {'MF51','mf_tm_vom','tmvw','vertical_meridional_momentum_flux_transient_mean_merdional','m Pa s-2'};
80 vars{52} = {'MF52','mf_tm_vt','tmvt','poleward_temperature_flux_transient_mean_merdional','m s-1 K'};
81 vars{53} = {'MF53','mf_tm_omt','tmwt','vertical_temperature_flux_transient_mean_merdional','Pa s-1 K'};
82 vars{54} = {'MF54','mf_tm_vq','tmvq','poleward_moisture_flux_transient_mean_merdional','m s-1 kg kg-1'};
83 vars{55} = {'MF55','mf_tm_omq','tmwq','vertical_moisture_flux_transient_mean_merdional','Pa s-1 kg kg-1'};
84 vars{56} = {'MF56','mf_tm_vphi','tmvphi','poleward_geopotential_flux_transient_mean_merdional','m3 s-3'};
85 vars{57} = {'MF57','mf_te_uu','teusq','zonal_wind_variance_transient_eddy','m2 s-2'};
86 vars{58} = {'MF58','mf_te_vv','tevsq','meridional_wind_variance_transient_eddy','m2 s-2'};
87 vars{59} = {'MF59','mf_te_tt','tetsq','temperature_variance_transient_eddy','K2'};
88 vars{60} = {'MF60','mf_te_omom','tewsq','omega_variance_transient_eddy','Pa2 s-2'};
89 vars{61} = {'MF61','mf_te_phiphi','tephisq','geopotential_variance_transient_eddy','(m2 s-2)2'};
90 vars{62} = {'MF62','mf_te_qq','teqsq','specific_humidity_variance_transient_eddy','(kg kg-1)2'};
91 vars{63} = {'MF63','mf_te_uv','teuv','poleward_zonal_momentum_flux_transient_eddy','m2 s-2'};
92 vars{64} = {'MF64','mf_te_uom','teuw','vertical_zonal_momentum_flux_transient_eddy','m Pa s-2'};
93 vars{65} = {'MF65','mf_te_vom','tevw','vertical_meridional_momentum_flux_transient_eddy','m Pa s-2'};
94 vars{66} = {'MF66','mf_te_vt','tevt','poleward_temperature_flux_transient_eddy','m s-1 K'};
95 vars{67} = {'MF67','mf_te_omt','tewt','vertical_temperature_flux_transient_eddy','Pa s-1 K'};
96 vars{68} = {'MF68','mf_te_vq','tevq','poleward_moisture_flux_transient_eddy','m s-1 kg kg-1'};
97 vars{69} = {'MF69','mf_te_omq','tewq','vertical_moisture_flux_transient_eddy','Pa s-1 kg kg-1'};
98 vars{70} = {'MF70','mf_te_vphi','tevphi','poleward_geopotential_flux_transient_eddy','m3 s-3'};
99
100
101
102 %======================================================================
103 %
104 % Read and save the fields
105 %
106 disp('Reading fields')
107
108 Pref = [ 1 2 3 5 7 10 15 20 25 30 40 50 60 70 85 92.5 100 ] * 10;
109 Pref = Pref(length(Pref):-1:1);
110 pfac = (Pref./1000).^0.286;
111
112 ave = struct([]);
113 i = 1;
114 for i = 1:length(vars)
115
116 if strcmp(vars{i}{3},'--')
117 continue
118 end
119
120 fid = fopen([ 'data/' vars{i}{3} '.bin' ],'r','ieee-be');
121 tmp = fread(fid,nl*np,'real*8');
122 fclose(fid);
123 ia = length(ave) + 1;
124 ave(ia).dat = reshape(tmp,[nl np]);
125 ave(ia).ivar = i;
126
127 %=================================
128 % unit conversions
129
130 % theta ==> T
131 if strcmp(vars{i}{2}((end-1):end),'tt')
132 disp([' Converting units th^2 ==> T^2 for: "' vars{i}{2} '"'])
133 for il = 1:nl
134 ave(ia).dat(il,:) = ave(ia).dat(il,:) .* (pfac.^2);
135 end
136 elseif strcmp(vars{i}{2}(end:end),'t')
137 disp([' Converting units th ==> T for: "' vars{i}{2} '"'])
138 for il = 1:nl
139 ave(ia).dat(il,:) = ave(ia).dat(il,:) .* pfac;
140 end
141 end
142
143 % geopotential
144 % if length(vars{i}{2}) > 6
145 % if strcmp(vars{i}{2}((end-5):end),'phiphi')
146 % disp([' Converting units phiphi/g^2 for: "' vars{i}{2} '"'])
147 % ave(ia).dat(:,:) = ave(ia).dat(:,:) ./ (9.81^2);
148 % elseif strcmp(vars{i}{2}((end-2):end),'phi')
149 % disp([' Converting units phi/g for: "' vars{i}{2} '"'])
150 % ave(ia).dat(:,:) = ave(ia).dat(:,:) ./ 9.81;
151 % end
152 % end
153
154 end
155
156 %======================================================================
157 %
158 % Grid Info
159 %
160 % JMC suggested an evenly spaced Lat-Lon at: 128x64
161 %
162
163 og = [];
164 og.nlat = 64;
165 og.latcell = 180/og.nlat;
166 og.lat = linspace(-90+og.latcell/2, 90-og.latcell/2, og.nlat);
167 og.latbnd(:,1) = og.lat - og.latcell/2.0;
168 og.latbnd(:,2) = og.lat + og.latcell/2.0;
169
170 Pref = [ 1 2 3 5 7 10 15 20 25 30 40 50 60 70 85 92.5 100 ] * 10;
171 Pref = Pref(length(Pref):-1:1);
172
173
174 %======================================================================
175 %
176 % Write netCDF output
177 %
178 disp('Writing netCDF output')
179
180 nc = netcdf(oname{1}, 'clobber');
181 nc.title = [ 'Aqua Planet: ' ...
182 title ];
183 nc.institution = 'MIT Dept. of EAPS, Cambridge, MA, USA';
184 nc.source = [ 'MITgcm: ' ];
185 nc.Conventions = 'CF-1.0';
186 %nc.history = [ 'Original data produced: ' '2002/08/20' ];
187
188 nc('pres') = length(Pref);
189 nc('lat') = og.nlat;
190 nc('bnd') = 2;
191
192 nc{'pres'} = ncdouble('pres');
193 nc{'pres'}.standard_name = 'air_pressure';
194 nc{'pres'}.units = 'Pa';
195 nc{'pres'}(:) = Pref*100;
196
197 nc{'lat'} = ncdouble('lat');
198 nc{'lat'}.standard_name = 'latitude';
199 nc{'lat'}.units = 'degrees_north';
200 nc{'lat'}.bounds = 'lat_bnds';
201 nc{'lat'}(:) = og.lat;
202
203 nc{'lat_bnds'} = ncdouble('lat','bnd');
204 nc{'lat_bnds'}.ape_name = 'latitude cell bounds';
205 nc{'lat_bnds'}.units = 'degrees_north';
206 nc{'lat_bnds'}(:) = og.latbnd;
207
208 for ii = 1:length(ave)
209
210 iv = ave(ii).ivar;
211 nc{ vars{iv}{2} } = ncfloat( 'pres', 'lat' );
212 nc{ vars{iv}{2} }.ape_name = vars{iv}{4};
213 nc{ vars{iv}{2} }.units = vars{iv}{5};
214 nc{ vars{iv}{2} }.FillValue_ = 1.0e20;
215
216 % handle missing values
217 indf = find( ave(ii).dat >= 1.0e14 );
218 ave(ii).dat(indf) = 1.0e20;
219
220 nc{ vars{iv}{2} }(:) = ave(ii).dat';
221
222 end
223
224 nc = close(nc);
225
226

  ViewVC Help
Powered by ViewVC 1.1.22