1 | % Location of loadnc.m |
---|
2 | path(path, '../common') |
---|
3 | |
---|
4 | do_plot_sw_libradtran = 1; |
---|
5 | do_plot_sw_spartacus_extras = 0; % Need to have run "make i3rc_spartacus_extra" |
---|
6 | |
---|
7 | % Load libRadTran benchmark |
---|
8 | load i3rc_mls_cumulus_LIBRADTRAN |
---|
9 | |
---|
10 | % Load ECRAD/SPARTACUS cases |
---|
11 | sp_code = 'i3rc_mls_cumulus'; |
---|
12 | scases = {[sp_code '_ECRAD_ICA_OUT.nc'],... % Stored result of running ECRAD in ICA mode |
---|
13 | [sp_code '_3reg_3d_out.nc'],... |
---|
14 | [sp_code '_3reg_3d_clustering_out.nc'],... |
---|
15 | [sp_code '_mcica_out.nc'],... |
---|
16 | [sp_code '_tc_out.nc'],... |
---|
17 | [sp_code '_3reg_1d_out.nc']}; |
---|
18 | id_ica = 1; |
---|
19 | id_1d = 6; |
---|
20 | id_3d = 2; % Maximum entrapment |
---|
21 | %id_3d = 7; % Computed entrapment |
---|
22 | ecrad_sw_list = [id_ica id_3d 4 5]; |
---|
23 | ecrad_legend = {'ECRAD ICA','ECRAD SPARTACUS','ECRAD McICA','ECRAD Tripleclouds'}; |
---|
24 | ecrad_styles = {'b--','r--','g--','c--'}; |
---|
25 | |
---|
26 | if do_plot_sw_spartacus_extras |
---|
27 | scases(end+1:end+6)={[sp_code '_3reg_3d_computed_out.nc'],... |
---|
28 | [sp_code '_3reg_3d_minimum_out.nc'],... |
---|
29 | [sp_code '_3reg_1d_computed_out.nc'],... |
---|
30 | [sp_code '_3reg_1d_minimum_out.nc'],... |
---|
31 | [sp_code '_3reg_3d_computedleast_out.nc'],... |
---|
32 | [sp_code '_3reg_3d_fractal_out.nc']}; |
---|
33 | ecrad_sw_list = [id_3d 7 8 id_1d 9 10 5 11 12]; |
---|
34 | ecrad_legend = {'SPARTACUS 3D Max','SPARTACUS 3D Comp','SPARTACUS 3D Min',... |
---|
35 | 'SPARTACUS 1D Max','SPARTACUS 1D Comp','SPARTACUS 1D Min',... |
---|
36 | 'Tripleclouds','SPARTACUS 3D Comp least','SPARTACUS 3D Fract'}; |
---|
37 | ecrad_styles = {'r--','r-','r-.','b--','bo','bx','c--','m--','m-.'}; |
---|
38 | id_3d_min = 8; |
---|
39 | end |
---|
40 | |
---|
41 | % Factor for conversion to heating rates in K day-1 |
---|
42 | ff = 24.*3600.*(9.81./1004); |
---|
43 | for icase = 1:length(scases) |
---|
44 | sp{icase} = loadnc([scases{icase}]); |
---|
45 | sp{icase}.hr_sw = ff.*diff(sp{icase}.flux_up_sw-sp{icase}.flux_dn_sw)./diff(sp{icase}.pressure_hl); |
---|
46 | sp{icase}.hr_lw = ff.*diff(sp{icase}.flux_up_lw-sp{icase}.flux_dn_lw)./diff(sp{icase}.pressure_hl); |
---|
47 | end |
---|
48 | |
---|
49 | % Load input data |
---|
50 | sp_input = loadnc([sp_code '_sza.nc']); |
---|
51 | sp_sza = acosd(sp_input.cos_solar_zenith_angle); |
---|
52 | |
---|
53 | |
---|
54 | sza_axis = [0 90]; |
---|
55 | sza_tick = [0:15:90]; |
---|
56 | |
---|
57 | % Plot shortwave 3D effect as shown in Fig. 4 of Hogan et al. (2016) |
---|
58 | figure(1) |
---|
59 | clf |
---|
60 | set(gcf,'defaultlinelinewidth',1,'paperposition',[0.25 2.5 21 16]); |
---|
61 | |
---|
62 | subplot(2,2,1); |
---|
63 | if do_plot_sw_libradtran |
---|
64 | plot(sza,up_toa_1D,'b'); |
---|
65 | hold on |
---|
66 | errorbar(sza,up_toa_3D,up_toa_std_3D,'r'); |
---|
67 | end |
---|
68 | |
---|
69 | for ii = 1:length(ecrad_sw_list) |
---|
70 | iecrad = ecrad_sw_list(ii); |
---|
71 | plot(sp_sza,sp{iecrad}.flux_up_sw(1,:),ecrad_styles{ii}); |
---|
72 | hold on |
---|
73 | end |
---|
74 | |
---|
75 | plot(sp_sza,sp{1}.flux_up_sw_clear(1,:),'k'); |
---|
76 | |
---|
77 | xlim(sza_axis); |
---|
78 | ylabel('TOA upwelling flux (W m^{-2})'); |
---|
79 | text(0,1.02,' \bf(a)','verticalalignment','bottom','units','normalized'); |
---|
80 | ylim([0 300]); |
---|
81 | grid on |
---|
82 | set(gca,'xtick',sza_tick); |
---|
83 | xlabel('Solar zenith angle (\circ)') |
---|
84 | ylim([0 250]); |
---|
85 | if do_plot_sw_libradtran |
---|
86 | leg = {'libRadtran ICA (DISORT)',... |
---|
87 | 'libRadtran 3D (MYSTIC)'}; |
---|
88 | leg([1:length(ecrad_legend)]+2) = ecrad_legend; |
---|
89 | else |
---|
90 | leg = ecrad_legend; |
---|
91 | end |
---|
92 | leg{length(leg)+1} = 'Clear sky'; |
---|
93 | hh=legend(leg,3); |
---|
94 | set(hh,'fontsize',7) |
---|
95 | |
---|
96 | subplot(2,2,2); |
---|
97 | plot(sza,dn_direct_surf_1D./cosd(sza),'b'); |
---|
98 | hold on |
---|
99 | errorbar(sza,dn_direct_surf_3D./cosd(sza), dn_direct_surf_std_3D./cosd(sza),'r'); |
---|
100 | |
---|
101 | for ii = 1:length(ecrad_sw_list) |
---|
102 | iecrad = ecrad_sw_list(ii); |
---|
103 | plot(sp_sza,sp{iecrad}.flux_dn_direct_sw(end,:)./cosd(sp_sza'),ecrad_styles{ii}); |
---|
104 | end |
---|
105 | |
---|
106 | plot(sp_sza,sp{id_3d}.flux_dn_direct_sw_clear(end,:)./cosd(sp_sza'),'k'); |
---|
107 | |
---|
108 | xlim(sza_axis); |
---|
109 | ylim([0 1100]); |
---|
110 | grid on |
---|
111 | set(gca,'xtick',sza_tick); |
---|
112 | xlabel('Solar zenith angle (\circ)') |
---|
113 | ylabel('Direct flux in direction of sun (W m^{-2})'); |
---|
114 | h=legend(leg,3); |
---|
115 | set(h,'fontsize',7) |
---|
116 | text(0,1.02,' \bf(b)','verticalalignment','bottom','units','normalized'); |
---|
117 | |
---|
118 | up1dinterp = interp1(sza,up_toa_1D,sp_sza)'; |
---|
119 | |
---|
120 | subplot(2,2,3) |
---|
121 | errorbar(sza,... |
---|
122 | 100.*(up_toa_3D-up_toa_1D)./(up_toa_1D-sw_up_clear(end,:)),... |
---|
123 | 100.*(up_toa_std_3D)./(up_toa_1D-sw_up_clear(end,:)),... |
---|
124 | 'r'); |
---|
125 | hold on |
---|
126 | effect_3d = 100.*(sp{id_3d}.flux_up_sw(1,:)-sp{id_ica}.flux_up_sw(1,:)) ... |
---|
127 | ./(sp{id_ica}.flux_up_sw(1,:)-sp{id_3d}.flux_up_sw_clear(1,:)); |
---|
128 | effect_3d(end) = NaN; |
---|
129 | plot(sp_sza,effect_3d,'r--'); |
---|
130 | |
---|
131 | if do_plot_sw_spartacus_extras |
---|
132 | effect_edge = 100.*(sp{id_3d_min}.flux_up_sw(1,:)-sp{id_ica}.flux_up_sw(1,:)) ... |
---|
133 | ./(sp{id_ica}.flux_up_sw(1,:)-sp{id_3d_min}.flux_up_sw_clear(1,:)); |
---|
134 | effect_edge(end) = NaN; |
---|
135 | plot(sp_sza,effect_edge,'r-.'); |
---|
136 | end |
---|
137 | |
---|
138 | xlim(sza_axis); |
---|
139 | ylim([-40 140]); |
---|
140 | set(gca,'xtick',sza_tick); |
---|
141 | ylabel('3D change to cloud radiative effect (%)'); |
---|
142 | xlabel('Solar zenith angle (\circ)') |
---|
143 | text(0,1.02,' \bf(d)','verticalalignment','bottom','units','normalized'); |
---|
144 | grid on |
---|
145 | if do_plot_sw_spartacus_extras |
---|
146 | h=legend('libRadtran','SPARTACUS','SPARTACUS edge only',2); |
---|
147 | else |
---|
148 | h=legend('libRadtran','SPARTACUS',2); |
---|
149 | end |
---|
150 | set(h,'fontsize',8) |
---|
151 | |
---|
152 | subplot(2,2,4) |
---|
153 | errorbar(sza,-(up_toa_3D-up_toa_1D),up_toa_std_3D,'r'); |
---|
154 | hold on |
---|
155 | effect_3d = sp{id_3d}.flux_up_sw(1,:)-sp{id_ica}.flux_up_sw(1,:); |
---|
156 | effect_3d(end) = NaN; |
---|
157 | plot(sp_sza,-effect_3d,'r--'); |
---|
158 | |
---|
159 | if do_plot_sw_spartacus_extras |
---|
160 | effect_edge = sp{id_3d_min}.flux_up_sw(1,:)-sp{id_ica}.flux_up_sw(1,:); |
---|
161 | effect_edge(end) = NaN; |
---|
162 | plot(sp_sza,-effect_edge,'r-.'); |
---|
163 | end |
---|
164 | |
---|
165 | xlim(sza_axis); |
---|
166 | ylim([-25 30]); |
---|
167 | set(gca,'xtick',sza_tick); |
---|
168 | ylabel('3D change to cloud radiative effect (W m^{-2})'); |
---|
169 | xlabel('Solar zenith angle (\circ)') |
---|
170 | text(0,1.02,' \bf(c)','verticalalignment','bottom','units','normalized'); |
---|
171 | grid on |
---|
172 | if do_plot_sw_spartacus_extras |
---|
173 | h=legend('libRadtran','SPARTACUS','SPARTACUS edge only',2); |
---|
174 | else |
---|
175 | h=legend('libRadtran','SPARTACUS',2); |
---|
176 | end |
---|
177 | |
---|
178 | set(h,'fontsize',8) |
---|
179 | |
---|
180 | % Write selected cloud radiative forcings to the terminal window |
---|
181 | isza = [1 6]; |
---|
182 | sza(isza) |
---|
183 | |
---|
184 | crf_mystic_1d_toa = -(up_toa_1D(isza)-sw_up_clear(end,isza)) |
---|
185 | crf_mystic_3deffect = up_toa_1D(isza)-up_toa_3D(isza) |
---|
186 | |
---|
187 | crf_spartacus_1d_toa = interp1(sp_sza,-sp{id_ica}.flux_up_sw(1,:) + sp{id_ica}.flux_up_sw_clear(1,:), sza(isza)) |
---|
188 | crf_spartacus_3deffect = interp1(sp_sza,-effect_3d(:), sza(isza)) |
---|
189 | |
---|
190 | crf_mystic_3deffect_percentage = 100.* crf_mystic_3deffect ./ crf_mystic_1d_toa |
---|
191 | crf_spartacus_3deffect_percentage = 100.* crf_spartacus_3deffect ./ crf_spartacus_1d_toa |
---|
192 | |
---|
193 | |
---|
194 | % Plot the 3D impact on shortwave heating rates as in Fig. 5 of Hogan et al. (2016) |
---|
195 | figure(2) |
---|
196 | clf |
---|
197 | set(gcf,'units','inches','paperposition',[0.25 0.25 10 9],'defaultlinelinewidth',1); |
---|
198 | |
---|
199 | sza_map = [1 9 16 24 31 38 41 45]; |
---|
200 | sza_map = {1, [8 9], 16, [23 24], 31, [38 39], 41, 45}; |
---|
201 | |
---|
202 | for isza = [1 5]; %[2 6] |
---|
203 | sza(isza) |
---|
204 | hr_sp_clear = ff.*diff(sp{id_3d}.flux_up_sw_clear-sp{id_3d}.flux_dn_sw_clear)./diff(sp{id_3d}.pressure_hl); |
---|
205 | ii = sza_map{isza}; |
---|
206 | z_mid_sp = (sp_input.height_hl(1:end-1,1) + sp_input.height_hl(2:end,1))./2; |
---|
207 | |
---|
208 | plot(dat1D{isza}.hr,dat1D{isza}.z_mid,'b') |
---|
209 | axis([1 4.5 0 3]); |
---|
210 | hold on |
---|
211 | |
---|
212 | plot(dat3D{isza}.hr,dat3D{isza}.z_mid,'r') |
---|
213 | if isza == 5 |
---|
214 | errs=nan.*dat3D{isza}.hr_std; |
---|
215 | ind = [2 4 6 16 26 36 43:2:49]; |
---|
216 | ind = [1:5 8:5:38 42:50]; |
---|
217 | errs(ind) = dat3D{isza}.hr_std(ind); |
---|
218 | herrorbar(dat3D{isza}.hr,dat3D{isza}.z_mid,errs,'r') |
---|
219 | end |
---|
220 | |
---|
221 | SPARTACUS_SZA = sp_sza(ii); |
---|
222 | plot(mean(sp{id_ica}.hr_sw(:,ii),2),z_mid_sp./1000,'b--'); |
---|
223 | plot(mean(sp{id_3d}.hr_sw(:,ii),2),z_mid_sp./1000,'r--'); |
---|
224 | plot(mean(hr_sp_clear(:,ii),2),z_mid_sp./1000,'k-'); |
---|
225 | end |
---|
226 | |
---|
227 | axis([1 4.5 0 3]); |
---|
228 | xlabel('Shortwave heating rate (K d^{-1})'); |
---|
229 | ylabel('Height (km)'); |
---|
230 | text(1.25,3,['\theta_0=' num2str(sza(isza)) '\circ'],'verticalalignment','bottom') |
---|
231 | text(2.4,3,'\theta_0=0\circ','verticalalignment','bottom') |
---|
232 | h=legend(leg{[1 2 3 4 end]},4); |
---|
233 | set(h,'fontsize',7); |
---|
234 | |
---|
235 | % Plot longwave 3D effect on heating rates as shown in Fig. 6 of Hogan |
---|
236 | % et al. (2016) |
---|
237 | p = interp1(sp_input.height_hl(:,1),sp_input.pressure_hl(:,1),z.*1000); |
---|
238 | z_mid = 0.5.*(z(1:end-1)+z(2:end)); |
---|
239 | |
---|
240 | hr_clear = ff.*diff(lw_up_clear-lw_dn_clear)./diff(p); |
---|
241 | hr_1d = ff.*diff(d{1}.lw_up-d{1}.lw_dn)./diff(p); |
---|
242 | hr_3d = ff.*diff(d{2}.lw_up-d{2}.lw_dn)./diff(p); |
---|
243 | hr_sp_3d = ff.*diff(sp{id_3d}.flux_up_lw-sp{id_3d}.flux_dn_lw)./diff(sp{id_3d}.pressure_hl); |
---|
244 | hr_sp_1d = ff.*diff(sp{id_1d}.flux_up_lw-sp{id_1d}.flux_dn_lw)./diff(sp{id_1d}.pressure_hl); |
---|
245 | hr_sp_clear = ff.*diff(sp{id_1d}.flux_up_lw_clear-sp{id_1d}.flux_dn_lw_clear)./diff(sp{id_1d}.pressure_hl); |
---|
246 | hr_sp_3d_clustering = ff.*diff(sp{3}.flux_up_lw-sp{3}.flux_dn_lw)./diff(sp{3}.pressure_hl); |
---|
247 | |
---|
248 | cols = 'brmg'; |
---|
249 | cols_clear = 'km'; |
---|
250 | |
---|
251 | figure(3) |
---|
252 | clf |
---|
253 | set(gcf,'units','inches','paperposition',[0.25 0.25 10 9],'defaultlinelinewidth',1); |
---|
254 | |
---|
255 | plot(smooth1D(hr_clear),z_mid,'k'); |
---|
256 | hold on |
---|
257 | plot(smooth1D(hr_1d),z_mid,cols(1)); |
---|
258 | plot(smooth1D(hr_3d),z_mid,cols(2)); |
---|
259 | plot(smooth1D(hr_sp_clear(:,1)),z_mid_sp./1000,'k--'); |
---|
260 | plot(smooth1D(hr_sp_1d(:,1)),z_mid_sp./1000,[cols(1) '--']); |
---|
261 | plot(smooth1D(hr_sp_3d_clustering(:,1)),z_mid_sp./1000,[cols(2) '--']); |
---|
262 | h=plot(smooth1D(hr_sp_3d(:,1)),z_mid_sp./1000,[cols(3) '--']); |
---|
263 | if cols(3) == 'm' |
---|
264 | set(h,'color',[1 0.65 0]); |
---|
265 | end |
---|
266 | |
---|
267 | ylim([0 3]); |
---|
268 | |
---|
269 | xlabel('Longwave heating rate (K d^{-1})'); |
---|
270 | ylabel('Height (km)'); |
---|
271 | xlim([-5 -1]); |
---|
272 | h=legend('libRadtran clear','libRadtran ICA (DISORT)','libRadtran 3D (MYSTIC)',... |
---|
273 | 'SPARTACUS clear','SPARTACUS 1D','SPARTACUS 3D clust', ... |
---|
274 | 'SPARTACUS 3D no clust',3); |
---|
275 | set(h,'fontsize',6); |
---|