View Full Version : trigonometric average aggregation in spoon
09-17-2008, 05:17 AM
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?
09-17-2008, 10:19 AM
Hmm. Quite a blast from the past, as my second Java program ever (Java 1.0.2) was a Wind Rose generator.
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.php?&MMN_position=1:1
Might provide some direction in terms of the right tool for the job.
Hope this helps,
09-21-2008, 08:09 PM
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.
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.