1 | % |
---|
2 | %+ |
---|
3 | % |
---|
4 | % .. _cumul_precip.m: |
---|
5 | % |
---|
6 | % ============== |
---|
7 | % cumul_precip.m |
---|
8 | % ============== |
---|
9 | % |
---|
10 | % DESCRIPTION |
---|
11 | % =========== |
---|
12 | % |
---|
13 | % EVOLUTIONS |
---|
14 | % ========== |
---|
15 | % |
---|
16 | % $Id$ |
---|
17 | % |
---|
18 | % $URL$ |
---|
19 | % |
---|
20 | % - fplod 20110805T140121Z cratos (Linux) |
---|
21 | % |
---|
22 | % * " is not valid in matlab |
---|
23 | % - fplod 20110705T125628Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
24 | % |
---|
25 | % * minimal header |
---|
26 | % |
---|
27 | %- |
---|
28 | mfilename |
---|
29 | %ifigure=1; |
---|
30 | %ifigue=ifigure+1; |
---|
31 | %figure(ifigure); |
---|
32 | %nl=3; |
---|
33 | %nc=3; |
---|
34 | precip_journaliere=load('velingra_q_1961-2000.xsl.csv'); |
---|
35 | % initialise le tableau des mois pour chaque annee |
---|
36 | domaine_month=1:12; |
---|
37 | nbmonth=size(domaine_month,2); |
---|
38 | % initialise le tableau contenant le cumul journalier |
---|
39 | % pour l'annee choisie |
---|
40 | cumulyear=zeros(365); |
---|
41 | xdata=zeros(365); |
---|
42 | % choix de l'annee |
---|
43 | nban=1995; |
---|
44 | lignes=find(precip_journaliere(:,1)<nban); |
---|
45 | |
---|
46 | % boucle sur les mois et sur les mois |
---|
47 | imonth=1; |
---|
48 | % calcul de la ligne contenant les precipitations du mois |
---|
49 | iligne=imonth+max(lignes); |
---|
50 | precip_journaliere(iligne,1) |
---|
51 | jmon=1:eomday(nban,imonth); |
---|
52 | cumulmonth=zeros(max(jmon)); |
---|
53 | |
---|
54 | for j=1:max(jmon); |
---|
55 | cumulmonth(j)=sum(precip_journaliere(iligne,3:(j+2))); |
---|
56 | end |
---|
57 | cumulyear(jmon)=cumulmonth(jmon); |
---|
58 | xdata(jmon)=datenum(nban,imonth,jmon); |
---|
59 | jo=max(jmon); |
---|
60 | for imonth=2:12; |
---|
61 | iligne=imonth+max(lignes); |
---|
62 | precip_journaliere(iligne,1) |
---|
63 | jmon=1:eomday(nban,imonth); |
---|
64 | cumulmonth=zeros(max(jmon)); |
---|
65 | for j=1:max(jmon); |
---|
66 | cumulmonth(j)=sum(precip_journaliere(iligne,3:(j+2))); |
---|
67 | end |
---|
68 | cumulyear(jo+1:jo+max(jmon))=cumulyear(jo)+cumulmonth(jmon); |
---|
69 | xdata(jo+1:jo+max(jmon))=datenum(nban,imonth,jmon); |
---|
70 | jo=jo+max(jmon); |
---|
71 | end |
---|
72 | |
---|
73 | startdate=datenum(nban,5,1); |
---|
74 | enddate=datenum(nban,11,30); |
---|
75 | periode=find((xdata(:,1) >=startdate) & (xdata(:,1) <=enddate)); |
---|
76 | ifigure=1; |
---|
77 | plot(xdata(periode),cumulyear(periode),'-'); |
---|
78 | % set x values were we want tick:one tick for decad of month |
---|
79 | %xticklabel=datestr(xdata(periode),1); |
---|
80 | %xtick=startdate:enddate; |
---|
81 | %set(gca,'XTick',xdata) |
---|
82 | xticklabel=datestr(xdata,'dd/mm/yyyy'); |
---|
83 | %set(gca,'XTickLabel',xticklabel) |
---|
84 | % tous les 10 jours de chaque mois de chaque année |
---|
85 | |
---|
86 | %set(gca,'xtick',xdata); |
---|
87 | %set(gca,'xticklabel',xticklabel); |
---|
88 | xlabel(['day of the year' num2str(nban)]); |
---|
89 | ylabel('cumulyear(precip-journaliere) (mm)'); |
---|
90 | title('cumul_precip of velingra precipitation for year'); |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|