- 积分
- 9888
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-4-23
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 aa22556688 于 2013-5-14 10:24 编辑
由于要统计,每个测站(17个站),每年(1974-2010),每个季度,每个季度各干旱等级(轻,中,重,特)的天数,编了了一个fortran程序,但运行结果不对,麻烦高手帮助看一下,哪里错了。。。cicici.txt文件,里共有37年数据,13514行,20列。
存储方式为(见下文或者图2):
年 月 日 测站1 测站2 ....... 测站17
1974 1 1 ... .... ...
1974 1 2 ... .... ...
1974 1 3 ... ... ..
.... ... ...
2012 12 31 .. .. ..
下面是程序代码:integer i,j,k
real,dimension(13514,20)::ci
integer,dimension(37,17)::dongqing,dongmid,dongzhong,dongte !冬季轻旱,冬季中旱,冬季重旱,冬季特旱,用来存37年每年冬季各等级干旱的天数!
integer,dimension(37,17)::chunqing,chunmid,chunzhong,chunte
integer,dimension(37,17)::xiaqing,xiamid,xiazhong,xiate
integer,dimension(37,17)::qiuqing,qiumid,qiuzhong,qiute
open(10,file='E:\aaa\cicici.txt') !气象综合干旱指数ci,13514行,20列!
do i=1,13514 !行:年,月,日,测站一,测站二。。。测站17!
read(10,*)(ci(i,j),j=1,20) !列:每个测站从1974.1.1~2012.12.31每天的CI值!
enddo
close(10)
k=1974 !起始年1974,终止年2010!
do m=1,37
do i=1,13514 !统计个测站,每年,每个季节,各等级干旱天数!
do j=4,20
if((ci(i,1)==k.and.ci(i,2)==1.0).or.(ci(i,1)==k.and.ci(i,2)==2).or.(ci(i,1)==k-1.and.ci(i,2)==12))then !冬季的条件!
if(-1.2<ci(i,j).and.ci(i,j)<=-0.6)then !轻旱!
dongqing(m,j-3)=dongqing(m,j-3)+1 !冬季轻旱天数加一!
else if(-1.8<ci(i,j).and.ci(i,j)<=-1.2)then !中旱!
dongmid(m,j-3)=dongmid(m,j-3)+1 !冬季中旱天数加一!
else if(-2.4<ci(i,j).and.ci(i,j)<=-1.8)then !重旱!
dongzhong(m,j-3)=dongzhong(m,j-3)+1 !冬季重旱天数加一!
else if(ci(i,j)<=-2.4)then !特旱!
dongte(m,j-3)=dongte(m,j-3)+1 !冬季特旱天数加一!
endif
else if(ci(i,1)==k.and.(ci(i,2)==3.or.ci(i,2)==4.or.ci(i,2)==5))then !春季的条件!
if(-1.2<ci(i,j).and.ci(i,j)<=-0.6)then
chunqing(m,j-3)=chunqing(m,j-3)+1
else if(-1.8<ci(i,j).and.ci(i,j)<=-1.2)then
chunmid(m,j-3)=chunmid(m,j-3)+1
else if(-2.4<ci(i,j).and.ci(i,j)<=-1.8)then
chunzhong(m,j-3)=chunzhong(m,j-3)+1
else if(ci(i,j)<=-2.4)then
chunte(m,j-3)=chunte(m,j-3)+1
endif
else if(ci(i,1)==k.and.(ci(i,2)==6.or.ci(i,2)==7.or.ci(i,2)==8))then
if(-1.2<ci(i,j).and.ci(i,j)<=-0.6)then
xiaqing(m,j-3)=xiaqing(m,j-3)+1
else if(-1.8<ci(i,j).and.ci(i,j)<=-1.2)then
xiamid(m,j-3)=xiamid(m,j-3)+1
else if(-2.4<ci(i,j).and.ci(i,j)<=-1.8)then
xiazhong(m,j-3)=xiazhong(m,j-3)+1
else if(ci(i,j)<=-2.4)then
xiate(m,j-3)=xiate(m,j-3)+1
endif
else if(ci(i,1)==k.and.(ci(i,2)==9.or.ci(i,2)==10.or.ci(i,2)==11))then
if(-1.2<ci(i,j).and.ci(i,j)<=-0.6)then
qiuqing(m,j-3)=qiuqing(m,j-3)+1
else if(-1.8<ci(i,j).and.ci(i,j)<=-1.2)then
qiumid(m,j-3)=qiumid(m,j-3)+1
else if(-2.4<ci(i,j).and.ci(i,j)<=-1.8)then
qiuzhong(m,j-3)=qiuzhong(m,j-3)+1
else if(ci(i,j)<=-2.4)then
qiute(m,j-3)=qiute(m,j-3)+1
endif
endif
enddo
enddo
k=k+1
enddo
open(30,file='E:\aaa\dongqing.txt')
open(40,file='E:\aaa\dongmid.txt')
open(50,file='E:\aaa\dongzhong.txt')
open(60,file='E:\aaa\dongte.txt')
open(70,file='E:\aaa\chunqing.txt')
open(80,file='E:\aaa\chunmid.txt')
open(90,file='E:\aaa\chunzhong.txt')
open(100,file='E:\aaa\chunte.txt')
open(110,file='E:\aaa\xiaqing.txt')
open(120,file='E:\aaa\xiamid.txt')
open(130,file='E:\aaa\xiazhong.txt')
open(140,file='E:\aaa\xiate.txt')
open(150,file='E:\aaa\qiuqing.txt')
open(160,file='E:\aaa\qiumid.txt')
open(170,file='E:\aaa\qiuzhong.txt')
open(180,file='E:\aaa\qiute.txt')
do i=1974,2010
write(30,'(i6,17i6)') i,(dongqing(i,j),j=1,17)
write(40,'(i6,17i6)') i,(dongmid(i,j),j=1,17)
write(50,'(i6,17i6)') i,(dongzhong(i,j),j=1,17)
write(60,'(i6,17i6)') i,(dongte(i,j),j=1,17)
write(70,'(i6,17i6)') i,(chunqing(i,j),j=1,17)
write(80,'(i6,17i6)') i,(chunmid(i,j),j=1,17)
write(90,'(i6,17i6)') i,(chunzhong(i,j),j=1,17)
write(100,'(i6,17i6)') i,(chunte(i,j),j=1,17)
write(110,'(i6,17i6)') i,(xiaqing(i,j),j=1,17)
write(120,'(i6,17i6)') i,(xiamid(i,j),j=1,17)
write(130,'(i6,17i6)') i,(xiazhong(i,j),j=1,17)
write(140,'(i6,17i6)') i,(xiate(i,j),j=1,17)
write(150,'(i6,17i6)') i,(qiuqing(i,j),j=1,17)
write(160,'(i6,17i6)') i,(qiumid(i,j),j=1,17)
write(170,'(i6,17i6)') i,(qiuzhong(i,j),j=1,17)
write(180,'(i6,17i6)') i,(qiute(i,j),j=1,17)
enddo
close(30)
close(40)
close(50)
close(60)
close(70)
close(80)
close(90)
close(100)
close(110)
close(120)
close(130)
close(140)
close(150)
close(160)
close(170)
close(180)
end 之前忘记说了,这个程序运行没有错误,只是结果不对,贴一张运行后的txt文件解雇,见图3:
麻烦高手看一下,哪里错了。。。不尽感激。。。
|
-
-
dongqing.txt
|