clouddrift.signal.rotary_to_cartesian

clouddrift.signal.rotary_to_cartesian#

clouddrift.signal.rotary_to_cartesian(wp: ndarray | DataArray, wn: ndarray | DataArray, time_axis: int | None = -1) tuple[ndarray, ndarray][source]#

Return Cartesian analytic signals (ua, va) from rotary signals (wp, wn) as ua = wp + wn and va = -1j * (wp - wn).

This function is the inverse of cartesian_to_rotary().

Parameters#

wparray_like

Complex-valued positive (counterclockwise) rotary signal.

wnarray_like

Complex-valued negative (clockwise) rotary signal.

time_axisint, optional

The axis of the time array. Default is -1, which corresponds to the last axis.

Returns#

uaarray_like

Complex-valued analytic signal, first Cartesian component (zonal, east-west)

vaarray_like

Complex-valued analytic signal, second Cartesian component (meridional, north-south)

Examples#

To obtain the Cartesian analytic signals from a pair of rotary signals (wp,wn):

>>> ua, va = rotary_to_cartesian(wp, wn)

To specify that the time axis is along the first axis:

>>> ua, va = rotary_to_cartesian(wp, wn, time_axis=0)

Raises#

ValueError

If the input arrays do not have the same shape. If the time axis is outside of the valid range ([-1, N-1]).

References#

Lilly JM, Olhede SC. 2010 Bivariate instantaneous frequency and bandwidth. IEEE T. Signal Proces. 58, 591–603. (10.1109/TSP.2009.2031729)

See Also#

analytic_signal(), cartesian_to_rotary()