source: LMDZ6/branches/LMDZ_ECRad/libf/phylmd/ecrad/test/ckdmip/flatten_sza.m @ 4993

Last change on this file since 4993 was 4728, checked in by idelkadi, 11 months ago

Update of ecrad in the LMDZ_ECRad branch of LMDZ:

  • version 1.6.1 of ecrad
  • files are no longer grouped in the same ecrad directory.
  • the structure of ecrad offline is preserved to facilitate updating in LMDZ
  • cfg.bld modified to take into account the new added subdirectories.
  • the interface routines and those added in ecrad are moved to the phylmd directory
File size: 1.6 KB
Line 
1function out = flatten_sza(in, isza)
2% Flatten the solar-zenith-angle and column dimensions
3
4if nargin < 2
5  isza = 1:length(in.mu0);
6end
7nsza = length(isza);
8
9ncol = size(in.pressure_hl,2);
10nz = size(in.pressure_hl,1);
11
12out.pressure_hl = in.pressure_hl(:,ceil([1:nsza*ncol]./nsza));
13if isfield(out,'temperature_hl')
14  out.temperature_hl = in.temperature_hl(:,ceil([1:nsza*ncol]./nsza));
15end
16out.mu0 = repmat(in.mu0(isza), ncol, 1);
17%out.reference_surface_mole_fraction = in.reference_surface_mole_fraction;
18%out.mole_fraction_fl = in.mole_fraction_fl(:,:,ceil([1:nsza*ncol]./nsza));
19out.flux_up_sw = reshape(in.flux_up_sw(:,isza,:),[nz nsza*ncol]);
20out.flux_dn_sw = reshape(in.flux_dn_sw(:,isza,:),[nz nsza*ncol]);
21out.flux_dn_direct_sw = reshape(in.flux_dn_direct_sw(:,isza,:),[nz nsza*ncol]);
22if isfield(in, 'band_flux_up_sw')
23  nband = size(in.band_flux_up_sw,1);
24  out.band_wavenumber1_sw = in.band_wavenumber1_sw;
25  out.band_wavenumber2_sw = in.band_wavenumber2_sw;
26  out.band_flux_up_sw = reshape(in.band_flux_up_sw(:,:,isza,:),[nband nz nsza*ncol]);
27  out.band_flux_dn_sw = reshape(in.band_flux_dn_sw(:,:,isza,:),[nband nz nsza*ncol]);
28  out.band_flux_dn_direct_sw = reshape(in.band_flux_dn_direct_sw(:,:,isza,:),[nband nz nsza*ncol]);
29end
30if isfield(in, 'spectral_flux_up_sw')
31  nspectral = size(in.spectral_flux_up_sw,1);
32  out.spectral_flux_up_sw = reshape(in.spectral_flux_up_sw(:,:,isza,:),[nspectral nz nsza*ncol]);
33  out.spectral_flux_dn_sw = reshape(in.spectral_flux_dn_sw(:,:,isza,:),[nspectral nz nsza*ncol]);
34  out.spectral_flux_dn_direct_sw = reshape(in.spectral_flux_dn_direct_sw(:,:,isza,:),[nspectral nz nsza*ncol]);
35end
36
37
Note: See TracBrowser for help on using the repository browser.