- 积分
- 1006
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2018-4-27
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2018-12-23 22:02:51
|
显示全部楼层
请问能帮忙看看这个程序吗,万分感谢
INTEGER,PARAMETER :: NS=839,NY=55,ND=31,NM=12,WJS=660
INTEGER year,mon,day
real a(10)
character*5 sta(NS),filename(WJS)
real,allocatable :: staID(:),b(:),lat(:),lon(:),hgt(:),rain1(:,:,:,:),rain2(:,:,:,:),rain3(:,:,:,:)
allocate (staID(NS),b(WJS),lat(NS),lon(NS),hgt(NS),rain1(NS,NY,NM,ND),rain2(NS,NY,NM,ND),rain3(NS,NY,NM,ND))
!!!!!!日值说明,20-8时降水量、8-20时降水量、20-20时累计降水量、
!!!!!!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% READ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
OPEN(11,FILE='D:\data\data\station.txt')
do i=1,NS
read(11,*)staID(i)
enddo
CLOSE(11)
!===========1961-2015:
open(10,file='D:\data\data\pre\filename.txt')
do i=1,WJS
read(10,*) b(i)
enddo
close(10)
do i=1,WJS
write(filename,'(b)')(b(i))
OPEN(11,FILE='D:\data\data\pre\'//filename//'.txt',err=8000)(提示这行有问题)
!!!!!!pre文件夹里含12*55个txt资料,文件名都是“SURF_CLI_CHN_MUL_DAY-pre-13011-xxxx(年)xx(月)”的形式
read(11,*)
!!!!!!read(11,*)表示从文件11中读出一个数据,但不写入任何变量
500 read(11,*,err=600)a(1:10)
DO is=1,ns
if(a(1).eq.staID(is))then
lat(is)=a(2)
lon(is)=a(3)
hgt(is)=a(4)
year=a(5)
mon=a(6)
day=a(7)
rain1(is,year,mon,day)=a(8)
rain2(is,year,mon,day)=a(9)
rain3(is,year,mon,day)=a(10)
endif
enddo
goto 500
CLOSE(11)
600 continue
8000 continue
ENDDO
DO IS=1,NS
lat(is)=INT(lat(is)/100)+MOD(lat(is),100.)/60.
lon(is)=INT(lon(is)/100)+MOD(lon(is),100.)/60.
hgt(is)=hgt(is)/10
rain1(is,year,mon,day)= rain1(is,year,mon,day)/10
rain2(is,year,mon,day)= rain1(is,year,mon,day)/10
rain3(is,year,mon,day)= rain1(is,year,mon,day)/10
enddo
!按要求处理数据
do i=1,ns
WRITE(sta(is),'(i5)')INT(staid(is))
OPEN(11,FILE='D:\data\clh\'//sta(is)//'.txt/',err=8000)
do IY=1,NY
DO IM=1,NM
DO ID=1,ND
WRITE(11,*)Lat(is),lon(is),hgt(IS),year,mon,day,rain1(is,iy,im,id),rain2(is,iy,im,id),rain3(is,iy,im,id)
enddo
enddo
enddo
CLOSE(11)
enddo
!把数据按不同站分开的形式输出到不同以站号命名的文件里
deallocate (staID,lat,lon,hgt,rain1,rain2,rain3)
END |
|