\lib\site-packages\skyfield\functions.py:77: RuntimeWarning
See original GitHub issueHello Brandon,
Today I was working with the Skyfiled, and I’ve got the following warning. I believe you should handle the exception.
e = ephemeris[399]
obj = ephemeris[399]
coordinates = e.at(t).observe(obj).radec()
.\lib\site-packages\skyfield\functions.py:77: RuntimeWarning: invalid value encountered in double_scalars theta = arcsin(z / r)
You might be asking why I am calculating geocentric astrometric coordinates of earth !!
Actually, I do not, It was happened by mistake. Then I got curious and I checked geocentric astrometric position as below:
e = ephemeris[399]
obj = ephemeris[399]
positions = e.at(t).observe(obj).position.au
And the result was successful [0.0, 0.0, 0.0]. As logically, we can guess.
Finally, I guess you should handle the exception somewhere in your code to get off that warning in the previous code and get a logical result. (Maybe it is a division by zero exception).
Best,
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
invalid value encountered in double_scalars at line 70 in ...
Hi, I'm trying to do some satellite propagation. I ran into some issues with my script, so I pulled up a skyfield example...
Read more >RuntimeWarning: invalid value encountered in greater
Your problem is caused by the NaN or Inf elements in your out_vec array. You could use the following code to avoid this...
Read more >Skyfield — documentation - Rhodes Mill
Elegant Astronomy for Python. Skyfield computes positions for the stars, planets, and satellites in orbit around the Earth. Its results should agree with ......
Read more >Python Tutorial
Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach ...
Read more >1. Whetting Your Appetite
function or module to the interpreter, either to perform critical operations at maximum speed, or to link Python programs to libraries that may...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The message, it turns out, is a warning and not an exception. There are two big differences. First: the program keeps going, as can be confirmed with a
print
.This results in:
Since the
print()
runs, the program survived and did not encounter an exception.Second: because this is not an exception, it cannot be caught. If you will try putting a
try…except
around the statement yourself, I think you will be able to confirm that you cannot catch the warning; it is transparent to the Skyfield code.There is probably a way to ask NumPy to promote warnings to exceptions, but in general libraries like Skyfield are not supposed to set global NumPy options for their own purposes; instead, end-user code is supposed to be in full control.
My understanding, then, is that there is nothing Skyfield can do that will improve the situation? Please run your own checks and see if I am correct. If I am wrong, then simply provide the sample code that you think Skyfield should run that handles this case differently, and we can try it out. Thanks!
Of course. Thank you. Until then.