```	program climatology

real tmp(1140), pci(1140), tmp_ano, pci_ano,
&       c_tmp_1(12),   c_tmp_2(12),   c_pci_1(12),   c_pci_2(12),
&     sum_tmp_1(12), sum_tmp_2(12), sum_pci_1(12), sum_pci_2(12),
&       sum_tmp(12),   sum_pci(12),     c_tmp(12),     c_pci(12)

open (20, file='amazon.txt', form='formatted', status='old')

open (21, file='climatology.txt',
&                 form='formatted', status='unknown')
open (22, file='ano.txt',
&                 form='formatted', status='unknown')

do k=1,1140
enddo
10   format(f6.2, 2x, f10.7)
C
C
C **** 1884-1989 climatology (6 years)
C
do k = 1, 6
do i= 1, 12
sum_tmp_1(i) = sum_tmp_1(i) + tmp( 996 + (k-1)*12 + i )
sum_pci_1(i) = sum_pci_1(i) + pci( 996 + (k-1)*12 + i )
enddo
enddo

do k=1, 12
c_tmp_1(k) = sum_tmp_1(k) / 6.
c_pci_1(k) = sum_pci_1(k) / 6.
enddo
C
C
C **** 1990-1995 climatology (6 years)
C
do k = 1, 6
do i=1, 12
sum_tmp_2(i) = sum_tmp_2(i) + tmp( 1068 + (k-1)*12 + i )
sum_pci_2(i) = sum_pci_2(i) + pci( 1068 + (k-1)*12 + i )
enddo
enddo

do k=1, 12
c_tmp_2(k) = sum_tmp_2(k) / 6.
c_pci_2(k) = sum_pci_2(k) / 6.

enddo
C
C **** '84~'89, '90~'95 climatology output
C
write(21,*) 'mo      1984~1989              1990~1995'
do k=1, 12
write(21,20), k, c_tmp_1(k), c_pci_1(k),
&                  c_tmp_2(k), c_pci_2(k)
enddo
20   format(1x,i2, 2x, f7.3, 2x, f10.7, 4x, f7.3, 2x, f10.7)
C
C **** 1950-1995 climatology (46 years)
C
do k = 1, 46
do i=1, 12
sum_tmp(i) = sum_tmp(i) + tmp( 588 + (k-1)*12 + i )
sum_pci(i) = sum_pci(i) + pci( 588 + (k-1)*12 + i )
enddo
enddo

do k=1, 12
c_tmp(k) = sum_tmp(k) / 46.
c_pci(k) = sum_pci(k) / 46.
print *, k, c_tmp(k), c_pci(k)
enddo
C
C **** 1950-1995 temperature and precipitation anomalies
C
do k=1, 46
do i=1, 12
tmp_ano = tmp( 588 + (k-1)*12 + i) - c_tmp(i)
pci_ano = pci( 588 + (k-1)*12 + i) - c_pci(i)
write(22,22) k+1949, i, tmp_ano, pci_ano
enddo
enddo
22   format(i4,1x,i2,1x,f7.3,1x,f10.7)

stop
end
```