TEOS-10 / python-gsw

Python implementation of the Thermodynamic Equation Of Seawater - 2010 (TEOS-10)
MIT License
45 stars 22 forks source link

IndexError: Too many indices when calling "gsw.SA_from_SP" #1

Closed mankoff closed 10 years ago

mankoff commented 10 years ago

The following code is causing gsw v. 3.0.2 to crash:

import gsw
gsw.SA_from_SP(27,10,-50,70)

with the error: IndexError: too many indices on line 128 of library.py: https://github.com/ocefpaf/python-gsw/blob/master/gsw/gibbs/library.py#L128

That line is performing operations on w and valid, which look like:

ipdb> print w; print valid
[[ 0.75]
 [ 0.  ]
 [ 0.  ]
 [ 0.25]]
[ True]
ocefpaf commented 10 years ago

You said gsw 3.0.2 so you probably installed it from PyPI. If that's the case let me know your numpy version. There is a known bug with newer numpy that should be fixed in the github master repository.

If you wish to install from github try:

sudo pip install https://github.com/ocefpaf/python-gsw/zipball/master

mankoff commented 10 years ago

Yes PyPI and Numpy version is 1.8.0.

mankoff commented 10 years ago

And yes, installing from master branch fixes it.

ocefpaf commented 10 years ago

Thanks for reporting.