| 
 
	积分13344贡献 精华在线时间 小时注册时间2012-8-7最后登录1970-1-1 
 | 
 
| 
本帖最后由 微微一笑 于 2014-3-5 09:23 编辑
x
登录后查看更多精彩内容~您需要 登录 才可以下载或查看,没有帐号?立即注册 
  
 站点插值成格点画填色图、等值线图,所有程序都没有问题,在同学的电脑里也可以画出来。我的电脑里就画不出…画出的填色图全都是红色的。grads程序里提示:constant field.value=1.72228e-45
 是我的opengrads里少些文件吗?是因为我的win7系统吗?什么原因呢?我把我的程序都贴出来。我好像找到原因了…是因为我 integer t(161),当我改成 real  t(161)  就可以了!
 因为我的变量是整数,可能grads只识别实数的变量…大家插值的时候要注意哦!!
 第一步:把站点资料变成grd格式
 program main
 implicit none
 character*8 stid(161)
 real lat(161),lon(161),tim
 integer t(161),nlev,nflag
 integer i,j
 open(1,file='D:\all\station.txt',status='old')
 do i=1,161
 read(1,*)lat(i),lon(i)
 end do
 close(1)
 open(2,file='D:\all\time.txt')
 do i=1,161
 read(2,*)t(i)
 end do
 close(2)
 do 30 j=1,161
 30 stid(j)=char(j)
 open(3,file='D:\all\161maxt.grd',status='replace',form='binary')
 tim=0.0
 nlev=1
 nflag=1
 do 40 i=1,161
 write(3)stid(i),lat(i),lon(i),tim,nlev,nflag,t(i)
 40 continue
 nlev=0
 write(3)stid(i-1),lat(i-1),lon(i-1),tim,nlev,nflag
 close(3)
 end
 
 
 第二步:grid格点
 program main
 integer i,j
 parameter(nx=101,ny=15)
 real lat(ny),lon(nx)
 real s(nx,ny)
 open(1,file='D:\all\grid.grd',form='binary')
 lon(1)=70.0
 lat(1)=26.0
 do i=1,nx-1
 lon(i+1)=lon(i)+0.5
 end do
 do j=1,ny-1
 lat(j+1)=lat(j)+0.5
 end do
 do i=1,nx
 do j=1,ny
 s(i,j)=1
 end do
 end do
 write(1)s
 end
 
 
 第三步:对应的两个ctl文件
 dset D:\all\grid.grd
 title grid
 undef 99999.9
 xdef 101 linear 75 0.5
 ydef 15 linear 26 0.5
 zdef 1  linear 1000 1
 tdef 1 linear jun1969 1mo
 vars 1
 g 0 99 grid data
 endvars
 
 
 dset D:\all\161maxt.grd
 dtype station
 stnmap D:\all\maxt.map
 undef -999.0
 title maxt
 xdef 101 linear 75 0.5
 ydef 15 linear 26 0.5
 zdef 1  linear 1000 1
 tdef 1 linear jun1969 1mo
 vars 1
 p 0 99 maxt
 endvars
 
 
 最后是我的gs文件
 'reinit'
 'open D:\all\grid.ctl'
 'open D:\all\maxt.ctl'
 'set grads off'
 'set grid off'
 *'enable print d:\all\maxt.gmf'
 'set lon 75 125'
 'set lat 26 33'
 'set mpdset hires cnscs'
 'define a=oacres(g,p.2,1.5)'
 'define a1=maskout(a,g-0.5)'
 'define aa=smth9(a1)'
 'set gxout shaded'
 'cnbasemap aa'
 'set gxout contour'
 'set clab forced'
 'set cint 0.1'
 'cnbasemap aa'
 *'print'
 *'disable print'
 'cbarn'
 'printim D:\all\maxt.png white'
 ;
 我画出来是全红色的,在同学电脑上可以画出图,但是看色标,明显不对…求助!!!
 
 
     
 
 | 
 |