1 | function eof_df(ircaam_dataset,simulation,period1, period2) |
---|
2 | % eof_df ++explication between period1 days and period2 days |
---|
3 | |
---|
4 | %+ |
---|
5 | % |
---|
6 | % .. _eof_df.m: |
---|
7 | % |
---|
8 | % ======== |
---|
9 | % eof_df.m |
---|
10 | % ======== |
---|
11 | % |
---|
12 | % ++ |
---|
13 | % |
---|
14 | % DESCRIPTION |
---|
15 | % =========== |
---|
16 | % |
---|
17 | % From :file:`olrf_arpege_{simulation}_{period1}-{period2}d.80.dat`, |
---|
18 | % ``eof_df`` compute ++. |
---|
19 | % |
---|
20 | % 1 Postscript file |
---|
21 | % ;file:`eof_arpege_{simulation}_{period1}-{period2}d.eps` is |
---|
22 | % written. |
---|
23 | % |
---|
24 | % EXAMPLES |
---|
25 | % ======== |
---|
26 | % |
---|
27 | % Following line read :file:`eof_arpege_AfNQIVIV_10-30d.80.dat`, |
---|
28 | % compute ++, |
---|
29 | % write :file:`eof_arpege_AfNQIVIV_10-30d.eps`:: |
---|
30 | % |
---|
31 | % >> eof_df('arpege','AfNQIVIV',10,30) |
---|
32 | % |
---|
33 | % SEE ALSO |
---|
34 | % ======== |
---|
35 | % |
---|
36 | % :ref:`carte_eof_df.m` |
---|
37 | % |
---|
38 | % :ref:`time_serie_eof_df.m` |
---|
39 | % |
---|
40 | % TODO |
---|
41 | % ==== |
---|
42 | % |
---|
43 | % improve description |
---|
44 | % |
---|
45 | % improve file pb |
---|
46 | % |
---|
47 | % use return function |
---|
48 | % |
---|
49 | % EVOLUTIONS |
---|
50 | % ========== |
---|
51 | % |
---|
52 | % $Id$ |
---|
53 | % |
---|
54 | % - fplod 2009-02-11T16:27:34Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
55 | % |
---|
56 | % * add try/catch on opening file for reading |
---|
57 | % |
---|
58 | % - fplod 2009-02-10T14:28:00Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
59 | % |
---|
60 | % * replace ndmin by period1 and ndmax by period2 |
---|
61 | % |
---|
62 | % - fplod 2009-02-02T13:45:57Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
63 | % |
---|
64 | % * created from eof_ircaam_1030.m .m to replace it as well as |
---|
65 | % eof_olr_ircaam_1030_as.m, eof_olr_ircaam_1030_ctl.m, |
---|
66 | % eof_olr_ircaam_1030_ctl_clim.m, eof_olr_ircaam_1030_tr.m, |
---|
67 | % eof_olr_ircaam_30100.m, eof_olr_ircaam_30100_as.m, eof_olr_ircaam_30100_ctl.m |
---|
68 | % and eof_olr_ircaam_30100_tr.m |
---|
69 | % |
---|
70 | % Days will be now written ``period1``\-``period2d`` (ex: 10-30d) in filenames. |
---|
71 | % |
---|
72 | % Dataset ``arpege`` will be forced in output file names. |
---|
73 | % |
---|
74 | % |
---|
75 | %- |
---|
76 | |
---|
77 | global IRCAAM_ID; |
---|
78 | global IRCAAM_OD; |
---|
79 | |
---|
80 | if nargin==4 |
---|
81 | % ircaam_dataset must be equal to arpege |
---|
82 | if ~strcmp(ircaam_dataset,'arpege') |
---|
83 | disp(['ircaam_dataset = ', ircaam_dataset]); |
---|
84 | error('eee : ircaam_dataset must be equal to arpege'); |
---|
85 | end |
---|
86 | if strcmp(ircaam_dataset,'arpege') |
---|
87 | list_simulation={'AfNQIVIV','TrNQIVIV','AsNQIVIV','CtIV','CtCl'}; |
---|
88 | end |
---|
89 | switch simulation |
---|
90 | case list_simulation |
---|
91 | % ok |
---|
92 | otherwise |
---|
93 | disp(['simulation = ', simulation]); |
---|
94 | disp(['list_simulation = ', mat2str(list_simulation)]); |
---|
95 | error('eee : simulation must be equal to one of list_simulation'); |
---|
96 | end |
---|
97 | clear list_simulation; |
---|
98 | % period1 must be lower than period2 |
---|
99 | if (period1 > period2) |
---|
100 | disp(['period1 = ', int2str(period1)]); |
---|
101 | disp(['period2 = ', int2str(period2)]); |
---|
102 | error('eee : period1 must be lower than period2'); |
---|
103 | end |
---|
104 | else |
---|
105 | usage='usage : eof_df(ircaam_dataset,simulation,period1, period2)'; |
---|
106 | disp(usage); |
---|
107 | error('eee : wrong arguments numbers') |
---|
108 | end |
---|
109 | |
---|
110 | % period1 and period2 will be used in xx-yyd form in filenames |
---|
111 | df = [int2str(period1),'-',int2str(period2),'d']; |
---|
112 | clear period1; |
---|
113 | clear period2; |
---|
114 | |
---|
115 | close all; |
---|
116 | |
---|
117 | fullfilename=[IRCAAM_ID,'olrf_',ircaam_dataset,'_', simulation, '_', df, '.80.dat']; |
---|
118 | try |
---|
119 | fid=fopen(fullfilename,'r'); |
---|
120 | catch |
---|
121 | error('eee : File %s not found\n', fullfilename); |
---|
122 | end |
---|
123 | clear fullfilename; |
---|
124 | siz=24*15*3538; |
---|
125 | v=fread(fid,siz,'float'); |
---|
126 | fclose(fid); |
---|
127 | olr=reshape(v,360,3538); |
---|
128 | clear v; |
---|
129 | |
---|
130 | % calcul de la matrice de covariance |
---|
131 | vaudou=zeros(360,360); |
---|
132 | for a=1:360; |
---|
133 | for b=1:360; |
---|
134 | clear e d covaria; |
---|
135 | e=olr(b,:); |
---|
136 | d=olr(a,:); |
---|
137 | covaria=cov(e,d); |
---|
138 | vaudou(a,b)=covaria(2,1); |
---|
139 | end; |
---|
140 | end; |
---|
141 | |
---|
142 | % on diagonalise la matrice de covariance |
---|
143 | [C,L]=eig(vaudou); |
---|
144 | |
---|
145 | fullfilename=[IRCAAM_OD,'eof_',ircaam_dataset,'_', simulation, '_', df, '.mat']; |
---|
146 | delete(fullfilename); |
---|
147 | save(fullfilename,'C','L','olr'); |
---|
148 | clear fullfilename; |
---|