Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing test_time_variable #145

Conversation

mcflugen
Copy link
Collaborator

This pull request fixes a failing test in test_strat.py. I believe it is caused by how numpy2 interacts with xarray DataArrays.

The error is caused by the following,

np.linspace(0, float(golfcube.t[-1]), num=5)

which raised the following error,

ValueError: dimensions () must have the same length as the number of data dimensions, ndim=1

I've fixed this by converting golfcube.t[-1] to a float (rather than a DataArray).

I could, instead, have done the following

np.linspace(0, golfcube.t[-1].data, num=5)

Both seem to work and are backward compatible.

@mcflugen
Copy link
Collaborator Author

@amoodie This should fix the failing test we talked about this afternoon.

@mcflugen mcflugen merged commit 3ed9851 into sandpiper-toolchain:develop Dec 2, 2024
1 check failed
@mcflugen mcflugen deleted the mcflugen/fix-failing-time-variable-test branch December 2, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant