[53] | 1 | function prepare_olr_filtre_simulation(ircaam_dataset,simulation) |
---|
| 2 | % prepare_olr_filtre_simulation ++explication ircaam_dataset,simulation |
---|
| 3 | %+ |
---|
| 4 | % module |
---|
| 5 | % ====== |
---|
[16] | 6 | % |
---|
[10] | 7 | % ce programme prepare les fichiers d'OLR de simulations IRCAAM CNRM |
---|
| 8 | % pour le programme de filtrage |
---|
[53] | 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 | % |
---|
[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 |
---|
[53] | 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 | %- |
---|
[10] | 71 | |
---|
[53] | 72 | global IRCAAM_ID; |
---|
| 73 | global IRCAAM_OD; |
---|
[10] | 74 | |
---|
[55] | 75 | % force output to be written using EEE floating point with little-endian byte |
---|
| 76 | % order |
---|
| 77 | machineformat='l' |
---|
| 78 | |
---|
[53] | 79 | if 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; |
---|
| 97 | else |
---|
| 98 | usage='usage : prepare_olr_filtre_simulation(ircaam_dataset,simulation)'; |
---|
| 99 | disp(usage); |
---|
| 100 | error('eee : wrong arguments numbers') |
---|
| 101 | end |
---|
[10] | 102 | |
---|
[53] | 103 | close all; |
---|
[10] | 104 | |
---|
[53] | 105 | iyearmin=1971; |
---|
| 106 | iyearmax=2000; |
---|
| 107 | nbyear=iyearmax-iyearmin+1; |
---|
[10] | 108 | |
---|
[53] | 109 | olr=zeros(122,nbyear,64,128); |
---|
[10] | 110 | |
---|
[53] | 111 | iiyear=0; |
---|
| 112 | for 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; |
---|
| 120 | end; |
---|
[10] | 121 | |
---|
[53] | 122 | % selection du domaine geographique |
---|
| 123 | olr1=zeros(122,nbyear,64,128); |
---|
[10] | 124 | olr1(:,:,:,1:64)=olr(:,:,:,65:128); |
---|
| 125 | olr1(:,:,:,65:128)=olr(:,:,:,1:64); |
---|
[21] | 126 | clear olr; |
---|
[16] | 127 | olr=olr1; |
---|
| 128 | clear olr1; |
---|
[10] | 129 | olr=olr(:,:,29:43,54:77); |
---|
[53] | 130 | tps=size(olr,1)*size(olr,2); |
---|
| 131 | olr=reshape(olr,tps,15,24); |
---|
[10] | 132 | olr=permute(olr,[3 2 1]); |
---|
[53] | 133 | olr=reshape(olr,360,tps); |
---|
| 134 | |
---|
| 135 | switch 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; |
---|
| 146 | end |
---|
| 147 | |
---|
| 148 | fullfilename=[IRCAAM_OD,'olr_nofiltre_',ircaam_dataset,'_', simulation, '.dat']; |
---|
[55] | 149 | fid=fopen(fullfilename,'w',machineformat); |
---|
[53] | 150 | clear fullfilename; |
---|
[10] | 151 | fwrite(fid,olr,'float'); |
---|
| 152 | fclose(fid); |
---|