- 积分
- 451
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2016-9-29
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
请教一下会grads的小伙伴,用grads画图出现了一个错误:
系统提示如下:
Data Request Error: Invalid grid coordinates
World coordinates convert to non-integer grid coordinates
Variable = uwndclim Dimension = 3
Error ocurred at column 6
原gs文件和CTL文件:(另附件可直接下载)
'reinit'
'open D:\grads2\ex4.ctl'
'open D:\grads2\clim_ex4.ctl'
'set lon 90 270'
'set lat -30 60'
'set lev 850'
'run define_colors.gs'
len=0.25
scale=5
'set dfile 2'
'set t 1 12'
'define uwndclim=uwnd'
'define vwndclim=vwnd'
'define slpclim =slp'
'modify uwndclim seasonal'
'modify vwndclim seasonal'
'modify slpclim seasonal'
'set dfile 1'
'set t 1 24'
'define uwndanom=uwnd-uwndclim'
'define vwndanom=vwnd-vwndclim'
'define slpanom = slp/100.-slpclim'
t=11
while(t<=16)
monstr=getmonstr(t)
if (t>12)
mon=t-12
timestr=15%monstr%1998
else
mon=t
timestr=15%monstr%1997
endif
'set time ' timestr
*math_int(num): the integer part of the num not greater than num
*x0=0 and x0=1 mean the sub-plots are on the left and right columns, respectively.
*
*math_mod(num1,num2): the integer part of the reminder when num1 is divided by num2
*y0=0,y0=1 and y0=2 mean the sub-plots are on the top,middle and bottom rows, respectively.
x0=math_int((t-11)/3)
y0=math_mod((t-11),3)
*xl: the width of white space on the left of a sub-plot
*xr: the width of white space on the right of a sub-plot
*cb: the width for color bar in the left of plot
*thus, (11-xl*2-xr*2-cb)/2 is the width of each sub-plot.
xl=0
xr=0
cb=0.8
wd=(11-xl*2-xr*2-cb)/2
xmin=xl+(wd+xl+xr)*x0
xmax=xmin+wd
*yt: the height of white space above a sub-plot
*yb: the height of white space below a sub-plot
*thus, (8.5-yt*3-yb*3)/3 is the height of each sub-plot
yt=0.1
yb=0.2
ht=(8.5-yt*3-yb*3)/3
ymax=8.5-yt-(ht+yt+yb)*y0
ymin=ymax-ht
'set parea 'xmin' 'xmax' 'ymin' 'ymax
'set gxout shaded'
'set grads off'
'set grid off'
'set clevs -10 -7 -5 -3 -2 -1 1 2 3 5 7 10'
'set ccols 99 97 95 94 93 92 0 82 83 84 85 87 89'
'd slpanom'
'set arrscl 'len' 'scale
'set arrowhead -0.4'
'set arrlab off'
'set ccolor 1'
'd skip(uwndanom,3);skip(vwndanom,3)'
if (mon=3)
'cbarn 1 1'
endif
'q w2xy 90 55'
xl=subwrd(result,3)
yl=subwrd(result,6)
'q w2xy 108 65'
xo=subwrd(result,3)
yo=subwrd(result,6)
'set line 1'
'draw rec 'xl' 'yl' 'xo' 'yo
'set line 0'
'draw recf 'xl' 'yl' 'xo' 'yo
'set string 1 c'
'draw string 'xo/2+xl/2' 'yo/2+yl/2' 'monstr
t=t+1
endwhile
rc = arrow(10.3,0.8,len,scale)
'gxprint D:\grads2\4-2.png white'
function arrow(x,y,len,scale)
'set line 1 1 4'
'draw line 'x-len/2.' 'y' 'x+len/2.' 'y
'draw line 'x+len/2.-0.05' 'y+0.04' 'x+len/2.' 'y
'draw line 'x+len/2.-0.05' 'y-0.04' 'x+len/2.' 'y
'set string 1 c'
'set strsiz 0.12'
'draw string 'x' 'y-0.13' 'scale
return
function getmonstr(mon)
mon=math_mod(mon,12)
if(mon=1)
monstr='JAN'
endif
if(mon=2)
monstr='FEB'
endif
if(mon=3)
monstr='MAR'
endif
if(mon=4)
monstr='APR'
endif
if(mon=5)
monstr='MAY'
endif
if(mon=6)
monstr='JUN'
endif
if(mon=7)
monstr='JUL'
endif
if(mon=8)
monstr='AUG'
endif
if(mon=9)
monstr='SEP'
endif
if(mon=10)
monstr='OCT'
endif
if(mon=11)
monstr='NOV'
endif
if(mon=12|mon=0)
monstr='DEC'
endif
return monstr
;
这是我的上机作业,上传的gs文件是老师供我们参考的,若有侵犯版权问题,我会及时删帖的。最后,祝各位小伙伴们国庆节快乐!
|
-
-
temp.gs
3.24 KB, 下载次数: 4, 下载积分: 金钱 -5
|