Closed reza-ghazi closed 1 year ago
Alas — I cannot reproduce that error here on my laptop. First, your script has an import error, which I fixed with:
from skyfield.api import load
Then I tacked the error:
ValueError: Skyfield does not know how to open a file named 'mar097'
— by changing the filename to mar097.bsp
. The result was a working script that gave no error. I added this line:
print(satellites_ephem['phobos'])
and got:
Sum of 2 vectors:
'mar097.bsp' segment 0 SOLAR SYSTEM BARYCENTER -> 4 MARS BARYCENTER
'mar097.bsp' segment 4 MARS BARYCENTER -> 401 PHOBOS
What do you see if you print()
that value in your script? Also: could you double-check which Skyfield version you are using?
Dear Brandon,
I didn't add the import section because I assumed you considered it there. But please run the following script and tell me what you get:
from skyfield.api import load
ts = load.timescale()
time = ts.now()
planets = load('de440.bsp')
earth = planets['earth']
observer = earth.at(time)
satellites_ephem = load('mar097.bsp')
satellite_position = observer.observe(satellites_ephem['phobos'])
ra, dec, distance = satellite_position.radec()
print(ra)
print(dec)
print(distance)
If you print the ephemeris, you will get no error, but please try to calculate the equatorial coordinates of, for example, Phobos
, then you will see.
This is a portion of a more extensive program, but in any case, it does raise the exception I mentioned.
When I run that script, I get:
08h 22m 39.75s
+20deg 57' 59.1"
1.95617 au
Which Skyfield version you are using?
I am using the latest version (1.46).
if I use the script and try to load the data in the default way (not using locally downloaded data), I will get the following error:
PS G:\my_works\projects\astronomy\python\astronopy\planets_moons> py .\test.py
[#################################] 100% de440.bsp
Traceback (most recent call last):
File "D:\astronomy\ast\planets_moons\test.py", line 8, in
<module>
satellites_ephem = load('mar097.bsp')
^^^^^^^^^^^^^^^^^^
File "C:\Users\usr\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\iokit.py", line 193, in __call__
path = self._assure(url, filename, reload, backup)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\usr\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\iokit.py", line 214, in _assure
download(url, path, self.verbose, backup=backup)
File "C:\Users\usr\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\iokit.py", line 525, in download
raise e2
OSError: cannot download https://ssd.jpl.nasa.gov/ftp/eph/planets/bsp/mar097.bsp because HTTP Error 404: Not Found
If I download mar097.bsp
from JPL FTP and try to use the local data, I will get the ValueError
, as mentioned before.
Honestly, if you got the result, it would be so weird.
So, What do you think? What's wrong?
Thanks for double-checking the Skyfield version!
Maybe we are using different copies of the file. Did you get yours from here, or somewhere else?:
https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/satellites/
Let me discuss the following: I used the data links at the following address:
https://ssd.jpl.nasa.gov/sats/ephem/
But After I try your link, it now works like a charm. Thank you.
So it was the JPL problem that the links they provided misled me.
You can mention in Skyfield documentation which people should rely on the data provided in NAIF System, not JPL Horizon itself.
It is unacceptable from a huge gov base company like JPL.
So, Thank you. The problem has been solved.
I try to calculate the
RA
andDEC
of satellites of the planets. Here is a part of my code:But it will raise the following exception:
Please note that the above code only works for Jupiter's satellites (with the ephemeris file of
jup365.bsp
); unfortunately, it doesn't work for any other ephemeris.I wonder if there is an issue or if I should try another technique for other planets and their satellites.
So, If the approach needs to be corrected, please enlighten me.
Thank you,