improver.utilities.complex_conversion module

improver.utilities.complex_conversion module#

complex_to_deg(complex_in)[source]#

Converts complex to degrees.

The “np.angle” function returns negative numbers when the input is greater than 180. Therefore additional processing is needed to ensure that the angle is between 0-359.

Parameters:

complex_in (ndarray) – 3D array - direction angles in complex number form.

Return type:

ndarray

Returns:

3D array - direction in angle form

Raises:

TypeError – If complex_in is not an array.

deg_to_complex(angle_deg, radius=1)[source]#

Converts degrees to complex values.

The radius argument can be used to weight values. Defaults to 1.

Parameters:
  • angle_deg (Union[ndarray, float]) – 3D array or float - direction angles in degrees.

  • radius (Union[ndarray, float]) – 3D array or float - radius value for each point, default=1.

Return type:

Union[ndarray, float]

Returns:

3D array or float - direction translated to complex numbers.