clouddrift.signal.cartesian_to_rotary

clouddrift.signal.cartesian_to_rotary#

clouddrift.signal.cartesian_to_rotary(ua: ndarray | DataArray, va: ndarray | DataArray, time_axis: int = -1) tuple[ndarray, ndarray][source]#

Return rotary signals (wp,wn) from analytic Cartesian signals (ua,va).

If ua is the analytic signal from real-valued signal u, and va the analytic signal from real-valued signal v, then the positive (counterclockwise) and negative (clockwise) signals are defined by wp = 0.5*(up+1j*vp), wp = 0.5*(up-1j*vp).

This function is the inverse of rotary_to_cartesian().

Parameters#

uaarray_like

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

vaarray_like

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

time_axisint, optional

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

Returns#

wpnp.ndarray

Complex-valued positive (counterclockwise) rotary signal.

wnnp.ndarray

Complex-valued negative (clockwise) rotary signal.

Examples#

To obtain the rotary signals from a pair of real-valued signal:

>>> u = np.random.rand(99)
>>> v = np.random.rand(99)
>>> wp, wn = cartesian_to_rotary(analytic_signal(u), analytic_signal(v))

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

>>> u = np.random.rand(100, 99)
>>> v = np.random.rand(100, 99)
>>> wp, wn = cartesian_to_rotary(analytic_signal(u), analytic_signal(v), 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(), rotary_to_cartesian()