- 积分
- 77
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2013-8-7
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 3225412 于 2014-3-8 01:38 编辑
新手昨天按教程例子进行GRADS作图研究,遇到些错误,然后也跌跌碰碰完成了。今天进入实战,生成映射文件时候出现问题..自己无解了,求助各位program shizhan
parameter(nt=30)
integer::n,n1,n2,n3,n4
real,allocatable::lon(:),lat(:),rd(:) !动态数组分别用来储存站点的降水
real:: temp(9)
character*8,allocatable::sta(:) !动态数组,储存站号,站号必须是8个字符,5个的话会stnmap出不出来
character*12 filename(nt) !用于储存32个时次的文件名
open(1,file='d:\surface\plot\filename.txt')
do i=1,nt
read(1,*) filename(i)
print*,'Filename:',filename(i)
enddo
close(1)
open(2,file='D:\surface\plot\rain.grd',status='replace',form='binary') !储存32个时次的降水
do k=1,nt
open(3,file=filename(k))
read(3,*)
read(3,*) n1,n2,n3,n4,n !将该时次的站点数赋值于n
allocate(lat(n))
allocate(lon(n))
allocate(rd(n))
allocate(sta(n))
close(3)
open(4,file=filename(k)) !获知n后,重新读取数据。
read(4,*)
read(4,*)
do i=1,n !只读降水,别的要素暂略
read(4,*) sta(i),lon(i),lat(i),(temp(j),j=1,9),rd(i)
tim=0.0;nlev=1;nflag=1
write(2) sta(i),lat(i),lon(i),tim,nlev,nflag,rd(i) !一个时次的降水场输入完毕
enddo
nlev=0
write(2) sta(n),lat(n),lon(n),tim,nlev,nflag
!一个时次的降水场输入完毕,告诉Grads 该时次的数据结束。这是一个特殊标记。
deallocate(lat)
deallocate(lon)
deallocate(rd)
deallocate(sta)
close(4)
enddo
close(2)
end
ctl:
dset d:/surface/plot/rain.grd
dtype station
stnmap d:/surface/plot/rain.map
undef 9999
title RAINFALL ONSET DATE IN QTP
tdef 30 linear 02z07Jul2013 3hr
vars 1
r 0 99 Rainfall date
endvars
|
-
-
|