grads 的一些記事
1. 使用 ! 命令在script中的格式
UNIX下沒什問題,主要是WINDOWS下路徑的使用
格式範例:
'! d:/mob/shell/bash.exe d:/Dropbox/pic/cloudall/couple.sh'
說明:目錄要用UNIX的反斜線(與目錄使用相反,此為grads的命令呼叫,是UNIX格式,路徑是定義給WINDOWS用的,所以剛好相反),
整個指令要框在 ' ' 中,如果指令中有先前定義的變數,就照grads正常的方式將變數放在 '外面
2. 承上,
呼叫bash去執行的SHELL內容,因為windows不懂 #!/d:\... 這類的敘述,只能使用bash.exe 去呼叫寫好SHELL的文字內容。
文字內容中WINDOWS的路徑 \ 要用 / 替換
3. 等值線標籤的控制:set clab
on 開啟 'fast' contour labels are plotted where the contour lines are horizontal
off 關閉 no contour labels
forced 每條都要標示 an attempt is made to label all contour lines
format gives a C-language template for conversion of the contour value to a string
masked 不要白色背景 (version 2.0.a6+) contour lines have gaps for the labels, so rectangles for label background are not drawn; contour labels never overlap.
4. '!shell ' 的指令中,輸出的文字內容無法回給grads中的,必須要用 ">filename"存下來
再用readfile=read('filename')讀入該文字
讀入後再用sublin(readfile,2)得到文字字串。
(記得結束後要close(filename),免得下一個迴圈會出錯
5. 轉換 UTC 時間為LOCAL TIME
a.當輸出為1小時間隔時,要得到GMT+8小時的地方時間可以用 'set t tt+8'(tt為當時的UTC時間)得到localtime,
設置後用q time取得時間,再將時間設回'set t tt'原時間。
b.如果時間間隔不是1 hr,2 hr , 4 hr就無法得到地方時,此時要得到地方時就要用
這個方式可以不用寫程式就得到地方時,很方便!
6. 在溫度後面加上度C的符號
a.使用contour時, set clab %.0f`3.`1C
%.2f是指小數點下2位 顯示
b.使用draw string 寫文字時 0`3.`1C
OTHER
#####
#for wind vector
'set gxout vector'
#for windspeed 10,20,30,40 KT
'set rbcols 70 71 72 73'
'set clevs 0 10 20 30 40'
#向量標示的顏色會依上面風速改變
'set lwid 22 4' #定義22為寬度4的"粗細",給下方指令使用
'set cthick 22'
'set arrscl 0.4 80' #此行設置向量大小,意指80的風速長度是0.4
'set arrowhead 0.15' 向量箭頭的大小
'set arrlab off' 下方箭頭範例的開關
'd skip(maskout(ugrdprs*2,mag(ugrdprs,vgrdprs)*2-10),10,10);skip(maskout(vgrdprs*2,mag(ugrdprs,vgrdprs)*2-10),10,10);mag(ugrdprs,vgrdprs)*2'
上行指令說明:
SKIP(var,x-num,y-num) 忽略幾個網格繪製一個標示
maskout(var,num) 針對變數VAR,大於零的繪製、小於等於零的不畫,此處範例指風速小於10的不畫