# Thread: trigonometric average aggregation in spoon

1. Member
Join Date
Feb 2007
Posts
38

## trigonometric average aggregation in spoon

Hi all,

I have to do a trigonometric mean for my "wind direction" data. For this I'd like to find into "Group by" step this type of aggregation function.

Are there any future plans for that?

Thanks.

2. Member
Join Date
Oct 2007
Posts
76
Hmm. Quite a blast from the past, as my second Java program ever (Java 1.0.2) was a Wind Rose generator.

The short answer to the PDI-specific question is that a JavaScript Value step probably exposes the functionality you need.

However, "trigonometric mean" seems to be an iffy approach to calculating prevailing wind direction (presumably what you're after with "average direction"). See this discussion: http://www.control.com/1026210133/index_html and the Canadian weather service's opinion on how to calculate prevailing wind direction: http://www.webmet.com/met_monitoring/621.html

A good example of folks who've extended PDI's capabilities to deal with custom data types and spatial computations can be found at the GeoKettle site : http://geosoa.scg.ulaval.ca/en/index...N_position=1:1

Might provide some direction in terms of the right tool for the job.

Hope this helps,

John

3. Junior Member
Join Date
Jun 2008
Posts
8
Hi saphiro,

I have heard about your message on the forum (thanks John! ). I am the project coordinator of GeoKettle (a extended version of Kettle which supports spatial datatypes and computations), the project mentioned by John in his previous reply.

I do not know how are stored the wind vectors in your data sources but I confirm that the step to consider is the "Modified Javascript Value" step. That is by this way we achieve the handling of geometrical properties of geospatial objects in GeoKettle. We have developed GeoKettle so that this step exposes all the methods of the GM_Object class (see http://oxygene-project.sourceforge.n...GM_Object.html for more details). This class is part of the GeOxygene framework, another geospatial project I have designed and developed in the past. GeOxygene provides a standardised way (i.e. implements geospatial standards) to handle geospatial objects.

So let us suppose your wind vectors are stored as a single point (which stores the vector coordinates) in a geometry column of your DBMS, you will be able to access this geometrical features through the "Modified Javascript Value" step in GeoKettle. For instance, to access to the coordinates, you could use the following syntax, where v is the current object:

var geom = v.getGeometry();
var coords = geom.coord();

var X = coords.get(0).get(X);
var Y = coords.get(0).get(Y);

It is then easy to make some scalar computations in order to assess the prevailing wind direction.

I hope it helps and provides you with some ideas on how to address your specific problem.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•