NCL中有多個函式可以繪製風向杆
垂直剖面圖的風向杆
Important note: by default, NCL maps the vector direction into the underlying coordinate space. This works well when drawing vectors on a map projection, but for vertical plots where the two coordinate axes have different units that have very different numerical spacing between the coordinate values, it leads to distortion. If you are seeing this issue, try setting the resource vcMapDirection to False. This resource now defaults to False for this function in NCL V6.2.0.
對於舊版本的NCL,在垂直剖面圖中,需要將vcMapDirection設定成False.
wrf_vector函式
在ncl繪圖中wrf_vector函式,預設繪製風向杆樣式“WindBarb"。而關於WindBarb的說明是這樣的:
WindBarb
Vectors are represented using a standard wind barb glyph, composed of a shaft parallel to the vector direction, and pennants and/or ticks spaced at even intervals along the shaft starting at the end nearest the direction from which the flow is coming. (For the purposes of the vcPositionMode resource, this end is the "tail" of the wind barb.) If the velocity is less than 2.5 in magnitude, a circle is drawn instead of the barbed shaft. Otherwise half ticks represent 5 units of magnitude, full ticks represent 10 units, and pennants represent 50 units. By convention, the units usually represent knots. The pennants are drawn using a filled polygon, while the ticks, the shaft, and the calm circle are all rendered with polylines. Unlike the other glyph styles, wind barbs maintain a basically uniform length for all magnitudes. Resources prefixed by vcWindBarb... have an effect when vcGlyphStyle is set to this value.----https://www.ncl.ucar.edu/Document/Graphics/Resources/vc.shtml#vcGlyphStyle
意為風速低於2.5個單位,WindBarb畫圓圈,5個單位畫短風向杆,10個單位畫長風向杆,50個單位畫三角旗。其中約定,一個單位表示一節(1 knot)。
由上可知,NCL中,短風向杆:長風向杆:三角旗表示的風速比為 5節:10節:50節,即1:2:10
而根據我國氣象標準,短風向杆、長風向杆、三角旗的定義如下:
風矢用來表示風,由風向杆和風羽組成。風向杆指出風的來向,有8個方位,分別為北、東北、東、東南、南、西南、西、西北。風羽是指垂直在風向杆末端右側(北半球)的短劃線和小三角,用來表示風速,長劃代表4米/秒,短劃代表2米/秒,三角形代表20米/秒。
----https://www.cma.gov.cn/2011xzt/kpbd/gale/2018050902/201807/t20180717_473666.html
可以發現,單位為m/s的情況下,短風向杆:長風向杆:三角旗的風速比為2米/秒:4米/秒:20米/秒,即1:2:10。巧合的是,他們之間的比例和和NCL一樣。這樣就可以透過將風速的數值乘上一個係數,使NCL適配中國的風向杆標準。而NCL恰好有這樣一個比例係數vcWindBarbScaleFactorF。
vcWindBarbScaleFactorFThis resource sets the factor by which the vector magnitudes as calculated by the wind barb drawing routines are to be scaled. It can be used to convert vector data given in other units into the conventional units used with wind barbs, which is knots. Note that this scale factor resource is entirely independent of the vcMagnitudeScaleFactorF and vcMagnitudeScaleValueF resources which influence numerical strings in annotations associated with VectorPlot. This resource has an effect only when vcGlyphStyle is set to
WindBarb
.----https://www.ncl.ucar.edu/Document/Graphics/Resources/vc.shtml
翻譯:
`vcWindBarbScaleFactorF` 資源設定用於風羽繪製例程計算的向量大小的縮放因子。它可用於將其他單位的向量資料轉換為風羽常用的單位(節)。請注意,該縮放因子資源與 `vcMagnitudeScaleFactorF` 和 `vcMagnitudeScaleValueF` 資源完全獨立,後者影響與 VectorPlot 相關的數值註釋。本資源僅在 `vcGlyphStyle` 設定為 WindBarb 時生效。
預設值:1.0
需要說明的是,只需要保證我們的2m/s對應NCL識別的數值2、4m/s對應NCL識別的數值10,20m/s對應NCL識別的數值50就可以。NCL畫風向量圖不考慮單位,只看字面上的數值大小。所以這個係數,應當為兩者數值的比,即數字相除(忽略單位,僅需要比較數字大小),vcWindBarbScaleFactorF=5 (節)/2(m/s) 在短風向杆情況下 = 10 (節)/4(m/s) 在長風向杆情況下=50(節)/20(m/s) 在三角旗情況下=2.5
所以,vcWindBarbScaleFactorF=2.5
上述屬性針對與ncl的vector相關函式,如gsn_csm_vetror, wrf_vector之類。而這些函式也有一個缺陷,就是必須要求為風向量為二維陣列,無法繪製站點風向量資料。
繪製站點風向量,NCL有一個畫風向杆的函式wmbarb,這個函式沒有放大係數的引數的選項,故需要手動將風速的數值乘以一個係數2.5,然後NCL把這個乘過之後的數值,用NCL的規矩(5節為短杆,10節為長杆,50節為三角旗)進行繪圖。
可以參考這個例子:
For example, since by convention the feather end of a wind barb points in the direction where the wind is coming from, to draw a wind barb that indicates a wind coming from the north at 20 knots with tip at (0.,0.), you would make the call:
wmbarb(wks,0.,0.,0.,20.)To shift the direction of how the wind barbs are drawn by 180 degrees, set the control parameter WDF to 1.
To set parameters to control the appearance of a wind barb, such as its size, color, and so forth, use the wmsetp procedure. To retrieve parameter values, use the function wmgetp.
這個wmbarb函式就是畫風速為20節的北風(2個長杆)
實際中國氣象風向杆的場景下(風速單位米每秒,2米每秒為短杆,4米每秒為長杆,20米每秒為三角旗),風速應乘以2.5.
如,對於實際風速為15m/s的正北風,繪圖命令為 wmbarb(wks, 0.5, 0.5, 0, 15*(2.5))