source: trunk/src/mode_sahelien/read_pluie_ird_25.m @ 18

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

squeeze multiple blank lines

File size: 5.6 KB
Line 
1%
2
3%%%%%%%%%%%%%%% FICHIER pluie IRD
4% ouverture / lecture du fichier
5clear;
6close all;
7cd('Pluie_ird_25');
8
9% on selectionne les mois d ete (attention aux annees bixestiles!)
10
11siz1=31+28+31+30+31+1;
12siz1bis=31+28+31+30+31+30+31+31+30;
13pluie=zeros(41,17,122,12);
14
15clear v fid; fid=fopen('pluvio.79.haut','r','b'); siz=41*17*365;
16v=fread(fid,siz,'float'); fclose(fid);
17v=reshape(v,41,17,365);
18clear a b c;
19for a=1:41;
20   for b=1:17;
21       for c=1:365;
22          if v(a,b,c)>990;
23              v(a,b,c)=NaN;
24          elseif v(a,b,c)<0;
25              v(a,b,c)=NaN;
26          end;
27       end;
28   end;
29end;
30pluie(:,:,:,1)=v(:,:,siz1:siz1bis); % 1979
31
32clear v fid; fid=fopen('pluvio.80.haut','r','b'); siz=41*17*366;
33v=fread(fid,siz,'float'); fclose(fid);
34v=reshape(v,41,17,366);
35clear a b c;
36for a=1:41;
37   for b=1:17;
38       for c=1:366;
39          if v(a,b,c)>990;
40              v(a,b,c)=NaN;
41          elseif v(a,b,c)<0;
42              v(a,b,c)=NaN;
43          end;
44       end;
45   end;
46end;
47pluie(:,:,:,2)=v(:,:,siz1+1:siz1bis+1); % 1980
48
49clear v fid; fid=fopen('pluvio.81.haut','r','b'); siz=41*17*365;
50v=fread(fid,siz,'float'); fclose(fid);
51v=reshape(v,41,17,365);
52clear a b c;
53for a=1:41;
54   for b=1:17;
55       for c=1:365;
56          if v(a,b,c)>990;
57              v(a,b,c)=NaN;
58          elseif v(a,b,c)<0;
59              v(a,b,c)=NaN;
60          end;
61       end;
62   end;
63end;
64pluie(:,:,:,3)=v(:,:,siz1:siz1bis); % 1981
65
66clear v fid; fid=fopen('pluvio.82.haut','r','b'); siz=41*17*365;
67v=fread(fid,siz,'float'); fclose(fid);
68v=reshape(v,41,17,365);
69clear a b c;
70for a=1:41;
71   for b=1:17;
72       for c=1:365;
73          if v(a,b,c)>990;
74              v(a,b,c)=NaN;
75          elseif v(a,b,c)<0;
76              v(a,b,c)=NaN;
77          end;
78       end;
79   end;
80end;
81pluie(:,:,:,4)=v(:,:,siz1:siz1bis); % 1982
82
83clear v fid; fid=fopen('pluvio.83.haut','r','b'); siz=41*17*365;
84v=fread(fid,siz,'float'); fclose(fid);
85v=reshape(v,41,17,365);
86clear a b c;
87for a=1:41;
88   for b=1:17;
89       for c=1:365;
90          if v(a,b,c)>990;
91              v(a,b,c)=NaN;
92          elseif v(a,b,c)<0;
93              v(a,b,c)=NaN;
94          end;
95       end;
96   end;
97end;
98
99pluie(:,:,:,5)=v(:,:,siz1:siz1bis); % 1983
100
101clear v fid; fid=fopen('pluvio.84.haut','r','b'); siz=41*17*366;
102v=fread(fid,siz,'float'); fclose(fid);
103v=reshape(v,41,17,366);
104clear a b c;
105for a=1:41;
106   for b=1:17;
107       for c=1:366;
108          if v(a,b,c)>990;
109              v(a,b,c)=NaN;
110          elseif v(a,b,c)<0;
111              v(a,b,c)=NaN;
112          end;
113       end;
114   end;
115end;
116pluie(:,:,:,6)=v(:,:,siz1+1:siz1bis+1); % 1984
117
118clear v fid; fid=fopen('pluvio.85.haut','r','b'); siz=41*17*365;
119v=fread(fid,siz,'float'); fclose(fid);
120v=reshape(v,41,17,365);
121clear a b c;
122for a=1:41;
123   for b=1:17;
124       for c=1:365;
125          if v(a,b,c)>990;
126              v(a,b,c)=NaN;
127          elseif v(a,b,c)<0;
128              v(a,b,c)=NaN;
129          end;
130       end;
131   end;
132end;
133pluie(:,:,:,7)=v(:,:,siz1:siz1bis); % 1985
134
135clear v fid; fid=fopen('pluvio.86.haut','r','b'); siz=41*17*365;
136v=fread(fid,siz,'float'); fclose(fid);
137v=reshape(v,41,17,365);
138clear a b c;
139for a=1:41;
140   for b=1:17;
141       for c=1:365;
142          if v(a,b,c)>990;
143              v(a,b,c)=NaN;
144          elseif v(a,b,c)<0;
145              v(a,b,c)=NaN;
146          end;
147       end;
148   end;
149end;
150pluie(:,:,:,8)=v(:,:,siz1:siz1bis); % 1986
151
152clear v fid; fid=fopen('pluvio.87.haut','r','b'); siz=41*17*365;
153v=fread(fid,siz,'float'); fclose(fid);
154v=reshape(v,41,17,365);
155clear a b c;
156for a=1:41;
157   for b=1:17;
158       for c=1:365;
159          if v(a,b,c)>990;
160              v(a,b,c)=NaN;
161          elseif v(a,b,c)<0;
162              v(a,b,c)=NaN;
163          end;
164       end;
165   end;
166end;
167pluie(:,:,:,9)=v(:,:,siz1:siz1bis); % 1987
168
169clear v fid; fid=fopen('pluvio.88.haut','r','b'); siz=41*17*366;
170v=fread(fid,siz,'float'); fclose(fid);
171v=reshape(v,41,17,366);
172clear a b c;
173for a=1:41;
174   for b=1:17;
175       for c=1:366;
176          if v(a,b,c)>990;
177              v(a,b,c)=NaN;
178          elseif v(a,b,c)<0;
179              v(a,b,c)=NaN;
180          end;
181       end;
182   end;
183end;
184pluie(:,:,:,10)=v(:,:,siz1:siz1bis); % 1988
185
186clear v fid; fid=fopen('pluvio.89.haut','r','b'); siz=41*17*365;
187v=fread(fid,siz,'float'); fclose(fid);
188v=reshape(v,41,17,365);
189clear a b c;
190for a=1:41;
191   for b=1:17;
192       for c=1:365;
193          if v(a,b,c)>990;
194              v(a,b,c)=NaN;
195          elseif v(a,b,c)<0;
196              v(a,b,c)=NaN;
197          end;
198       end;
199   end;
200end;
201pluie(:,:,:,11)=v(:,:,siz1:siz1bis); % 1989
202
203clear v fid; fid=fopen('pluvio.90.haut','r','b'); siz=41*17*365;
204v=fread(fid,siz,'float'); fclose(fid);
205v=reshape(v,41,17,365);
206clear a b c;
207for a=1:41;
208   for b=1:17;
209       for c=1:365;
210          if v(a,b,c)>990;
211              v(a,b,c)=NaN;
212          elseif v(a,b,c)<0;
213              v(a,b,c)=NaN;
214          end;
215       end;
216   end;
217end;
218pluie(:,:,:,12)=v(:,:,siz1:siz1bis); % 1990
219
220clear siz sizbis;
221clear v;
222cd('..');
223% essai de visualisation d'une carte de pluie annuelle
224orient('landscape');
225lat=[-10:2.5:30];
226lon=[-70:2.5:30]';
227for a=1:12;
228   subplot(3,4,a);
229   clear v;
230   v(:,:,:)=pluie(:,:,:,a);
231   v=permute(v,[3 2 1]);
232   v1=zeros(17,41);
233   v1(:,:)=nansum(v);
234   for b=1:17;
235      for c=1:41;
236         if v1(b,c)>3000;
237           v1(b,c)=3000;
238         end
239      end;
240   end;
241   palette3;
242   v1(1,1)=3000.1;
243   contourf(lon,lat,v1,[0:200:3000],'LineStyle','none');
244   colorbar;
245   hold on;
246   cartemonde;
247   axis equal;
248   axis([-20 26 0 23]);
249   set (gca,'tickDir','out');
250   set (gca,'XTick',[-20:10:20],'XTickLabel',['20W';'10W';' 0 ';'10E';'20E'],'fontname','Arial','fontsize',6);
251   set (gca,'YTick',[0:10:20],'YTickLabel',['  0';'10N';'20N'],'fontname','Arial','fontsize',6);
252end;
253print -depsc2 pluie_ird_25_degres.eps;
Note: See TracBrowser for help on using the repository browser.