1 | function 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-10T15:54:57Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
57 | % |
---|
58 | % * force output to be written using IEEE floating point 32 bits |
---|
59 | % |
---|
60 | % - fplod 2009-02-04T09:40:31Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
61 | % |
---|
62 | % * force output to be written using IEEE floating point with little-endian |
---|
63 | % byte order |
---|
64 | % |
---|
65 | % - fplod 2009-02-02T13:45:57Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
66 | % |
---|
67 | % * created from prepare_olr_filtre_AFR.m to replace it as well as |
---|
68 | % prepare_olr_filtre_AS.m, prepare_olr_filtre_CTL.m, |
---|
69 | % prepare_olr_filtre_CTL_clim.m and prepare_olr_filtre_TR.m |
---|
70 | % |
---|
71 | % Dataset ``arpege`` will be forced in output file names. |
---|
72 | % |
---|
73 | % Simulation name will be add to output file names (see parameters). |
---|
74 | % |
---|
75 | % 1990 is added to years set. |
---|
76 | %- |
---|
77 | |
---|
78 | global IRCAAM_ID; |
---|
79 | global IRCAAM_OD; |
---|
80 | |
---|
81 | % force output to be written using IEEE floating point with little-endian byte |
---|
82 | % order |
---|
83 | machineformat='l' |
---|
84 | |
---|
85 | if nargin==2 |
---|
86 | % ircaam_dataset must be equal to arpege |
---|
87 | if ~strcmp(ircaam_dataset,'arpege') |
---|
88 | disp(['ircaam_dataset = ', ircaam_dataset]); |
---|
89 | error('eee : ircaam_dataset must be equal to arpege'); |
---|
90 | end |
---|
91 | if strcmp(ircaam_dataset,'arpege') |
---|
92 | list_simulation={'AfNQIVIV','TrNQIVIV','AsNQIVIV','CtIV','CtCl'}; |
---|
93 | end |
---|
94 | switch simulation |
---|
95 | case list_simulation |
---|
96 | % ok |
---|
97 | otherwise |
---|
98 | disp(['simulation = ', simulation]); |
---|
99 | disp(['list_simulation = ', mat2str(list_simulation)]); |
---|
100 | error('eee : simulation must be equal to one of list_simulation'); |
---|
101 | end |
---|
102 | clear list_simulation; |
---|
103 | else |
---|
104 | usage='usage : prepare_olr_filtre_simulation(ircaam_dataset,simulation)'; |
---|
105 | disp(usage); |
---|
106 | error('eee : wrong arguments numbers') |
---|
107 | end |
---|
108 | |
---|
109 | close all; |
---|
110 | |
---|
111 | iyearmin=1971; |
---|
112 | iyearmax=2000; |
---|
113 | nbyear=iyearmax-iyearmin+1; |
---|
114 | |
---|
115 | olr=zeros(122,nbyear,64,128); |
---|
116 | |
---|
117 | iiyear=0; |
---|
118 | for iyear=iyearmin:iyearmax |
---|
119 | cyear=num2str(iyear); |
---|
120 | fullfilename=[IRCAAM_ID,'rlut_d.',simulation,'.',cyear,'06-09.nc']; |
---|
121 | ncload(fullfilename,'rlut'); |
---|
122 | clear fullfilename; |
---|
123 | iiyear=iiyear+1; |
---|
124 | olr(:,iiyear,:,:)=rlut; |
---|
125 | clear rlut; |
---|
126 | end; |
---|
127 | |
---|
128 | % selection du domaine geographique |
---|
129 | olr1=zeros(122,nbyear,64,128); |
---|
130 | olr1(:,:,:,1:64)=olr(:,:,:,65:128); |
---|
131 | olr1(:,:,:,65:128)=olr(:,:,:,1:64); |
---|
132 | clear olr; |
---|
133 | olr=olr1; |
---|
134 | clear olr1; |
---|
135 | olr=olr(:,:,29:43,54:77); |
---|
136 | tps=size(olr,1)*size(olr,2); |
---|
137 | olr=reshape(olr,tps,15,24); |
---|
138 | olr=permute(olr,[3 2 1]); |
---|
139 | olr=reshape(olr,360,tps); |
---|
140 | |
---|
141 | switch simulation |
---|
142 | case {'CtIV','CtCl'} |
---|
143 | % nothing |
---|
144 | otherwise |
---|
145 | for a=1:360; |
---|
146 | clear vaude; |
---|
147 | vaude=olr(a,:); |
---|
148 | vaude=vaude'; |
---|
149 | vaude=mean(vaude); |
---|
150 | olr(a,:)=olr(a,:)-vaude; |
---|
151 | end; |
---|
152 | end |
---|
153 | |
---|
154 | fullfilename=[IRCAAM_OD,'olr_nofiltre_',ircaam_dataset,'_', simulation, '.dat']; |
---|
155 | fid=fopen(fullfilename,'w',machineformat); |
---|
156 | clear fullfilename; |
---|
157 | fwrite(fid,olr,'float32'); |
---|
158 | fclose(fid); |
---|