robintw / Py6S

A Python interface to the 6S Radiative Transfer Model
GNU Lesser General Public License v3.0
186 stars 105 forks source link

Exception with numpy 1.20.0 #76

Closed pblottiere closed 3 years ago

pblottiere commented 3 years ago

Hello,

We're using Py6S for some time now and everything works smoothly, thanks a lot :+1:!

But today we noticed an issue when Py6S is used with numpy 1.20.0. The issue is easily reproducible thanks to the RunAllWavelengthsTests unit test of Py6S.

Unit tests are green in a virtualenv with numpy 1.19.5:

$ virtualenv venv_numpy_1_19_5
$ source venv_numpy_1_19_5/bin/activate
(venv_numpy_1_19_5) $ pip install numpy==1.19.5 scipy matplotlib pytest
(venv_numpy_1_19_5) $ pytest test/test_run_all_wavelengths.py
========================================== test session starts ===========================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/Py6S
collected 2 items

test/test_run_all_wavelengths.py ..                                                                [100%]

=========================================== 2 passed in 9.29s ===========================================

But there's an exception when the last version of numpy (1.20.0) is used:

$ virtualenv venv_numpy_1_20_0
$ source venv_numpy_1_20_0/bin/activate
(venv_numpy_1_20_0) $ pip install numpy scipy matplotlib pytest
(venv_numpy_1_20_0) $ pytest test/test_run_all_wavelengths.py
========================================== test session starts ===========================================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /tmp/Py6S
collected 2 items

E                   Py6S.sixs_exceptions.OutputParsingError: The specifed output variable does not exist.
...
...
robintw commented 3 years ago

Glad you're finding Py6S useful.

I've fixed the error with numpy 1.20.0 in a PR here: https://github.com/robintw/Py6S/pull/77. I haven't had chance to do a release yet, and I'd like to fix a couple of other things before doing a release. However, you should be able to install from that branch by running the following command:

pip install git+https://github.com/robintw/Py6S.git@fix-numpy-120

Let me know if that works for you.

pblottiere commented 3 years ago

Hello @robintw,

Let me know if that works for you.

Yes, the CI is green on our side :+1:.

Thanks a lot for your reactivity!

robintw commented 3 years ago

Just FYI @pblottiere, this fix has now been released in Py6S v1.8.1 which is available on PyPI now, and should be available on conda shortly.

pblottiere commented 3 years ago

Awesome @robintw, thanks :+1: