前段时间写本科论文,使用到了对于海温sst差值场的显著性t检验,但苦于不会用GrADS画打点图,网上也找不到画打点的.gs代码,5月1放假自己在楼里硬憋出来一段代码,供大家参考,实测可以运行,输入数据为差值场和t检验结果,其核心是逐个格点循环判断并画点“draw sting”。
'reinit'
'open D:\lunwen\nczhuangrd\grdfenlei\sst_jianyan\chazhi12.ctl'
'open D:\lunwen\nczhuangrd\grdfenlei\sst_jianyan\t12.ctl'
'set grid off'
'set grads off'
'set cthick 6'
* These are the BLUE shades蓝色
'set rgb 16 0 0 255'
'set rgb 17 55 55 255'
'set rgb 18 110 110 255'
'set rgb 19 165 165 255'
'set rgb 20 220 220 255'
* These are the RED shades红色
'set rgb 21 255 220 220'
'set rgb 22 255 165 165'
'set rgb 23 255 110 110'
'set rgb 24 255 55 55'
'set rgb 25 255 0 0'
*阴影
'set xlint 10'
'set xlopts 1 4 0.15'
'set ylint 5'
'set ylopts 1 4 0.15'
'set x 105 255'
'set y 90 145'
*'set gxout shaded'
*'set ccols 14'
*'set clevs -2.654 -1.997 1.997 2.654'
*'set ccols 18 20 0 23 25'
*'d sst.2'
'set gxout shaded'
'set clevs -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4'
'set ccols 16 17 18 19 20 21 22 23 24 25'
'd sst.1'
'cbar 1.0 0'
y2=90
while (y2<145)
x2=105
while(x2<255)
'set x 'x2
'set y 'y2
'd sst.2'
aaa=subwrd(result,4)
if(aaa=-9.99e+08)
aaa=0
endif
if(aaa<0)
aaa=-aaa
endif
*if(aaa>2.654)
if(aaa>1.997)
'q w2xy 'x2-0.5' ' y2-90.5''
abx=subwrd(result,3)
aby=subwrd(result,6)
'set string 1 c 9'
'set strsiz 0.01'
'draw string 'abx' 'aby' `32'
endif
x2=x2+1
endwhile
y2=y2+1
endwhile
'draw title difference field and t test type2-type1'
'printim D:\lunwen\nczhuangrd\grdfenlei\sst_jianyan\chazhi_and_t12.png white'
*'c'
;
图片如图,希望有所帮助。