Python Annotation - Variable for Velocity Magnitude and x,y,z direction

I like to measure the mean velocity (magnitude and x,y and z direction) with a python annotation.

What is the right variable for it ? I tried
mean(U(inputs[0])) for the magnitude
mean(Velocity(inputs[0])) for the magnitude
mean(Ux(inputs[0])) in x direction
mean(U_x(inputs[0])) in x direction
mean(Velocityx(inputs[0])) in x direction
mean(Velocity_x(inputs[0])) in x direction
nothing works out.

What is the right variable for the velocity magnitude and in the directions ?

Cheers
Schneider

The right formula would depends on the name of your arrays.
Alternatively, you can use descriptive statistics filter.

Ok,
is there a predefined variable for the velocity in x, y, z direction and the magnitude ?

I can display the mean velocity, i used the code

mean(U)

this ist the (Ux+Uy+Uz)/3.

Not sure to follow what is your question.

If “U” is your vector, the U_X, U_Y, U_Z are the directional scalars and mag(U) the magnitude.

Thank you very much Mathieu Westphal !

Now, its getting clearer to me.

In example i got an array U = [ 7, 3, -4; 5, -2, 9; 1, 6 , 4]

The Ux component is [7, 5, 1], the Uy component [3, -2, 6] and Uz [ -4, 9, 4]
So i tried to isolate the Ux components with mean((U) * (1,0,0) this will change the U array to

U = [ 7, 0, 0; 5, 0, 0; 1, 0 , 0]

The mean U value is (7+0+0+5+0+0+1+0+0) / 9 and this is not what i want.
Is has to be (7+5+1) / 3.

So i search for a way to extract the Ux, y and z components into a vector and get the mean value out of it.

To be honest, this is more a python question than a ParaView question here.

what about mean(U_X) ?

yes it is, you are right.

Its for U_x mean(U[:,0]).
https://www.python-kurs.eu/numpy_arrays_erzeugen.php

: for all rows and 0 for the first column like x.

best regards
kai