clouddrift.wavelet.morse_spherical_wavelet_transform

clouddrift.wavelet.morse_spherical_wavelet_transform#

clouddrift.wavelet.morse_spherical_wavelet_transform(lat: ndarray, lon: ndarray, gamma: float, beta: float, radian_frequency: ndarray, radius: float = 6378100.0, complex: bool = False, time_axis: int = -1, normalization: str = 'bandpass', boundary: str = 'periodic', order: int = 1) tuple[ndarray, ndarray][source]#

Spherical wavelet transform for oscillations on the surface of a sphere.

This implements a version of the wavelet transform appropriate for analyzing oscillations in latitude and longitude on the surface of a sphere.

Parameters#

latarray-like

Latitude in degrees.

lonarray-like

Longitude in degrees.

gammafloat

Gamma parameter of the Morse wavelets.

betafloat

Beta parameter of the Morse wavelets.

radian_frequencyarray-like

Array of radian frequencies at which the Fourier transform of the wavelets reach their maximum amplitudes.

radiusfloat, optional

Sphere radius in meters (default: Earth radius).

complexbool, optional

Specify if the input signal is complex. Default is False. This affects normalization and interpretation of outputs.

time_axisint, optional

Axis on which time is defined for input arrays (default is last, or -1).

normalizationstr, optional

Normalization for wavelet transforms. Options: - “bandpass”: bandpass normalization (default), - “energy”: unit energy normalization.

boundarystr, optional

Boundary condition at edges. Options: - “periodic”: periodic boundary (default), - “mirror”: mirror boundary, - “zeros”: zero padding.

orderint, optional

Order of Morse wavelets (default is 1).

Returns#

wxh, wyhtuple[np.ndarray, np.ndarray]

Horizontal components of the wavelet transform projected onto tangent plane.

Notes#

  • This function was ported over from Jonathan Lilly’s jLab, which you can read about here:

    “Lilly, J. M. (2024), jLab: A data analysis package for Matlab, v.1.7.3, doi:10.5281/zenodo.4547006, http://www.jmlilly.net/code.”

Examples#

Apply a wavelet transform to the displacement of GDP drifter “Betty” (id 44000) with a Morse wavelet with gamma parameter 3 and beta parameter 2:

>>> from clouddrift import datasets, ragged, wavelet
>>> ds = datasets.gdp1h()
>>> ds_betty = ragged.subset(ds, {"id": [44000]}, row_dim_name="traj")
>>> freqs = wavelet.morse_logspace_freq(3, 2, len(ds_betty["time"]))
>>> wxh, wyh = wavelet.morse_spherical_wavelet_transform(ds_betty["lat"], ds_betty["lon"], 3, 2, freqs)