source: LMDZ6/trunk/libf/phylmd/ecrad/test/ckdmip/calc_hr_error.m

Last change on this file was 4773, checked in by idelkadi, 9 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: 783 bytes
Line 
1% Compute RMS error in heating rate, in K d-1, weighting by the
2% cube-root of pressure, where pressure arguments are in hPa
3function err = calc_hr_error(pressure_hl, hr, hr_ref, pressure_range);
4
5  % If final argument not provided, consider all pressure ranges
6  if nargin < 4
7    pressure_range = [0 Inf];
8  end
9
10  mypow = (1./3);
11 
12  pressure_fl = 0.5.*(pressure_hl(1:end-1,:) + pressure_hl(2:end,:));
13  weight = (pressure_hl(2:end,:)).^mypow - (pressure_hl(1:end-1,:)).^mypow;
14
15  index = find(pressure_fl < pressure_range(1) | pressure_fl >= pressure_range(2));
16  if ~isempty(index)
17    weight(index) = 0;
18  end
19  nprof = size(weight,2);
20  for ii = 1:nprof
21    weight(:,ii) = weight(:,ii) ./ sum(weight(:,ii));
22  end
23  err = sqrt(sum(weight(:) .* (hr(:)-hr_ref(:)).^2)./nprof);
Note: See TracBrowser for help on using the repository browser.