Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

pastax.metric

Along-trajectory metrics for evaluating Lagrangian simulation quality.

Every metric here is a broadcasting function of two trajectories, f(y, y_ref), whose last two axes are (time, 2) and whose leading axes broadcast under standard NumPy/JAX rules. A metric therefore works transparently on a single trajectory (T, 2), an ensemble (S, T, 2), or any batched/broadcast pair — no ensemble flag required.

Because they satisfy the same broadcasting contract as the kernels in pastax.score, these metrics double as energy-score kernels, e.g. energy_score(forecast, obs, kernel=liu_index, reduce="last").

separation_distance

pastax.metric.separation_distance(y, y_ref)

Point-wise great-circle distance between y and y_ref.

Parameters
  • y (Float[jaxlib._jax.Array, '*batch time 2'])Predicted trajectory/-ies, shape (..., T, 2).

  • y_ref (Float[jaxlib._jax.Array, '*#batch time 2'])Reference trajectory, shape (..., T, 2); broadcasts against y.

Returns

Distance at each time step in metres, shape (..., T).

Return type

Float[jaxlib._jax.Array, ‘*batch time’]

normalized_separation_distance

pastax.metric.normalized_separation_distance(y, y_ref)

Instantaneous separation normalised by cumulative reference arc length.

NSDt=sep_distttrav_distt\mathrm{NSD}_t = \frac{\mathrm{sep\_dist}_t}{\mathrm{trav\_dist}_t}

where sep_distt\mathrm{sep\_dist}_t is the separation distance at time tt and trav_distt\mathrm{trav\_dist}_t is the reference trajectory travel distance at time tt.

Parameters
  • y (Float[jaxlib._jax.Array, '*batch time 2'])Predicted trajectory/-ies, shape (..., T, 2).

  • y_ref (Float[jaxlib._jax.Array, '*#batch time 2'])Reference trajectory, shape (..., T, 2); broadcasts against y.

Returns

Dimensionless normalised separation, shape (..., T).

Return type

Float[jaxlib._jax.Array, ‘*batch time’]

liu_index

pastax.metric.liu_index(y, y_ref)

Liu & Weisberg (2011) normalised cumulative Lagrangian separation.

Liut=cumsum(sep_dist)tcumsum(trav_dist)t\mathrm{Liu}_t = \frac{\operatorname{cumsum}(\mathrm{sep\_dist})_t} {\operatorname{cumsum}(\mathrm{trav\_dist})_t}

where sep_distt\mathrm{sep\_dist}_t is the separation distance at time tt and trav_distt\mathrm{trav\_dist}_t is the reference trajectory travel distance at time tt. The denominator is thus a double cumulative sum of the per-step distances.

Reference: Liu & Weisberg (2011), J. Geophys. Res.

Parameters
  • y (Float[jaxlib._jax.Array, '*batch time 2'])Predicted trajectory/-ies, shape (..., T, 2).

  • y_ref (Float[jaxlib._jax.Array, '*#batch time 2'])Reference trajectory, shape (..., T, 2); broadcasts against y.

Returns

Dimensionless Liu Index, shape (..., T).

Return type

Float[jaxlib._jax.Array, ‘*batch time’]