做了个160站的降水距平,然后调用子程序将它转为二进制的grd,再用这个做map于是就出问题了
!stntogrd子程序
subroutine stntogrd(x)
implicit none
integer k,n,i,j,nlev,nflag
real tim
parameter(n=160)
real sta(n),lat(n),lon(n),x(n)
character*8 stid(160)
open(2,file='D:\160\r\r.txt')
read(2,*)
do k=1,160
read(2,*) sta(k),lat(k),lon(k)
enddo
close(2)
do i=1,160
stid(i)=char(i)
enddo
open(3,file='d:\160\r\2\jp1951-1963.grd',form='binary')
tim=0.0
nlev=1
nflag=1
do j=1,160
write(3) stid(j),lat(j),lon(j),tim,nlev,nflag,x(j)
enddo
nlev=0
write(3) stid(j-1),lat(j-1),lon(j-1),tim,nlev,nflag
close(3)
return
end
这个jp1951-1963.grd是能出来
写的ctl如下
dset D:\160\r\2\jp1951-1963.grd
dtype station
stnmap D:\160\r\2\rain13.map
undef -999.0
title rain13
tdef 1 linear Jan1951 13yr
vars 1
p 0 99 rainfall data
endvars
接着用grads的!stnmap做map时就出现了
invalid station hdr found in station binary file
possible causes: invalid level count in hdr
descriptor file mismatch
file not station data
invalid relative time
levs=0 flag=1 time=126.65
卡在这里很久了,求大神帮助