Options

"Aggregate package vs custom aggregate functions"

pyronaidpyronaid Member Posts: 4 Contributor I
edited June 2019 in Help
Hi,
i want to use the package "aggregate" to group some record in one, group by one attribute.
I have a problem because i've an attribute named "wind direction" with values [0-360]

i need to use a custom aggregate function instead of simply average that not consider periodicity of grades.

the custom function should make this:

aMin = min(anglesList)
aMax = max(anglesList)
if (aMax - aMin) < 180
return media(anglesList)
else
for a in anglesList
if a < 180 : a += 360
M = media(anglesList)
if M >= 360 : M -= 360
return M


id- angle - value 2
1      -  10        - 20
2      -  150        - 25
3      -  36        - 8
1      -  350        - 18
2      -  225        - 29
3      -  27        - 11
1      -  330          - 24
2      -  14        - 20
3      -  20        - 3
1    -  20        - 3


aggregate should produce this:
1 - 357.5 - 65

there's a possibility to make this???
Tagged:
Sign In or Register to comment.