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

Getting the near infrared reflectance of a viirs scene crashes. #101

Closed
mraspaud opened this issue Feb 3, 2020 · 0 comments · Fixed by #102
Closed

Getting the near infrared reflectance of a viirs scene crashes. #101

mraspaud opened this issue Feb 3, 2020 · 0 comments · Fixed by #102

Comments

@mraspaud
Copy link
Member

mraspaud commented Feb 3, 2020

Getting the near infrared reflectance of a viirs scene crashes.
I'll be filling this bug report properly when I'm in a well connected place again.

Code Sample, a minimal, complete, and verifiable piece of code

This is happening in a couple of places in solar.py

np.linspace(start, end, round((end - start) / self._dlambda) + 1)

Problem description

This is not working with numpy > 1.18 as round doesn't return an int (see numpy/numpy#11557 )

Expected Output

I expect this to run without crashing.

Actual Result, Traceback if applicable

  File "/san1/opt/ears_viirs_imagery_processor/releases/ears_viirs_imagery_processor-0.1.9/lib/python3.6/site-packages/pyspectral/solar.py", line 182, in _band_calculations
    xspl = np.linspace(start, end, round((end - start) / self._dlambda) + 1)
  File "<__array_function__ internals>", line 6, in linspace
  File "/san1/opt/ears_viirs_imagery_processor/releases/ears_viirs_imagery_processor-0.1.9/lib/python3.6/site-packages/numpy/core/function_base.py", line 121, in linspace
    .format(type(num)))
TypeError: object of type <class 'numpy.float64'> cannot be safely interpreted as an integer.

A simple solution would be to replace round with int(round)

Versions of Python, package at hand and relevant dependencies

Numpy 1.18.1

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 a pull request may close this issue.

1 participant