source: trunk/src/essai2.m @ 327

Last change on this file since 327 was 327, checked in by pinsard, 13 years ago

change svn properties

  • Property svn:keywords set to URL
File size: 3.4 KB
Line 
1%+
2%
3% .. _essai2.m:
4%
5% ========
6% essai2.m
7% ========
8%
9% DESCRIPTION
10% ===========
11%
12% EVOLUTIONS
13% ==========
14%
15% $Id$
16%
17% $URL$
18%
19% - fplod 20110805T140251Z cratos (Linux)
20%
21%   * " is invalid in matlab
22%
23% - fplod 20110705T125628Z cratos.locean-ipsl.upmc.fr (Linux)
24%
25%   * minimal header
26%
27%-
28
29mfilename
30ifigure=1;
31ifigue=ifigure+1;
32figure(ifigure);
33%nl=3;
34%nc=3;
35precip_journaliere=load('velingra_q_1961-2000.xsl.csv');
36% initialise les annee
37domaine_an=1961:2000;
38nban=size(domaine_an,2);
39% initialise le tableau des mois pour chaque annee
40domaine_month=1:12;
41nbmonth=size(domaine_month,2);
42nbdecad=3;
43% initialise le tableau contenant les sommes par decade
44% pour chaques mois de  toutes les annee
45sumdecad=zeros(nban,nbdecad*nbmonth);
46xdata=zeros(nbdecad*nbmonth);
47% boucle sur les annees
48for ian=1:nban;
49   % boucle sur les mois et sur les decads
50   for imonth=domaine_month;
51      for idecad=1:3;
52          ndecad=(imonth-1)*nbdecad+idecad;
53          ijour=(idecad-1)*10+1;
54          xdata(ndecad)=datenum(ian+1961-1,imonth,ijour);
55          a=(idecad-1)*10+3;
56          b=(idecad-1)*10+12;
57       if (idecad < 3);
58            cmin=a;
59            cmax=b;
60       else
61            cmin=a;
62            cmax=b+1;
63      % calcul de la ligne contenant les precipitations du mois
64      % courant/annee courante
65      iligne=imonth+((ian-1)*12);
66            if (iligne <= size(precip_journaliere,1));
67                sumdecad(ian,ndecad)=sum(precip_journaliere(iligne,cmin:cmax));
68            end
69       end
70     end
71   end
72     start_date=datenum(ian+1961-1,1,1);
73     end_date=datenum(ian+1961-1,12,31);
74                   % for imonth=1:12;
75                   %     for idecad=1:3;
76                    %         ndecad=(imonth-1)*nbdecad+idecad;
77                    %         sumdecad(ndecad)=sum(meandecad(precip_journaliere(1:36)));
78                     %        ijour=(idecad-1)*10+1;
79                     %       xdata(ndecad)=datenum(imonth,ijour);
80                       % end
81                    %end
82 % ++todo+++ subplot(nl,nc,(ian+1)-1961);
83   % dessine les precipitations des sommes partielles  decadaires de chaque mois   % de l'annee courante
84   % chgt de dimension de sumdecad de 3 à 1 pour dessin
85   % y3d=sumdecad(ian,:,:);
86   % y1d=reshape(y3d,1,nbmonth*nbdecad);
87    % whos y1d
88    % x=1:nbmonth*nbdecad;
89   % whos x
90  % ifigure=ifigure+1;
91   %figure(ifigure);
92 %  plot(xdata(:,1),sumdecad(ian,:),'x');
93  % set x values were we want tick:one tick for month
94  % xticklabel=datestr(xdata,2);
95  % set(gca,'xtick',xdata);
96  % set(gca,'xticklabel',xticklabel);
97  % xlabel(['domaine-month of the year' num2str(ian)]);
98  % ylabel('sumdecad(precip-journaliere) (mm)');
99 % title("sum decadaire of velingra precipitation");
100end
101% calcul du cycle annuel moyen
102moydecad=zeros(nbmonth*nbdecad);
103% boucle sur les decads
104for idecad=1:nbdecad*nbmonth;
105    moy(idecad)=mean(sumdecad(1:nban,idecad));
106    ijour=(idecad-1)*10+1;
107    xdata(idecad)=datenum(1961,imonth,ijour);
108end
109
110   % ifigue=ifigure+1;
111    ifigure=1;
112    plot(xdata(:,1),moy,'-');
113   % set x values were we want tick:one tick for decad of month
114    xticklabel=datestr(xdata,1);
115    % tous les 10 jours de chaque mois de chaque année
116    %xtick=start_date:10:end_date;
117    set(gca,'xtick',xdata);
118    set(gca,'xticklabel',xticklabel);
119    xlabel(['decad of the year' num2str(ian)]);
120    ylabel('mean(sumdecad(precip-journaliere)) (mm)');
121    title('mean(sumdecad) of velingra precipitation');
122
Note: See TracBrowser for help on using the repository browser.