-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Overflow in clearsky.haurwitz when apparent_zenith is almost 90 #167
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
Comments
Cliff, I don't fully understand what you mean by numerical overflow in the python/numpy context since you usually will get the largest number your platform supports, a nan, or an inf. In any case, it might be platform and numpy version dependent. On my Python 3.5, 64-bit mac and my Python 2.7, 64-bit linux, both running numpy 1.10.4... In [2]: np.cos(np.deg2rad(89.99999999999999999999999999999999999))
Out[2]: 6.123233995736766e-17
In [3]: 1/np.cos(np.deg2rad(89.99999999999999999999999999999999999))
Out[3]: 16331239353195370.0
In [4]: np.exp(-0.059/np.cos(np.deg2rad(89.99999999999999999999999999999999999)))
Out[4]: 0.0 Same results with 90 and 90.0, and the behavior from 89.0 - 89.9 also seems ok. Can you copy/paste a few lines of input and output? |
Hi Will, Perhaps it’s a runtime setting on my end. I get warnings, not errors, when the zenith is 90 (or very close to it): C:\Users\cwhanse\AppData\Local\Continuum\Anaconda3\lib\site-packages\pandas\computation\expressions.py:62: RuntimeWarning: invalid value encountered in power The code executes to end. Matlab handles this case with the ‘Inf’ value, which made it transparent to us. I mostly wanted to learn how to post an issue, you can close it if it’s not really an issue. Cliff |
Are you using Spyder on Windows? I wonder if it's related to pandas-dev/pandas#9950 and links therein. You might be able to eliminate the warnings by running |
Actually, I think np.seterr might be the right one to use. |
Haurwitz model includes this term:
np.exp(-0.059/cos_zenith)
We currently don't intercept and handle numerical overflow when cos_zenith is very close to 0.
The text was updated successfully, but these errors were encountered: