clouddrift.kinematics.kinetic_energy

Contents

clouddrift.kinematics.kinetic_energy#

clouddrift.kinematics.kinetic_energy(u: float | list | ndarray | DataArray | Series, v: float | list | ndarray | DataArray | Series | None = None) float | ndarray | DataArray[source]#

Compute kinetic energy from zonal and meridional velocities.

Parameters#

ufloat or array-like

Zonal velocity.

vfloat or array-like, optional.

Meridional velocity. If not provided, the flow is assumed one-dimensional in time and defined by u.

Returns#

kefloat or array-like

Kinetic energy.

Examples#

>>> import numpy as np
>>> from clouddrift.kinematics import kinetic_energy
>>> u = np.array([1., 2., 3., 4.])
>>> v = np.array([1., 1., 1., 1.])
>>> kinetic_energy(u, v)
array([1. , 2.5, 5. , 8.5])
>>> u = np.reshape(np.tile([1., 2., 3., 4.], 2), (2, 4))
>>> v = np.reshape(np.tile([1., 1., 1., 1.], 2), (2, 4))
>>> kinetic_energy(u, v)
array([[1. , 2.5, 5. , 8.5],
       [1. , 2.5, 5. , 8.5]])