[rrd-users] How store wind vector data?

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Wed Apr 9 14:36:57 CEST 2014


----- Original Message ----- 
From: "Peter" <pspiegler at gmx.de>
To: <rrd-users at lists.oetiker.ch>
Sent: Wednesday, April 09, 2014 1:40 PM
Subject: Re: [rrd-users] How store wind vector data?


> The 359-0 problem can solved easy by changing from polar coordinate system
> (velocity+direction) to cartesian coordinate system:
> Wind_X = velocity * cos(direction * PI / 180)
> Wind_Y = velocity * sin(direction * PI / 180)
>
> The normal AVERAGE aggregate function can applied to Wind_X  and Wind_Y.
>
> The back transformation is:
> velocity = Sqrt(Wind_X*Wind_X   + Wind_Y*Wind_Y)
> direction = Atan2(Wind_Y, Wind_Y) * 180 / PI
>
> I read in the rrd documentation, that calculated data source are possible.
> So a solution would be:
> Define 2 data source Wind_X, Wind_Y.
> The update program has calculate Wind_X, Wind_Y from velocity+direction.

Yeah, this could work. Split the wind into components, do this outside 
RRDtool.

For graphing and printing purposes you can combine the components using 
CDEF.

> Can I define velocity  and direction as calculated data source with the
> formulas?
> velocity = Sqrt(Wind_X*Wind_X   + Wind_Y*Wind_Y)
> direction = Atan2(Wind_Y, Wind_Y) * 180 / PI

Never mind the exact formulas (i've seen your other post). Yes, this should 
be possible with CDEF, although you may have to rewrite some of the math.




More information about the rrd-users mailing list