source: LMDZ6/branches/contrails/libf/phylmd/ecrad/test/ckdmip/evaluate_forcing_ecrad.m

Last change on this file was 4773, checked in by idelkadi, 12 months ago
  • Update of Ecrad in LMDZ The same organization of the Ecrad offline version is retained in order to facilitate the updating of Ecrad in LMDZ and the comparison between online and offline results. version 1.6.1 of Ecrad (https://github.com/lguez/ecrad.git)
  • Implementation of the double call of Ecrad in LMDZ


File size: 2.0 KB
Line 
1% Evaluate the forcing calculated by ecRad for the CKDMIP scenarios
2% against line-by-line
3
4DOMAIN='sw';
5DATASET='evaluation1';
6VAR=['flux_up_' DOMAIN];
7REFDIR='lbl_fluxes';
8EXPDIR='fluxes';
9MODELS={'rrtmg','ecckd'};
10LEGEND={'LBLRTM','RRTMG','ecCKD'};
11
12gases={'co2','ch4','n2o'};
13labels={'CO2 concentration (ppmv)','CH4 concentration (ppbv)','N2O concentration (ppbv)'}
14concs={[180 280 415 560 1120 2240],[350 700 1200 1921 2600 3500],[190 270 332 405 540]};
15ipresent = [3 4 3];
16if ~exist('ref','var')
17  for igas = 1:length(gases)
18    conc = concs{igas};
19    for iconc = 1:length(conc)
20      if iconc == ipresent(igas)
21        scenario_str = 'present';
22      else
23        scenario_str = [gases{igas} '-' num2str(conc(iconc))];
24      end
25      ref{igas}{iconc} = loadnc([REFDIR '/ckdmip_' DATASET '_' DOMAIN '_fluxes_' scenario_str '.nc']);
26      data = ref{igas}{iconc}.(VAR)(1,:,:);
27      ref_mean_toa_up{igas}(iconc) = mean(data(:));
28    end
29  end
30end
31
32if ~exist('expt','var')
33  for igas = 1:length(gases)
34    conc = concs{igas};
35    for iconc = 1:length(conc)
36      if iconc == ipresent(igas)
37        scenario_str = 'present';
38      else
39        scenario_str = [gases{igas} '-' num2str(conc(iconc))];
40      end
41      for iexpt = 1:length(MODELS)
42        expt{iexpt,igas}{iconc} = loadnc([EXPDIR '/ecrad-' MODELS{iexpt} '_' DATASET '_' DOMAIN '_fluxes_' scenario_str '.nc']);
43        data = expt{iexpt,igas}{iconc}.(VAR)(1,:,:);
44        expt_mean_toa_up{iexpt,igas}(iconc) = mean(data(:));
45      end
46    end
47  end
48end
49
50clf
51set(gcf,'defaultlinelinewidth',1,'paperposition',[0.5 0.5 30 10]);
52stys = {'b--','r-.'};
53for igas = 1:length(gases)
54  subplot(1,length(gases),igas)
55  conc = concs{igas};
56  plot(conc, -ref_mean_toa_up{igas}+ref_mean_toa_up{igas}(ipresent(igas)),'k');
57  hold on
58  for iexpt = 1:length(MODELS)
59    plot(conc, -expt_mean_toa_up{iexpt,igas}+expt_mean_toa_up{iexpt,igas}(ipresent(igas)),stys{iexpt});
60  end
61  if igas == 1
62    set(gca,'xscale','log');
63    legend(LEGEND,'location','northwest');
64  end
65  xlabel(labels{igas})
66  ylabel('Instantaneous radiative forcing (W/m2)')
67  grid on
68end
69
Note: See TracBrowser for help on using the repository browser.