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: Update numpy deprecation of product and test dependency issues #38

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

cssherman
Copy link
Collaborator

@cssherman cssherman commented Sep 3, 2024

Temporary testing branch: GEOS-DEV/GEOS#3328

@cssherman cssherman self-assigned this Sep 3, 2024
@cssherman cssherman requested a review from rrsettgast September 3, 2024 19:22
@cssherman cssherman changed the title Fixing numpy deprecation of product fix: Update numpy deprecation of product Sep 3, 2024
@cssherman
Copy link
Collaborator Author

@rrsettgast - it looks like this fixed the deprecation issue on the CI machine

Comment on lines +36 to +37
ta = np.ascontiguousarray( np.squeeze( ta ) )
tb = np.ascontiguousarray( np.squeeze( tb ) )
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think that the issue we ran into was due to these time vectors changing shape from (N,) to (N, 1) was the issue that triggered the interpolation issue.

xc = np.reshape( xa, ( N[ 0 ], S ) )
xd = np.zeros( ( len( tb ), S ) )
for ii in range( S ):
xd[ :, ii ] = interp1d( ta, xc[ :, ii ] )( tb )
xd[ :, ii ] = interp1d( ta, xc[ :, ii ], bounds_error=False, fill_value='extrapolate' )( tb )
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's often not great, but I'm allowing the interpolator to extrapolate the comparison here (there will always be an error in this case due to changes in the time vector though... this is purely to check how much the curves changed if they were on the same time basis)


if ( len( N ) == 1 ):
return interp1d( ta, xa )( tb )
else:
# Reshape the input array so that we can work on the non-time axes
S = np.product( N[ 1: ] )
S = np.prod( N[ 1: ] )
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This fixes the numpy.product deprecation

@cssherman cssherman changed the title fix: Update numpy deprecation of product fix: Update numpy deprecation of product and test dependency issues Sep 4, 2024
@cssherman cssherman requested a review from CusiniM September 4, 2024 18:14
@CusiniM CusiniM merged commit 98680c5 into main Sep 5, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants