NCL绘制风向杆

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的说明是这样的:

WindBarbVectors 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个长杆)注意,NCL的风向杆默认单位是节

实际中国气象风向杆的场景下(风速单位米每秒,2米每秒为短杆,4米每秒为长杆,20米每秒为三角旗),即段杆、长杆、三角旗的数值分别为2、4、20,为保持和NCL的规矩一致,风速的数值应乘以2.5.

如,对于实际风速为15m/s的正北风,绘图命令为 wmbarb(wks, 0.5, 0.5, 0, 15*(2.5))

posted @ 2024-10-30 12:54  chinagod  阅读(82)  评论(0编辑  收藏  举报