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

Eliminate division warning of blackbody_wn_rad2temp #238

Open
chorng opened this issue Oct 10, 2024 · 0 comments
Open

Eliminate division warning of blackbody_wn_rad2temp #238

chorng opened this issue Oct 10, 2024 · 0 comments

Comments

@chorng
Copy link

chorng commented Oct 10, 2024

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

with np.errstate(divide='ignore', invalid='ignore'):
    return PLANCK_C1 * wavenumber / np.log((PLANCK_C2 * wavenumber**3) / radiance + 1.0)

Problem description

The blackbody_wn_rad2temp function is currently raising runtime warning when encountering divide by zero, which is not the same behavior as other functions, e.g. the planck function.

Expected Output

No warning is raised when encountering divide by zero.

Actual Result, Traceback if applicable

RuntimeWarning: divide by zero encountered in divide
return PLANCK_C1 * wavenumber / np.log((PLANCK_C2 * wavenumber**3) / radiance + 1.0)

Versions of Python, package at hand and relevant dependencies

Python 3.10, pyspectral 0.13.5

Thank you for reporting an issue !

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

No branches or pull requests

1 participant