validate_reference_vector#

movement.validators.arrays.validate_reference_vector(reference_vector, test_vector)[source]#

Validate a reference vector being used in a calculation.

Reference vectors must contain the same number of time points as the test_vector, in order to be used in computations with them. Vector-like objects that are passed in are converted into xr.DataArray``s and inherit the ``test_vector``s ``"time" axis.

Parameters:
  • reference_vector (xarray.DataArray | numpy.ndarray) – The reference vector to validate, and convert if necessary.

  • test_vector (xarray.DataArray) – The test vector to compare against. The reference vector must have the same number of time points as the test vector.

Returns:

A validated xarray DataArray.

Return type:

xarray.DataArray

Raises:
  • ValueError – If shape or dimensions do not match the expected form.

  • TypeError – If reference_vector is neither a NumPy array nor an xarray DataArray.