# How to obtain monthly data for each year from daily data

Status
Not open for further replies.

#### ZSH

##### Technical User
Hi Programmer

I wrote the program to add daily data to monthly data for 30 years data but my program shows only repeated results of the first year months data for all other years. How I can overcome this problem.

real, dimension (10958,2) :: A
integer :: row, col, max_row, max_col
max_row=10958
max_col=2

open(2,file='MET000143F_1.txt',status='old')

do row=1,max_row

!enddo
!print*, A(1,1)
do year=1,30
sumj=0.0
start=1
end1=31
J=1
do I=start, end1
sumj=sumj+A(I,J)
enddo
sumf=0.0
start=end1+1
end1=start+27
do I=start,end1
sumf=sumf+A(I,J)
enddo

summ=0.0
start=end1+1
end1=start+30
do I=start,end1
summ=summ+A(I,J)
enddo

suma=0.0
start=end1+1
end1=start+29
do I=start,end1
suma=suma+A(I,J)
enddo

summy=0.0
start=end1+1
end1=start+30
do I=start,end1
summy=summy+A(I,J)
enddo

sumju=0.0
start=end1+1
end1=start+29
do I=start,end1
sumju=sumju+A(I,J)
enddo

sumjy=0.0
start=end1+1
end1=start+30
do I=start,end1
sumjy=sumjy+A(I,J)
enddo

sumag=0.0
start=end1+1
end1=start+30
do I=start,end1
sumag=sumag+A(I,J)
enddo

sums=0.0
start=end1+1
end1=start+29
do I=start,end1
sums=sums+A(I,J)
enddo

sumo=0.0
start=end1+1
end1=start+30
do I=start,end1
sumo=sumo+A(I,J)
enddo

sumn=0.0
start=end1+1
end1=start+30
do I=start,end1
sumn=sumn+A(I,J)
enddo

sumd=0.0
start=end1+1
end1=start+30
do I=start,end1
sumd=sumd+A(I,J)
enddo

!start=end1+1
!end1=start+30

enddo
print*, sumj, sumf, summ, suma, summy, sumju, sumjy, sumag, '&'
print*, sums, sumo, sumn, sumd
enddo
end

Status
Not open for further replies.

Replies
3
Views
218
Replies
7
Views
303
Replies
3
Views
144
Replies
2
Views
80
Replies
1
Views
55