source: trunk/src/mode_sahelien/read_pluie_ird.m @ 91

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

remove cd and copyfile

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