source: trunk/src/SIMULS_IRCAAM/prepare_olr_filtre_simulation.m @ 55

Last change on this file since 55 was 55, checked in by pinsard, 15 years ago

parametrisation of SIMULS_IRCAAM/progfiltrage_....f (modulo dimension); add makefile

File size: 3.4 KB
Line 
1function prepare_olr_filtre_simulation(ircaam_dataset,simulation)
2% prepare_olr_filtre_simulation ++explication ircaam_dataset,simulation
3%+
4% module
5% ======
6%
7% ce programme prepare les fichiers d'OLR de simulations IRCAAM CNRM
8% pour le programme de filtrage
9%
10% DESCRIPTION
11% ===========
12%
13% From rlut_d.\ *simulation*\ .197106-09.nc,
14% ``prepare_olr_filtre_simulation`` compute ++.
15%
16% ``prepare_olr_filtre_simulation`` write
17% olr_nofiltre_arpege_ \ *simulation*\ .dat.
18%
19% CAUTIONS
20% ========
21%
22% can't work with octave because of ncload.
23%
24% EXAMPLES
25% ========
26%
27% Following line read from ``rlut_d.AfNQIVIV.197106-09.nc`` to
28% ``rlut_d.AfNQIVIV.200006-09.nc``,
29% compute ++,
30% write ``olr_nofiltre_arpege_AfNQIVIV.dat``
31% ::
32%
33% >> prepare_olr_filtre_simulation('arpege','AfNQIVIV')
34%
35% SEE ALSO
36% ========
37%
38% carte_eof_df.m_
39%
40% .. _carte_eof_df.m : carte_eof_df.m.html
41%
42% TODO
43% ====
44%
45% improve description
46%
47% improve file pb
48%
49% use return function
50%
51% EVOLUTIONS
52% ==========
53%
54% $Id$
55%
56% - fplod 2009-02-04T09:40:31Z aedon.locean-ipsl.upmc.fr (Darwin)
57%   * force output to be written using EEE floating point with little-endian byte
58%     order
59% - fplod 2009-02-02T13:45:57Z aedon.locean-ipsl.upmc.fr (Darwin)
60%
61%   * created from prepare_olr_filtre_AFR.m to replace it as well as
62%     prepare_olr_filtre_AS.m, prepare_olr_filtre_CTL.m,
63%     prepare_olr_filtre_CTL_clim.m and prepare_olr_filtre_TR.m
64%
65%     Dataset ``arpege`` will be forced in output file names.
66%
67%     Simulation name will be add to output file names (see parameters).
68%
69%     1990 is added to years set.
70%-
71
72global IRCAAM_ID;
73global IRCAAM_OD;
74
75% force output to be written using EEE floating point with little-endian byte
76% order
77machineformat='l'
78
79if nargin==2
80 % ircaam_dataset must be equal to arpege
81 if ~strcmp(ircaam_dataset,'arpege')
82  disp(['ircaam_dataset = ', ircaam_dataset]);
83  error('eee : ircaam_dataset must be equal to arpege');
84 end
85 if strcmp(ircaam_dataset,'arpege')
86  list_simulation={'AfNQIVIV','TrNQIVIV','AsNQIVIV','CtIV','CtCl'};
87 end
88 switch simulation
89  case list_simulation
90   % ok
91  otherwise
92   disp(['simulation = ', simulation]);
93   disp(['list_simulation = ', mat2str(list_simulation)]);
94   error('eee : simulation must be equal to one of list_simulation');
95 end
96 clear list_simulation;
97else
98  usage='usage : prepare_olr_filtre_simulation(ircaam_dataset,simulation)';
99  disp(usage);
100  error('eee : wrong arguments numbers')
101end
102
103close all;
104
105iyearmin=1971;
106iyearmax=2000;
107nbyear=iyearmax-iyearmin+1;
108
109olr=zeros(122,nbyear,64,128);
110
111iiyear=0;
112for iyear=iyearmin:iyearmax
113 cyear=num2str(iyear);
114 fullfilename=[IRCAAM_ID,'rlut_d.',simulation,'.',cyear,'06-09.nc'];
115 ncload(fullfilename,'rlut');
116 clear fullfilename;
117 iiyear=iiyear+1;
118 olr(:,iiyear,:,:)=rlut;
119 clear rlut;
120end;
121
122% selection du domaine geographique
123olr1=zeros(122,nbyear,64,128);
124olr1(:,:,:,1:64)=olr(:,:,:,65:128);
125olr1(:,:,:,65:128)=olr(:,:,:,1:64);
126clear olr;
127olr=olr1;
128clear olr1;
129olr=olr(:,:,29:43,54:77);
130tps=size(olr,1)*size(olr,2);
131olr=reshape(olr,tps,15,24);
132olr=permute(olr,[3 2 1]);
133olr=reshape(olr,360,tps);
134
135switch simulation
136 case {'CtIV','CtCl'}
137  % nothing
138 otherwise
139  for a=1:360;
140   clear vaude;
141   vaude=olr(a,:);
142   vaude=vaude';
143   vaude=mean(vaude);
144   olr(a,:)=olr(a,:)-vaude;
145  end;
146end
147
148fullfilename=[IRCAAM_OD,'olr_nofiltre_',ircaam_dataset,'_', simulation, '.dat'];
149fid=fopen(fullfilename,'w',machineformat);
150clear fullfilename;
151fwrite(fid,olr,'float');
152fclose(fid);
Note: See TracBrowser for help on using the repository browser.