robintw / Py6S

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

Fix exception with numpy 1.23 #97

Closed pblottiere closed 2 years ago

pblottiere commented 2 years ago

Hello,

Due to a recent change in numpy 1.23 (a DeprecationWarning is now a proper exception: https://numpy.org/devdocs/release/1.23.0-notes.html#expired-deprecations), an exception is raised in Wavelengths.run_wavelengths:

Traceback (most recent call last):
  File "venv/lib/python3.9/site-packages/Py6S/SixSHelpers/all_wavelengths.py", line 96, in run_wavelengths
    if len(wavelengths[0]) == 4:
TypeError: object of type 'numpy.float64' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    wv, res = Wavelengths.run_wavelengths(s, self.wvrange, n=ncore)
  File "venv/lib/python3.9/site-packages/Py6S/SixSHelpers/all_wavelengths.py", line 102, in run_wavelengths
    return np.array(wavelengths), np.array(results)
  File "venv/lib/python3.9/site-packages/Py6S/outputs.py", line 113, in __getattr__
    raise OutputParsingError("The specifed output variable does not exist.")
Py6S.sixs_exceptions.OutputParsingError: The specifed output variable does not exist.
codecov[bot] commented 2 years ago

Codecov Report

Merging #97 (debaa2a) into master (ea54398) will decrease coverage by 0.11%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
- Coverage   88.01%   87.89%   -0.12%     
==========================================
  Files          18       18              
  Lines        1719     1719              
==========================================
- Hits         1513     1511       -2     
- Misses        206      208       +2     
Impacted Files Coverage Δ
Py6S/outputs.py 78.72% <100.00%> (-0.71%) :arrow_down:
Py6S/sixs_exceptions.py 77.77% <0.00%> (-5.56%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ea54398...debaa2a. Read the comment docs.

robintw commented 2 years ago

Thank you very much for this - I'll do a new release later today to include this fix.

pblottiere commented 2 years ago

I'll do a new release later today to include this fix.

Awesome, thanks a lot for your work :+1:!

robintw commented 2 years ago

The new release (v1.9.2) is now on PyPI - a conda package will follow in the next couple of days.