compute_signed_angle_2d
is overzealous in what it will operate on
#437
Labels
bug
Something isn't working
Describe the bug
First reported here.
compute_signed_angle_2d
can theoretically work whenv
is given as anyxarray.DataArray
that can be broadcast againstu
, but it insists on only havingspace
andtime
dimensions.Expected behaviour
This function should broadcast across
DataArray
dimensions, deferring to thexarray
implementation.Additional Context
The
validate_reference_vector
function itself is very much overkill, in hindsight. If the user providesv
as aDataArray
, we shouldn't need to perform all the checks that are included in this function, sincexarray
will throw an error stating the same problem when it tries to broadcast the arrays in the following calculations. These requirements are also listed in the docstring, so if the user encounters such an error, they were already warned (and will have to work quite hard to actively engineer this situation anyway).I propose to remove this validator function, as it is only used in
compute_signed_angle_2d
. We can move the tests that still have relevance to the tests forcompute_signed_angle_2d
itself. As for the case whenv
is supplied as anp.ndarray
, we can handle this with much faster logic insidecompute_signed_angle_2d
itself.The text was updated successfully, but these errors were encountered: