Re: [idvusers] Formula: vector field from direction



Don Murray wrote:
Hi Reinoud-

Reinoud Bokhorst wrote:
(second try, the first post became somehow attached to a previous post)

Hi,
I am trying to make a vector plan view from (wave) directional data. The direction field contains values in radians. So I created the following new formula:

makeVector( sin(d*180/3.14159), cos(d*180/3.14159) )

When I apply this formula all goes well, i.e. I get to select the direction field from my data source and the vector view control is shown. It correctly shows that the vector values range from -1 to 1. However, no vectors are shown in the view.. What am I doing wrong? (IDV 2.7u2)

The problem is that the names of the derived fields end up the same which confuses the display mapping. Change the name of one of the fields using the newName procedure:

makeVector(newName( sin(d*180/3.14159),"U"),cos(d*180/3.14159) )

or for completeness, change them both:

makeVector(newName(sin(d*180/3.14159),"U"),newName(cos(d*180/3.14159),"V"))

Also, I found that setting the range in the control to -.1 to .1 makes a better display.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************



Hi,
It is working now in the sense that vectors are being shown. But there is a problem when using custom lat/lon projections. It seems that the u-component is largely underestimated, i.e. my vectors always either point north- or southward.
To test this I defined another formula to make vectors with equal size u and v 
components:

 makeVector( a/a, newName(a/a, "v") )

I plotted this using 3 lat/lon projections (see attached image, zoomed in on 
Gulf of Aden):
- predefined 'world'
- predefined 'arfica'
- custom
In all 3 cases the vectors point in a different direction (they tend to rotate 
to the North).


--
Reinoud Bokhorst
Advisor Oceanography & ICT

Tel:    +31 (0)527-242 299
Fax:    +31 (0)527-242 016
Web:    www.bmtargoss.com

BMT ARGOSS P.O. Box 61, 8325 ZH Vollenhove
Voorsterweg 28, 8316 PT Marknesse
The Netherlands


PNG image