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

Update scipy dependency to v0.13.2 #934

Merged
merged 2 commits into from
Jan 15, 2014

Conversation

DPeterK
Copy link
Member

@DPeterK DPeterK commented Jan 13, 2014

This updates the scipy dependency in Iris to v0.13.2, with backward compatibility to v0.11.0 maintained.

Notable issues encountered in updating this dependency were changes in array ordering, usually from 'F' to 'C' ordering and a change in the behaviour of scipy.interpolate.interpolate.interp1d.

Some CML changes made on account of the array ordering differences.

The changes to interp1d remove previous incorrect behaviour that changed the ordering of the y array internally to the function. As iris.analysis.interpolate.Linear1dExtrapolator was written based on this incorrect behaviour, to maintain backward compatibility and make minimal code changes, this behaviour is tested for, with the y array's order changed as necessary.

Closes #493

@@ -874,6 +874,32 @@ def __init__(self, interpolator):
.. note:: These are stored with the interpolator.axis last.

"""
# Roll interpolator.axis to the end if scipy no longer does it for us.
if not self._interp1d_rolls_y():
Copy link
Member

Choose a reason for hiding this comment

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

How about we make this check once instead of on every use?

Copy link
Member

Choose a reason for hiding this comment

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

Still need to address this issue @dkillick.

You could perform a module level test and refer to the global result to determine whether to roll or not ...

Copy link
Member Author

Choose a reason for hiding this comment

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

Mm, but I was under the impression that setting module-level variables was not best practice? Also, surely the processing cost in repeating this test is not great?

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I'm with you on this one @dkillick. We'll leave it as is. If anyone is mortally offended then its an isolated patch to change.

Copy link
Member

Choose a reason for hiding this comment

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

I've no real aversion to a "private" module variable. Or you could have a class attribute computed by a private module function.

@ghost ghost assigned bjlittle Jan 14, 2014
@@ -874,6 +874,32 @@ def __init__(self, interpolator):
.. note:: These are stored with the interpolator.axis last.

"""
# Roll interpolator.axis to the end if scipy no longer does it for us.
if not self._interp1d_rolls_y():
self.y = np.rollaxis(self.y, self._interpolator.axis, self.y.ndim)
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this just self.y = self.y.T ... or am I misunderstanding?

Copy link
Member Author

Choose a reason for hiding this comment

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

For a 2-dimensional case yes! But it may not always be 2D...

Copy link
Member

Choose a reason for hiding this comment

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

Ahhh, okay ... so that would mean that you've got supporting tests to show that it's behaving for non-2D situations 😉 ...

Copy link
Member Author

Choose a reason for hiding this comment

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

So there is test_interpolation.TestLinearExtrapolator.test_simple_3d_axis1 that uses interp1d on a (3, 4, 2) array and extrapolates along axis=1 and does not fail...

Copy link
Member

Choose a reason for hiding this comment

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

Good sleuth work @dkillick!

@bjlittle
Copy link
Member

@dkillick you've got a bunch of test failures with [email protected] ... is that expected?

@DPeterK
Copy link
Member Author

DPeterK commented Jan 14, 2014

@bjlittle that's odd, all my tests are fine, and Travis says all is well too. Have you fetched upstream? This branch does rely on other merges, notably those from branches from @rhattersley

@bjlittle
Copy link
Member

My fault @dkillick, I was pointing to a different Cartopy version, phew!

@bjlittle
Copy link
Member

👍 Working fine for NumPy v1.7.2 and SciPy 0.13.2 ... just need to address one last issue and then we're good to merge @dkillick!

@bjlittle
Copy link
Member

@dkillick could you please squash your commit history, then I'll merge, ta!

@DPeterK
Copy link
Member Author

DPeterK commented Jan 14, 2014

Squish

@bjlittle
Copy link
Member

See DPeterK#4 ...

@ajdawson
Copy link
Member

Just a reminder for this to close #493 when merged.

@bjlittle
Copy link
Member

Do you wanna squish again @dkillick ? ... and thanks @ajdawson!

@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

Re-squished.

@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

@esc24 has requested a couple of minor docstring changes so I'm going to go ahead and make them and then hopefully push the final commit to this PR!

@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

Docstring changes made.

@bjlittle
Copy link
Member

Seem to have a Travis Pandas issue ... I'm investigating

@bjlittle
Copy link
Member

Travis is now using the latest pandas v0.13.0 which is causing the test failures.

@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

When did that start happening?

@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

@esc24 says he is literally about to jump on fixing this!

@bjlittle
Copy link
Member

Okay, after investigating I'm happy that this PR isn't the cause of the Tavis test failures, so we're good to go @dkillick 👍 , thanks!

bjlittle added a commit that referenced this pull request Jan 15, 2014
@bjlittle bjlittle merged commit 1ca4dfd into SciTools:master Jan 15, 2014
@DPeterK
Copy link
Member Author

DPeterK commented Jan 15, 2014

Woop 😄 Thanks @bjlittle!

@DPeterK DPeterK deleted the scipy_0-13-2_interpolate branch January 15, 2014 11:26
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.

Errors with scipy 0.12.0
4 participants