Displaying wind barbs correctly

Hi All,

Lets say I've got data of MathType ((lat,lon)->(u,v)) and I want to
display this using wind barbs (where u = x component of wind and v = y component).

To do this, I create scalar maps of u mapped to Flow1X and v to Flow1Y.
I then need to call "setRange" on these scalar maps eg:
uMap.setRange(-3.0, 3.0);
vMap.setRange(-3.0, 3.0);

If I don't do this, then the windbarbs display as "calm" (0 knots).
If I choose -3 to 3, then it displays correctly (5 knots in the example
below).
If I choose other numbers (eg -1 to 1) then the wind barb displays
incorrectly (10 knots in the example below).

Can anyone explain why?

Thanks,

James

Above problem is illustrated by the jython code (and data file) below,
which incorrectly displays a 5 knot wind as 10 knot wind barbs:

from visad.python.JPythonMethods import *
from visad import RealType, Real, FunctionType, FlatField, RealTuple,
ScalarMap, Display
from visad.data.text import TextAdapter
from visad.bom import BarbRendererJ3D

import subs, graph, sys

width = 800
height = 600

textAdapter = TextAdapter("uv.txt")

data = textAdapter.getData()
print data

uType = RealType.getRealType("U")
vType = RealType.getRealType("V")

latitudeType = RealType.Latitude
longitudeType = RealType.Longitude

xMap = ScalarMap(longitudeType, Display.XAxis)
yMap = ScalarMap(latitudeType, Display.YAxis)
uMap = ScalarMap(uType, Display.Flow1X)
vMap = ScalarMap(vType, Display.Flow1Y)

dataRenderer = BarbRendererJ3D()

maps = (xMap, yMap, uMap, vMap)
disp = subs.makeDisplay(maps)

uMap.setRange(-1.0, 1.0);
vMap.setRange(-1.0, 1.0);
flowU_control = uMap.getControl()
flowV_control = vMap.getControl()
flowU_control.setFlowScale(0.1)
flowV_control.setFlowScale(0.1)

dr=subs.addData("test_uv", data, disp, None, dataRenderer, None)

subs.setBoxSize(disp, .80)
subs.setAspectRatio(disp, float(width)/float(height))
subs.showDisplay(disp,width,height,"Test UV")

uv.txt contains the following:

(Longitude, Latitude) -> (U, V)
Latitude, Longitude, U, V
-12.4, 131.8, 5.0, 5.0
-16.9, 133.7, 5.0, 5.0
-14.4, 134.8, 5.0, 5.0
-15.4, 135.8, 5.0, 5.0

--
James Kelly
Meteorological Systems Section                    Bureau of Meteorology
PO Box 1289K                                  Melbourne 3001, Australia



  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: