$ srcdump.sh RH.q.CLW.gs circlon.gs circlat.gs colormaps.gs qdims.gsf tile.gs sfc.ctl plev.ctl
aofd165.bio.mie-u.ac.jp
/work1/am/2016.PolarLow/ERA-I/RH.q.CLW
Tue Sep 20 17:05:43 JST 2016
======================
RH.q.CLW.gs
======================
'open sfc.ctl'
'open plev.ctl'
'q ctlinfo 2'
say result
header='ERA-I.Barents110116-110126'
headout='ERA-I.Barents'
varname='RH.q.CLW'
outdir='Fig'
'!mkdir -p 'outdir
#'set mproj lambert'
'set mproj nps'
'set lat 50 85'
'set lon -50 50'
i=1
while (i <= 34 )
'set t ' i
'cc'
'set mpdset mres'
'set frame off'
'set grid off' ;#on 3 15'
'q dims'
line=sublin(result,5)
datetime=subwrd(line,6)
'set strsiz 0.2 0.25'
'set string 1 c 5'
'draw string 4.5 8.5 'datetime
'mul 1 4 1 1 -yini 1'
plev=975
'set lev 'plev
var2=r.2
'color 80 95 5 -kind white->deepskyblue->blue -xcbar 1 1.1 0.4 2.6 -fh 0.12 -fw 0.11 -edge triangle -line on'
'set gxout shade2'
'draw string 1 2.7 %'
'set clab forced' ;*off'
'set grads off'
'd 'var2
'set gxout contour'
'set clab off'
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clevs 0.5'
'set grads off'
'd 'var2
'set gxout contour'
'set z 1'
levs1='960 965 970 975 980 985 990 995 1000 1005 1010 1015 1020 1025 1030'
'set clevs 'levs1
'set clab off'
'set cthick 10'
'set ccolor 0'
'set grads off'
'd ' msl.1 '/100'
'color -gxout contour -kind indigo->plum -levs ' levs1 ' -xcbar 7.5 7.6 2.3 6.5 -fh 0.12 -fw 0.11 -edge triangle -line on'
'draw string 7.5 6.6 hPa'
'set cthick 2'
'set grads off'
'd ' msl.1 '/100'
'set gxout vector'
'set z 1'
sclv=15
lngv=0.1
'set lev 'plev
'set arrscl 0.1 'sclv
'set arrlab off'
'set ccolor 0'
'set cthick 10'
'set grads off'
'd skip(u.2,10,5);skip(v.2,10,5)'
'set ccolor 1'
'set cthick 3'
'set arrscl 0.1 'sclv
'set arrlab on' ;*off'
sclv2=sclv*2
lngv2=lngv*2
'set grads off'
'vec.gs skip(u.2,10,5);skip(v.2,10,5) -SCL ' lngv2 ' ' sclv2 ' -P 6.5 0.6 -SL m/s -HDSZ 0.5'
'circlat 10 55 0.1'
'circlon 10 0.1'
'draw string 1.8 0.6 RH'plev'&UV'
plev=975
'mul 1 4 1 2 -yini 0.1'
'set lev 'plev
var2=q.2'*1000' ;*kg/kg -> g/kg
levs2='1 2 4 6 8 10'
'color -levs ' levs2 ' -kind khaki->beige->cyan->turquoise->deepskyblue->blue -xcbar 1 1.1 3.3 5.5 -fh 0.12 -fw 0.11 -edge triangle -line on'
'set gxout shade2'
'draw string 0.9 5.6 g/kg'
'draw string 1.8 3.4 q'plev'&WVF'
'set clab forced' ;*off'
'set grads off'
'd 'var2
'set gxout contour'
'set clab off'
'set cstyle 1'
'set cthick 1'
'set ccolor 0'
'set clevs 'levs2
'set grads off'
'd 'var2
'set gxout contour'
'set z 1'
'set clevs 'levs1
'set clab off'
'set cthick 10'
'set ccolor 0'
'set grads off'
'd ' msl.1 '/100'
'color -gxout contour -kind indigo->plum -levs ' levs1 ;#' -xcbar 7.5 7.6 2.3 6.5 -fh 0.12 -fw 0.11 -edge triangle -line on'
'draw string 7.5 6.6 hPa'
'set cthick 2'
'set grads off'
'd ' msl.1 '/100'
'set z 1'
qu'=' q.2 '(lev=' plev ')*' u.2 '(lev=' plev ')*1000'
qv'=' q.2 '(lev=' plev ')*' v.2 '(lev=' plev ')*1000'
sclv=50
lngv=0.1
'set gxout vector'
'set lev 'plev
'set arrscl 'lngv' 'sclv
'set arrlab off'
'set ccolor 0'
'set cthick 10'
'set grads off'
'd skip(' qu ',7,3);skip(' qv ',7,3)'
'set ccolor 1'
'set cthick 3'
'set arrlab on' ;*off'
'set arrscl 'lngv' 'sclv
sclv2=sclv*2
lngv2=lngv*2
'set grads off'
'vec.gs skip(qu,7,3);skip(qv,7,3) -SCL ' lngv2 ' ' sclv2 ' -P 6.5 3.4 -SL g/kg`30`0m/s -HDSZ 0.5'
'circlat 10 55 0.1'
'circlon 10 0.1'
'mul 1 4 1 3 -yini 0.1'
'set z 1'
var1'='vclw.1
'set gxout shade2'
levs2='0.01 0.02 0.05 0.1 0.2 0.5 1'
'color -levs ' levs2 ' -kind (50,50,255)->(255,255,255) -xcbar 1 1.1 6.0 8.2 -fh 0.12 -fw 0.11 -edge triangle -line on'
'draw string 0.9 8.3 kg/m2'
'draw string 1.8 6.1 CLW'
'set clab off'
'set grads off'
'd 'var1
'set gxout contour'
# 'set cthick 1'
# 'set ccolor 0'
# 'set cstyle 1'
# 'set clevs ' levs2
# 'set grads off'
# 'd 'var1
'set gxout contour'
'set z 1'
'set clevs 'levs1
'set clab off'
'set cthick 3'
'set ccolor 0'
'set grads off'
'd ' msl.1 '/100'
'color -gxout contour -kind indigo->plum -levs ' levs1 ' -xcbar 7.5 7.6 2.3 6.5 -fh 0.12 -fw 0.11 -edge triangle -line on'
'draw string 7.5 6.6 hPa'
'set cthick 1'
'set grads off'
'd ' msl.1 '/100'
'circlat 10 55 0.1'
'circlon 10 0.1'
num=''
if (i<10)
num='00'i
endif
if (i>=10 & i<100)
num='0'i
endif
if (i>100)
num=i
endif
figfile=outdir '/' headout '_' varname '_' num '_' datetime '.png'
say 'Output: ' figfile
'gxprint ' figfile ;#temp.eps
# '!convert -chop 60x170 -resize 100% temp.eps 'figfile
i=i+1
endwhile
'allclose'
exit
#'quit'
----------------------
End of RH.q.CLW.gs
----------------------
======================
circlon.gs
======================
function circlon(args)
* usage: run circlon dlon (strsiz (font))
* mproj=nps もしくは sps において longitudeの数字を描く
* dlon は数字を描く経度の間隔で必須.
* strsiz は文字の大きさでオプション
* font はフォント番号でオプション
dlon=subwrd(args,1)
strsiz=subwrd(args,2)
font=subwrd(args,3)
'q gxinfo'
cline=sublin(result,6)
mproj=subwrd(cline,3)
if (mproj!=3 & mproj!=4)
say ' *circlon* (mproj!=3:nps & mproj !=4:sps) is not supported'
say 'mproj='%mproj
'quit'
endif
if (mproj=3);* mproj=3 is nps
'query w2xy 0 90'
* say 'result='result
endif
if (mproj=4);* mproj=4 is sps
'query w2xy 0 -90'
endif
xpol=subwrd(result,3)
ypol=subwrd(result,6)
'q dims'
lonline=sublin(result,2)
latline=sublin(result,3)
if (mproj=3);* mproj=nps
lat0=subwrd(latline,6)
else;* mproj=sps
lat0=subwrd(latline,8)
endif
lon1=subwrd(lonline,6)
lon2=subwrd(lonline,8)
say 'lon1='lon1' lon2='lon2
'query w2xy '%lon1%' '%lat0
xd=subwrd(result,3)
yd=subwrd(result,6)
say 'xpol='xpol
say 'ypol='ypol
say 'xd='xd
say 'yd='yd
* 'run sqrt '%(xpol-xd)*(xpol-xd)+(ypol-yd)*(ypol-yd); rad=result;* for Grads 1.7 or earlier
rad=math_pow((xpol-xd)*(xpol-xd)+(ypol-yd)*(ypol-yd),0.5);
* say 'rad='rad
* say 'lon1='lon1' lon2='lon2
radd=rad+0.2
if (strsiz!="")
radd=rad+1.5*strsiz
'set strsiz '%strsiz
endif
if (font!=""); ' set font '%font; endif
lonm=(lon1+lon2)/2
*lon=0; while (lon<=360)
lon=lon1; while (lon<=lon2)
if (lon1<=lon & lon<lon2)
* say 'lon='lon
anglestr=lon-lonm
angleline=(anglestr-90)/180*3.14
* 'set string 1 c 3 '%anglestr
'set string 1 c'
cosangle=math_cos(angleline);
sinangle=math_sin(angleline);
* 'run cos '%angleline; cosangle=result;* for Grads 1.7 or earlier
* 'run sin '%angleline; sinangle=result;* for Grads 1.7 or earlier
xrim=xpol+rad*cosangle
yrim=ypol+rad*sinangle
* 'draw line '%xpol%' '%ypol%' '%xrim%' '%yrim
xchar=xpol+radd*cosangle
ychar=ypol+radd*sinangle
ew=''
if (-360<lon & lon<-180) ; ew='W'; clon=(360+lon)%ew; endif
if (-180<lon & lon<0) ; ew='W'; clon=-lon%ew ; endif
if ( 0<lon & lon<180) ; ew='E'; clon=lon%ew ; endif
if ( 180<lon & lon<360) ; ew='W'; clon=(360-lon)%ew; endif
if ( 360<lon & lon<540) ; ew='E'; clon=(lon-360)%ew; endif
if ( 540<lon & lon<720) ; ew='W'; clon=(720-lon)%ew; endif
if ( -360=lon | 0=lon | 360=lon | 720=lon ) ; ew='' ; clon=0%ew; endif
if ( -180=lon | 180=lon | 540=lon ) ; ew=''; clon=180%ew; endif
'draw string '%xchar%' '%ychar%' '%clon
endif
lon=lon+dlon
endwhile
'set string 1 bl 3 0'
return
lat=lat1; while (lat<=lat2)
endwhile
----------------------
End of circlon.gs
----------------------
======================
circlat.gs
======================
function circlat(args)
* usage: run circlat dlat (strsiz (font))
* mproj=nps もしくは sps において 緯度の数字を描く
* dlat は数字を描く経度の間隔で必須.
* lon は数字を描く経度で必須.
* strsiz は文字の大きさで必須.
* font はフォント番号でオプション
dlat=subwrd(args,1)
if (dlat=0); say '*circlat* dlat=0'; 'quit'; return; endif
lon0=subwrd(args,2)
strsiz=subwrd(args,3)
if (strsiz=""); say '*circlat* strsiz is not defined'; 'quit'; return; endif
if (strsiz=0); say '*circlat* strsiz=0'; 'quit'; return; endif
font=subwrd(args,4)
'q gxinfo'
cline=sublin(result,6)
mproj=subwrd(cline,3)
if (mproj!=3 & mproj!=4)
say ' *circlon* (mproj!=3:nps & mproj !=4:sps) is not supported'
say 'mproj='%mproj
'quit'
endif
if (mproj=3);* mproj=3 is nps
'query w2xy 0 90'
* say 'result='result
endif
if (mproj=4);* mproj=4 is sps
'query w2xy 0 -90'
endif
xpol=subwrd(result,3)
ypol=subwrd(result,6)
'q dims'
lonline=sublin(result,2)
lon1=subwrd(lonline,6)
lon2=subwrd(lonline,8)
latline=sublin(result,3)
lat1=subwrd(latline,6)
lat2=subwrd(latline,8)
lat=math_int(lat1/dlat)*dlat-dlat
'set line 0';* set color for recf
'set string 1 c'
'set strsiz '%strsiz
if (font!=""); ' set font '%font; endif
while(lat<lat2)
if (lat1<=lat)
'query w2xy '%lon0%' '%lat
x=subwrd(result,3)
y=subwrd(result,6)
if (lat<0); clat=-lat%'S'; endif
if (lat>0); clat=lat%'N'; endif
if (lat=0); clat='Eq'; endif
len=math_strlen(clat)
xwl=strsiz*len*1.1/2
xwr=strsiz*len*1.3/2
ywb=strsiz*1.4/2
ywt=strsiz*1.2/2
* 'draw recf '%x-xwl%' '%y-ywb%' '%x+xwr%' '%y+ywt
'draw string '%x%' '%y%' '%clat
endif
lat=lat+dlat
endwhile
'set string 1 bl 3 0'
return
----------------------
End of circlat.gs
----------------------
======================
colormaps.gs
======================
function colormaps(args)
demo=1
flipped='off'
levels='260 310 0.5'
cname='Dark'
*DEFAULT OPTIONS*
demo=0 ;*Choose To plot Demo on Screen
flipped='off' ;*Flip Color Bar: e.g., white->black = black->white
levels='1 100 1' ;*Levels to fix color scale to
cname='gs' ;*Name of Colorbar: Names are shown with demo, an additional list of names is found in the help section
*********
****
check=1
a=1
while(check=1)
line=subwrd(args,a)
if(line='');break;endif
if(line='-help')
help()
return
endif
if(line='-name' | line='-map')
val=subwrd(args,a+1)
if(valnum(val)!=0)
say "Improper variably type for colormap name: defaulting to default scale: "cname
else
cname=val
endif
endif
if(line='-demo' | line= 'demo')
demo=1
endif
if(line='-levels' | line='-l')
min=subwrd(args,a+1)
max=subwrd(args,a+2)
int=subwrd(args,a+3)
val=min*max*int
if(valnum(val)=0)
say "Improper value for either Max, Min or Interval. You must followed -levels with 3 numbers."
say "Leaving levels as default "levels
else
levels=min' 'max' 'int
endif
endif
if(line='flipped' | line='-flipped')
flipped='on'
endif
a=a+1
endwhile
if(demo=1)
'clear'
cnames='Paired Spectral Rainbow Jet Ocean Rain Satellite Autumn Cool Dark Terrain1 Terrain2 Snow grayscale red green blue b2r brn2grn y2b oj2p'
draw=1
maps=21
m=1
colors='1 120 1'
bys='0.5 0.7'
while(m<=maps)
col=subwrd(cnames,m)
ccols=set_color(colors,col,draw,bys,flipped)
ymid=(subwrd(bys,2)+subwrd(bys,1))/2
'draw string 8.75 'ymid' 'col
bys=subwrd(bys,1)+0.3' 'subwrd(bys,2)+0.3
m=m+1
endwhile
say 'Your Available color scales are shown on the Screen'
say 'press any key to clear the demo screen and continue...'
pull dummy
* 'clear'
draw=0
endif
levs=set_c_levs(levels)
ccols=set_color(levels, cname,draw,'0.5 0.5',flipped)
'set clevs 'levs
'set ccols 'ccols
say "Your Colors have been set!"
say "You are using the colormap: "cname
say "Flip is set to: "flipped
function set_color(colors, col,draw,bys,flipped)
if(col='Paired' | col = 'paired')
collevs=12
col.1='162 204 225'
col.2='36 123 178'
col.3='174 221 136'
col.4='54 162 47'
col.5='250 152 151'
col.6='229 39 40'
col.7='253 186 102'
col.8='254 127 1'
col.9='195 170 210'
col.10='108 64 153'
col.11='253 250 150'
col.12='179 93 42'
if(flipped='on')
col.12='162 204 225'
col.11='36 123 178'
col.10='174 221 136'
col.9='54 162 47'
col.8='250 152 151'
col.7='229 39 40'
col.6='253 186 102'
col.5='254 127 1'
col.4='195 170 210'
col.3='108 64 153'
col.2='253 250 150'
col.1='179 93 42'
endif
endif
if(col='Spectral' | col = 'spectral')
collevs=9
col.1='0 0 0'
col.2='126 0 142'
col.3='0 0 198'
col.4='0 140 221'
col.5='0 154 12'
col.6='13 255 0'
col.7='250 213 0'
col.8='210 0 0'
col.9='195 195 195'
if(flipped='on')
col.9='0 0 0'
col.8='126 0 142'
col.7='0 0 198'
col.6='0 140 221'
col.5='0 154 12'
col.4='13 255 0'
col.3='250 213 0'
col.2='210 0 0'
col.1='195 195 195'
endif
endif
if(col='hsv' | col = 'Rainbow' | col='rainbow')
collevs=7
col.1='255 0 0'
col.2='255 255 0'
col.3='0 255 0'
col.4='0 255 255'
col.5='0 0 255'
col.6='255 0 255'
col.7='255 0 0'
if(flipped='on')
col.7='255 0 0'
col.6='255 255 0'
col.5='0 255 0'
col.4='0 255 255'
col.3='0 0 255'
col.2='255 0 255'
col.1='255 0 0'
endif
endif
if(col='b2r' | col = 'difference1')
collevs=5
col.1='0 0 100'
col.2='0 0 255'
col.3='255 255 255'
col.4='255 0 0'
col.5='100 0 0'
if(flipped='on')
col.5='0 0 100'
col.4='0 0 255'
col.3='255 255 255'
col.2='255 0 0'
col.1='100 0 0'
endif
endif
if(col='brn2grn' | col = 'difference2')
collevs=5
col.1='85 49 5'
col.2='224 196 130'
col.3='255 255 255'
col.4='126 203 192'
col.5='0 62 50'
if(flipped='on')
col.5='85 49 5'
col.4='224 196 130'
col.3='255 255 255'
col.2='126 203 192'
col.1='0 62 50'
endif
endif
if(col='y2b' | col = 'difference3')
collevs=5
col.1='249 208 2'
col.2='252 232 131'
col.3='255 255 255'
col.4='145 163 253'
col.5='10 50 250'
if(flipped='on')
col.5='249 208 2'
col.4='252 232 131'
col.3='255 255 255'
col.2='145 163 253'
col.1='10 50 250'
endif
endif
if(col='oj2p' | col = 'difference4')
collevs=5
col.1='130 60 7'
col.2='235 152 52'
col.3='255 255 255'
col.4='142 131 183'
col.5='45 0 75'
if(flipped='on')
col.5='130 60 7'
col.4='235 152 52'
col.3='255 255 255'
col.2='142 131 183'
col.1='45 0 75'
endif
endif
if(col='terrain1' | col = 'Terrain1' | col='t1' | col='T1')
collevs=6
col.1='48 56 158'
col.2='0 152 254'
col.3='5 205 103'
col.4='249 253 151'
col.5='129 93 88'
col.6='255 255 255'
if(flipped='on')
col.6='48 56 158'
col.5='0 152 254'
col.4='5 205 103'
col.3='249 253 151'
col.2='129 93 88'
col.1='255 255 255'
endif
endif
if(col='ocean' | col='Ocean')
collevs=4
col.1='0 125 0'
col.2='0 8 79'
col.3='41 148 184'
col.4='255 255 255'
if(flipped='on')
col.4='0 125 0'
col.3='0 126 169'
col.2='41 148 184'
col.1='255 255 255'
endif
endif
if(col='grayscale' | col='gs' | col='Grayscale')
collevs=2
col.1='0 0 0'
col.2='255 255 255'
if(flipped='on')
col.2='0 0 0'
col.1='255 255 255'
endif
endif
if(col='red' | col='r' | col='Red')
collevs=2
col.1='255 255 255'
col.2='255 0 0'
if(flipped='on')
col.2='255 255 255'
col.1='255 0 0'
endif
endif
if(col='green' | col='g' | col='Green')
collevs=2
col.1='255 255 255'
col.2='0 255 0'
if(flipped='on')
col.2='255 255 255'
col.1='0 255 0'
endif
endif
if(col='blue' | col='b' | col='Blue')
collevs=2
col.1='255 255 255'
col.2='0 0 255'
if(flipped='on')
col.2='255 255 255'
col.1='0 0 255'
endif
endif
if(col='jet' | col='Jet')
collevs=9
col.1='0 0 133'
col.2='0 0 255'
col.3='0 94 255'
col.4='0 209 255'
col.5='31 255 215'
col.6='114 255 132'
col.7='255 255 0'
col.8='255 0 0'
col.9='150 0 0'
if(flipped='on')
col.9='0 0 133'
col.8='0 0 255'
col.7='0 94 255'
col.6='0 209 255'
col.5='31 255 215'
col.4='114 255 132'
col.3='255 255 0'
col.2='255 0 0'
col.1='150 0 0'
endif
endif
if(col='T2' | col='t2' | col='Terrain2' | col ='terrain2')
collevs=7
col.1='0 87 0'
col.2='57 152 6'
col.3='180 183 42'
col.4='174 169 114'
col.5='126 151 155'
col.6='221 221 221'
col.7='255 255 255'
if(flipped='on')
col.7='0 87 0'
col.6='57 152 6'
col.5='180 183 42'
col.4='174 169 114'
col.3='126 151 155'
col.2='221 221 221'
col.1='255 255 255'
endif
endif
if(col='Dark' | col='dark')
collevs=8
col.1='30 157 117'
col.2='214 95 5'
col.3='118 111 178'
col.4='230 41 137'
col.5='107 166 29'
col.6='225 170 2'
col.7='166 118 28'
col.8='103 103 103'
if(flipped='on')
col.8='30 157 117'
col.7='214 95 5'
col.6='118 111 178'
col.5='230 41 137'
col.4='107 166 29'
col.3='225 170 2'
col.2='166 118 28'
col.1='103 103 103'
endif
endif
if(col='Snow' | col='snow')
collevs=5
col.1='90 90 90'
col.2='72 146 194'
col.3='0 255 255'
col.4='100 0 255'
col.5='255 0 255'
if(flipped='on')
col.5='90 90 90'
col.4='72 146 194'
col.3='0 255 255'
col.2='100 0 255'
col.1='255 0 255'
endif
endif
if(col='Satellite' | col='satellite' | col='Sat' | col='sat')
collevs=5
col.1='0 0 0'
col.2='255 0 0 '
col.3='255 255 0'
col.4='0 0 255'
col.5='255 255 255'
if(flipped='on')
col.5='0 0 0'
col.4='255 0 0 '
col.3='255 255 0'
col.2='0 0 255'
col.1='255 255 255'
endif
endif
if(col='Rain' | col='rain')
collevs=5
col.1='0 255 0'
col.2='255 255 0 '
col.3='255 0 0'
col.4='120 0 255'
col.5='0 168 255'
if(flipped='on')
col.5='0 255 0'
col.4='255 255 0 '
col.3='255 0 0'
col.2='120 0 255'
col.1='0 168 255'
endif
endif
if(col='Autumn' | col='autumn')
collevs=5
col.1='0 0 0'
col.2='155 27 0 '
col.3='255 127 0'
col.4='255 255 132'
col.5='255 255 255'
if(flipped='on')
col.5='0 0 0'
col.4='155 27 0 '
col.3='255 127 0'
col.2='255 255 132'
col.1='255 255 255'
endif
endif
if(col='cool' | col='Cool')
collevs=4
col.1='0 255 255'
col.2='84 171 255 '
col.3='188 67 255'
col.4='255 0 255'
if(flipped='on')
col.4='0 255 255'
col.3='84 171 255 '
col.2='188 67 255'
col.1='255 0 255'
endif
endif
colsteps=(subwrd(colors,2)-subwrd(colors,1))/subwrd(colors,3)
colints=colsteps/(collevs-1)
j=2
c=1
ccols=''
bxs='0.5 8.0'
bxint=(subwrd(bxs,2)-subwrd(bxs,1))/colsteps
xloc=subwrd(bxs,1)
while(j <= collevs)
i=j-1
redint=(subwrd(col.j,1)-subwrd(col.i,1))/colints
redint=math_nint(redint)
greenint=(subwrd(col.j,2)-subwrd(col.i,2))/colints
greenint=math_nint(greenint)
blueint=(subwrd(col.j,3)-subwrd(col.i,3))/colints
blueint=math_nint(blueint)
x=1
while(x<=math_nint(colints))
if(x=1)
red=subwrd(col.i,1);green=subwrd(col.i,2);blue=subwrd(col.i,3)
else
red=red+redint;green=green+greenint;blue=blue+blueint
endif
if(red<0);red=0;endif
if(green<0);green=0;endif
if(blue<0);blue=0;endif
if(red>255);red=255;endif
if(green>255);green=255;endif
if(blue>255);blue=255;endif
'set rgb 'c+15' 'red' 'green' 'blue
if(draw =1)
'set line 'c+15
'draw recf 'xloc' 'subwrd(bys,1)' 'xloc+bxint' 'subwrd(bys,2)
endif
xloc=xloc+bxint
x=x+1
ccols=ccols' 'c+15
c=c+1
endwhile
j=j+1
endwhile
* say colints' 'colsteps' 'c' 'colints*collevs
return ccols
*****
function set_c_levs(levs)
min=subwrd(levs,1)
max=subwrd(levs,2)
int=subwrd(levs,3)
value = min
c_levs = ''
while( value <= max )
c_levs = c_levs ' ' value
value = value + int
endwhile
return c_levs
function set_c_cols(levs)
min=subwrd(levs,1)
max=subwrd(levs,2)
int=subwrd(levs,3)
value = min
c_levs = ''
color=16
while( value <= max )
c_levs = c_levs ' ' color
color = color+1
value=value+int
endwhile
return c_levs
function help()
say '---------------------------------------------------'
say '| |'
say '| colormaps.gs v1.0 |'
say '| May 2014 |'
say '---------------------------------------------------'
say 'Usage:'
say 'Sets advanced and elegant colormaps to user prescribed scales with little effort.'
say 'Includes a wide range of scales, including grayscale, and difference color maps.'
say ''
say 'Required: none, will use default values'
say ''
say 'Example: "colormaps -demo"'
say 'Draws Demo screen with all color maps'
say '---------------------------------------------------'
say ''
say 'Optional: -help - Pulls up this Help Page'
say ''
say ' BASIC OPTIONS:'
say ' -demo - Pulls up Demo page'
say ' -flipped - Reverses direction of color scale'
say ' -name/map - chooses colormap'
say ' -levels/l - sets scale: max min int'
say ''
say ' INCLUDED COLOR MAPS'
say ' QUALITATIVE MAPS:'
say ' -----------------'
say ' Paired/paired'
say ' Spectral/spectral'
say ' Rainbow/rainbow/hsv'
say ' Jet/jet'
say ' Ocean/ocean'
say ' Rain/rain'
say ' Satellite/satellite/Sat/sat'
say ' Autumn/autumn'
say ' Cool/cool'
say ' Dark/dark'
say ' Terrain1/terrain1/T1/t1'
say ' Terrain2/terrain2/T2/t2'
say ' Snow/snow'
say ''
say ' MONOCHROMATIC MAPS:'
say ' -------------------'
say ' Grayscale/grayscale/gs'
say ' Red/red/r'
say ' Green/green/g'
say ' Blue/blue/b'
say ''
say ' DIFFERENCE MAPS:'
say ' ----------------'
say ' b2r/difference1'
say ' brn2grn/difference2'
say ' y2b/difference3'
say ' oj2p/difference4'
say ''
say ''
say '---------------------------------------------------'
say ''
say 'Example: colormaps -map Terrain1 -levels 0 3500 50'
say 'This call will use the "Terrain1" colormap to set the colorscale to range from 0 to 3000 '
say 'at intervals of 50.'
say ''
say ''
cnames='Paired Spectral Rainbow Jet Ocean Rain Satellite Autumn Cool Dark Terrain1 Terrain2 Snow grayscale red green blue b2r brn2grn y2b oj2p'
say 'GENERAL NOTES:'
say ''
say 'Version 1.0: Orginially Developed by GrADS-Aholic: May 2014'
say ''
say 'All Colorscales are approximated to the best of my ability and may not be perfect'
say 'Check back in the future for updates to this script including new colorscales.'
say 'Please report any bugs to http://gradsaddict.blogspot.com/'
return
****
----------------------
End of colormaps.gs
----------------------
======================
qdims.gsf
======================
* id = fnum
* varying/fixed : number of varying/fixed dimensions
*
* xtype
* lonmin, lonmax
* xmin, xmax
* ytype
* ...
* z
* t
* e
function qdims( id )
ret = ''
'q dims'
if( id = 'fnum' )
line = sublin( result, 1 )
ret = subwrd( line, 5 )
return ret
endif
if( id = 'varying' | id = 'fixed' )
ret = 0
i = 2
while( i <= 6 )
line = sublin( result, i )
stat = subwrd( line, 3 )
if( stat = id ) ; ret = ret + 1 ; endif
i = i + 1
endwhile
return ret
endif
if( id = 'xtype' | id = 'lonmin' | id = 'lonmax' | id = 'xmin' | id = 'xmax' )
line = sublin( result, 2 )
endif
if( id = 'ytype' | id = 'latmin' | id = 'latmax' | id = 'ymin' | id = 'ymax' )
line = sublin( result, 3 )
endif
if( id = 'ztype' | id = 'levmin' | id = 'levmax' | id = 'zmin' | id = 'zmax' )
line = sublin( result, 4 )
endif
if( id = 'ttype' | id = 'timemin' | id = 'timemax' | id = 'tmin' | id = 'tmax' )
line = sublin( result, 5 )
endif
if( id = 'etype' | id = 'ensmin' | id = 'ensmax' | id = 'emin' | id = 'emax' )
line = sublin( result, 6 )
endif
type = subwrd( line, 3 )
if( id = 'xtype' | id = 'ytype' | id = 'ztype' | id = 'ttype' | id = 'etype' )
ret = type
endif
if( id = 'lonmin' | id = 'latmin' | id = 'levmin' | id = 'timemin' | id = 'ensmin' )
ret = subwrd( line, 6 )
return ret
endif
if( id = 'lonmax' | id = 'latmax' | id = 'levmax' | id = 'timemax' | id = 'ensmax' )
if( type = 'fixed' ) ; ret = subwrd( line, 6 )
else ; ret = subwrd( line, 8 ) ; endif
return ret
endif
if( id = 'xmin' | id = 'ymin' | id = 'zmin' | id = 'tmin' | id = 'emin' )
if( type = 'fixed' ) ; ret = subwrd( line, 9 )
else ; ret = subwrd( line, 11 ) ; endif
return ret
endif
if( id = 'xmax' | id = 'ymax' | id = 'zmax' | id = 'tmax' | id = 'emax' )
if( type = 'fixed' ) ; ret = subwrd( line, 9 )
else ; ret = subwrd( line, 13 ) ; endif
return ret
endif
return ret
----------------------
End of qdims.gsf
----------------------
======================
tile.gs
======================
*
* Help is in the end of this script
*
function tile( args )
_version = '0.01b1'
rc = gsfallow( 'on' )
if( args = '' )
help()
return
endif
***** Default value *****
var = 'none'
vmin = 'none'
vmax = 'none'
int = 9
color = 1
type = 5
thickness = 3
varmin = 'none'
varmax = 'none'
***** Arguement *****
i = 1
while( 1 )
arg = subwrd( args, i )
i = i + 1;
if( arg = '' ); break; endif
while( 1 )
*** option
if( arg = '-min' ); vmin = subwrd(args,i); i=i+1; break; endif
if( arg = '-max' ); vmax = subwrd(args,i); i=i+1; break; endif
if( arg = '-int' ); int = subwrd(args,i); i=i+1; break; endif
if( arg = '-color' ); color = subwrd(args,i); i=i+1; break; endif
if( arg = '-type' ); type = subwrd(args,i); i=i+1; break; endif
if( arg = '-thickness' ); thickness = subwrd(args,i); i=i+1; break; endif
*** var, min, max
if( var != 'none' & vmin != 'none' & vmax = 'none' & valnum(arg) != 0 )
vmax = arg
break
endif
if( var != 'none' & vmin = 'none' & valnum(arg) != 0 )
vmin = arg
break
endif
if( var = 'none' & valnum(arg) = 0 )
var = arg
varmin = arg
break
endif
if( varmax = 'none' & valnum(arg) = 0 )
varmax = arg
break
endif
say 'syntax error : 'arg
say 'type "tile" for help'
return
endwhile
endwhile
if( vmin = 'none' ); vmin = -1e+30; endif
if( vmax = 'none' ); vmax = 1e+30; endif
'set tile 1 'type' 'int' 'int' 'thickness' 'color
'set rgb 16 tile 1'
* for 1-D
if( qdims( 'varying' ) = 1 )
'set gxout linefill'
'set lfcols -1 16'
'd 'varmin';'varmax
* for 2-D
else
'set gxout shaded'
'set clevs 'vmin' 'vmax
'set ccols -1 16 -1'
'd 'var
endif
return
*
* help
*
function help()
say ' Name:'
say ' tile '_version' - Draw tile (hatch).'
say ''
say ' Usage:'
say ' tile ( var ( min max | -min min | -max max ) | varmin varmax ) '
say ' [-type type] [-int int]'
say ' [-color color] [-thickness thickness]'
say ''
say ' var : Variable.'
say ' varmin,varmax : variable range (only for 1D chart)'
say ' min,max : value range to be drawn (default: [-1e+30:1e+30])'
say ' varmin,varmax : range of variable to be drawn (only for 1D chart)'
say ' int : integer tile interval (default: 9)'
say ' color : hatch color (default: 1)'
say ' type : hatch line type (default: 5)'
say ' thickness : hatch line thickness between 1-12 (default: 3)'
say ''
say ' Note:'
say ' [arg-name] : specify if needed'
say ' (arg1 | arg2) : arg1 or arg2 must be specified'
say ''
say ' Only for GrADS 2.1 or later.'
say ''
say ' Copyright (C) 2015-2015 Chihiro Kodama'
say ' Distributed under GNU GPL (http://www.gnu.org/licenses/gpl.html)'
say ''
return
----------------------
End of tile.gs
----------------------
======================
sfc.ctl
======================
dset /work4/data/ERA-Interim/ERA-I.Barents_110116-26_sfc.nc
title
undef -9.99e+33
dtype netcdf
UNPACK scale_factor add_offset
OPTIONS yrev
xdef 480 linear -180 0.75
ydef 81 linear 30 0.75
zdef 1 linear 0 1
tdef 44 linear 00Z16JAN2011 360mn
vars 13
ci=>ci 0 t,y,x Sea-ice cover
sst=>sst 0 t,y,x Sea surface temperature
p55.162=>vwvp 0 t,y,x Vertical integral of water vapour
p56.162=>vclw 0 t,y,x Vertical integral of cloud liquid water
sp=>sp 0 t,y,x Surface pressure
tcwv=>tcwv 0 t,y,x Total column water vapour
msl=>msl 0 t,y,x Mean sea level pressure
u10=>u10 0 t,y,x 10 metre U wind component
v10=>v10 0 t,y,x 10 metre V wind component
t2m=>t2m 0 t,y,x 2 metre temperature
d2m=>d2m 0 t,y,x 2 metre dewpoint temperature
lcc=>lcc 0 t,y,x Low cloud cover
hcc=>hcc 0 t,y,x High cloud cover
endvars
----------------------
End of sfc.ctl
----------------------
======================
plev.ctl
======================
dset /work4/data/ERA-Interim/ERA-I.Barents_110116-26_plev.nc
title
undef -9.99e+33
dtype netcdf
UNPACK scale_factor add_offset
OPTIONS yrev zrev
xdef 480 linear -180 0.75
ydef 81 linear 30 0.75
zdef 27 levels 1000 975 950 925 900 875 850 825
800 775 750 700 650 600 550 500 450 400
350 300 250 225 200 175 150 125 100
tdef 44 linear 00Z16JAN2011 360mn
vars 10
pv=>pv 27 t,z,y,x Potential vorticity
z=>z 27 t,z,y,x Geopotential
t=>t 27 t,z,y,x Temperature
q=>q 27 t,z,y,x Specific humidity
w=>w 27 t,z,y,x Vertical velocity
r=>r 27 t,z,y,x Relative humidity
clwc=>clwc 27 t,z,y,x Specific cloud liquid water content
ciwc=>ciwc 27 t,z,y,x Specific cloud ice water content
u=>u 27 t,z,y,x U component of wind
v=>v 27 t,z,y,x V component of wind
endvars
----------------------
End of plev.ctl
----------------------