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 non-tuple NumPy indexing in MetPy #910

Merged
merged 1 commit into from
Aug 2, 2018
Merged

Fix non-tuple NumPy indexing in MetPy #910

merged 1 commit into from
Aug 2, 2018

Conversation

jthielen
Copy link
Collaborator

@jthielen jthielen commented Aug 1, 2018

Since NumPy 1.15 came out, we have been getting pages and pages of warnings about our use of non-tuple based indexing. This PR converts all of our previous list-based indexing to tuple-based indexing. This doesn't yet clear out all the warnings (some of them are upstream in Pint and scipy), but it does drop the number down from 600-something to 10-something.

Closes #900.

Since NumPy 1.15 came out, we have been getting pages and pages of
warnings about our use of non-tuple based indexing. This commit converts
all of our previous list-based indexing to tuple-based indexing. This
doesn't yet clear out all the warnings (some of them are upstream in
Pint and scipy), but it does drop the number down from 600-something to
10-something.
@jthielen jthielen added Type: Maintenance Updates and clean ups (but not wrong) Area: Tests Affects tests Area: Calc Pertains to calculations labels Aug 1, 2018
@jthielen jthielen added this to the 0.9 milestone Aug 1, 2018
left = (- big_delta / (combined_delta * delta[delta_slice0]) * f[slice0] +
combined_delta / (delta[delta_slice0] * delta[delta_slice1]) * f[slice1] -
delta[delta_slice0] / (combined_delta * delta[delta_slice1]) * f[slice2])
combined_delta = delta[tuple(delta_slice0)] + delta[tuple(delta_slice1)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh...this is ugly enough for me to want to make something to hide this absurdity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a pair of _convert_to_tuple(*args) and _convert_to_list(*args) helpers be a good approach? Or do you have an idea for another approach?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking something more OO, and possibly more automatic. I don't have anything particular in mind at the moment, but need to play with some ideas.

@dopplershift dopplershift merged commit d531f34 into Unidata:master Aug 2, 2018
@dopplershift
Copy link
Member

Any improvements to clean up the indexing code can be discussed or reference #912.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Calc Pertains to calculations Area: Tests Affects tests Type: Maintenance Updates and clean ups (but not wrong)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants