- 积分
- 94
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-1-6
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
站点资料求降水量随海拔高度的分布,每300m一层,海拔属于同一层次的降水量求和,最后求平均,程序编译没问题,但计算结果出错,程序筛选分层失败,降水量之和出现在同一层,而选出的降水总次数是正确的。请各位大神看看问题出在哪里,感激不尽~~
代码如下:
- !1000为站点数,31为文件个数
- real x(1000,31),y(1000,31),z(1000,31),averain(8)
- character*13 name
- integer error
- integer ip(8)
- !按namelist读k个文件
- open(10,file='e:\r24-8-p\namelist.txt',form='formatted')
- k=1
- n=0
- 101 read(10,*,end=1001)name
- write(*,*)name
- open(9,file='e:\r24-8-p\result_8_98\'//name//'.txt',form='formatted')
- !读数据
- do while (.true.)
- read(9,*,iostat=error)a,b,c,d,e
- if(error /= 0) exit
- n=n+1
- x(n,k)=b
- y(n,k)=c
- z(n,k)=e
- end do
- close(9)
- k=k+1
- goto 101
- 1001 close(10)
- !求满足经、纬度范围的站点的平均降水量
- averain=0
- ip=0
- do k=1,31
- do n=1,1000
- if(x(n,k).ge.103.and.x(n,k).le.110.and.y(n,k).ge.24.and.y(n,k).le.29)then
- if(d>=300.and.d<600)then
- ip(1)=ip(1)+1
- averain(1)=averain(1)+z(n,k)
- else if(d>=600.and.d<900)then
- ip(2)=ip(2)+1
- averain(2)=averain(2)+z(n,k)
- else if(d>=900.and.d<1200)then
- ip(3)=ip(3)+1
- averain(3)=averain(3)+z(n,k)
- else if(d>=1200.and.d<1500)then
- ip(4)=ip(4)+1
- averain(4)=averain(4)+z(n,k)
- else if(d>=1500.and.d<1800)then
- ip(5)=ip(5)+1
- averain(5)=averain(5)+z(n,k)
- else if(d>=1800.and.d<2100)then
- ip(6)=ip(6)+1
- averain(6)=averain(6)+z(n,k)
- else if(d>=2100.and.d<2400)then
- ip(7)=ip(7)+1
- averain(7)=averain(7)+z(n,k)
- else if(d>=2400.and.d<2700)then
- ip(8)=ip(8)+1
- averain(8)=averain(8)+z(n,k)
- end if
- end if
- end do
- end do
- do i=1,8
- averain(i)=averain(i)/ip(i)
- end do
- write(*,*)ip,averain
- open(20,file='e:\r24-8-p\ave_8_98.txt',form='formatted')
- do i=1,8
- write(20,*) ip(i),averain(i)
- end do
- end
复制代码
namelist.txt如下
98080108.0001
98080208.0001
98080308.0001
98080408.0001
98080508.0001
98080608.0001
98080708.0001
98080808.0001
98080908.0001
98081008.0001
98081108.0001
98081208.0001
98081308.0001
98081408.0001
98081508.0001
98081608.0001
98081708.0001
98081808.0001
98081908.0001
98082008.0001
98082108.0001
98082208.0001
98082308.0001
98082408.0001
98082508.0001
98082608.0001
98082708.0001
98082808.0001
98083008.0001
98083108.0001
|
|