% %%%%%%%%%%%%%%% FICHIER pluie IRD % ouverture / lecture du fichier clear; close all; % on selectionne les mois d ete (attention aux annees bixestiles!) siz1=31+28+31+30+31+1; siz1bis=31+28+31+30+31+30+31+31+30; pluie=zeros(47,24,122,12); clear v fid; fid=fopen('daily1.79.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)>99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,1)=v(:,:,siz1:siz1bis); % 1979 clear v fid; fid=fopen('daily1.80.rain','r'); siz=47*24*366; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,366); clear a b c; for a=1:47; for b=1:24; for c=1:366; if v(a,b,c)>99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,2)=v(:,:,siz1+1:siz1bis+1); % 1980 clear v fid; fid=fopen('daily1.81.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)>99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,3)=v(:,:,siz1:siz1bis); % 1981 clear v fid; fid=fopen('daily1.82.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)>99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,4)=v(:,:,siz1:siz1bis); % 1982 clear v fid; fid=fopen('daily1.83.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)>99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,5)=v(:,:,siz1:siz1bis); % 1983 clear v fid; fid=fopen('daily1.84.rain','r'); siz=47*24*366; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,366); clear a b c; for a=1:47; for b=1:24; for c=1:366; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,6)=v(:,:,siz1+1:siz1bis+1); % 1984 clear v fid; fid=fopen('daily1.85.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:366; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,7)=v(:,:,siz1:siz1bis); % 1985 clear v fid; fid=fopen('daily1.86.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,8)=v(:,:,siz1:siz1bis); % 1986 clear v fid; fid=fopen('daily1.87.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,9)=v(:,:,siz1:siz1bis); % 1987 clear v fid; fid=fopen('daily1.88.rain','r'); siz=47*24*366; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,366); clear a b c; for a=1:47; for b=1:24; for c=1:366; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,10)=v(:,:,siz1:siz1bis); % 1988 clear v fid; fid=fopen('daily1.89.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,11)=v(:,:,siz1:siz1bis); % 1989 clear v fid; fid=fopen('daily1.90.rain','r'); siz=47*24*365; v=fread(fid,siz,'float'); fclose(fid); v=reshape(v,47,24,365); clear a b c; for a=1:47; for b=1:24; for c=1:365; if v(a,b,c)==999.99; v(a,b,c)=NaN; elseif v(a,b,c)<0; v(a,b,c)=NaN; end; end; end; end; pluie(:,:,:,12)=v(:,:,siz1:siz1bis); % 1990 clear siz sizbis; clear v; % essai de visualisation d'une carte de pluie annuelle orient('landscape'); lat=[0:23]; lon=[-20:26]'; for a=1:12; subplot(3,4,a); clear v; v(:,:,:)=pluie(:,:,:,a); v=permute(v,[3 2 1]); v1(:,:)=nansum(v); contourf(lon,lat,v1); colorbar; hold on; cartemonde; axis([-20 26 0 23]); end;