Closed nanheer closed 3 years ago
@nanheer — What happens when you try opening the directory ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp
in your browser?
@brandon-rhodes I just can't open it,I think maybe because there is a wall made by our Chinese goverment which pernvents me to open it,so most foreign webpages we can't open,this really upsets me, I really love your python package. actually I'm more familiar with your another two packages pyephem and novas,I use your pyepehm package to compute the time of China's 24 JieQi,which was selected into the intangible cultural heritage list by the UNESCO ,24 JieQi is 24 days marking one of the 24 divisions of the solar year in the traditional Chinese calendar,actually ,they are 24 moments when the sun's apparent ecliptic longitude reach a specific value,for example ,today is LiDong,means we reach in winter,at the moment 2020-11-07 07:13:55 of Beijing Time, sun's apparent ecliptic longitude reach 225.0,we call this moment LiDong,we also call this day this moemnt in LiDong,so it is necessary to compute the 24 moments with the precision of a second.especially when the moment at the end of day, difference of several seconds may cause difference of two days,pyephem is not so precise,so I want to use your skyfield package. besides I also use ephem to compute the time of planet's conjunction,opposition,retrograde,lunar phase,I use novas pacakge to compute the time of solar eclipse and lunar eclipse,as an amateur astronomer I'm so happy when I can compute the time of this astronomical events by myself,so I really really want to say thanks to you.
@nanheer — If you search the web, you should be able to find other sites that offer de421.bsp
. For example, at the moment the Skyfield repository here on GitHub currently carries it, to help Skyfield run its tests in CI. So if your computer can reach GitHub, you can try:
eph = load('https://raw.githubusercontent.com/skyfielders/python-skyfield/master/ci/de421.bsp')
Are the “24 JieQi” the same as the “solar terms” described at the following link, or are they different?
https://rhodesmill.org/skyfield/almanac.html#solar-terms
I also enjoy figuring out events! Very early this morning I did a lunar eclipse calculation for the first time, and seeing the same results come out as from a table of eclipses is so satisfying.
Thank you for the kind words about my astronomy libraries, and I am happy they have helped you do calculations of your own!
@brandon-rhodes yes,It's ok,I've solve this problem according to your method,thanks so much. “24 JieQi” is the same as the “solar terms”,so I can use SOLAR_TERMS_ZHS funtion directly to calculate the precise time of “24 JieQi”.thanks again,I'll share your python libraries with my friends,they are really interesting and efficient!
Thank you for the kind words, and I hope your friends enjoy the libraries!
I will close this issue, and I am glad we were able to work around your computer's problem contacting the server.
@brandon-rhodes sorry,I just run the code on my mac after modifying by your method yesterday,there's no problem,but when I shared skyfield with my friends today,he run the code modified by me by your method on his windows computer,he found a problem,so I also run it on my windows computer,I have the same problem,that is : File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem\daf.py", line 61, in init raise ValueError('file starts with {0!r}, not "NAIF/DAF" or "DAF/"' ValueError: file starts with b'\n\n\n\n\n<!D', not "NAIF/DAF" or "DAF/" I tried some methods,but I didn't solve it,so I ask for your help
I would suggest opening the file and looking at its contents. It looks like it’s perhaps an HTML error page? I wonder if Skyfield correctly checks for HTTP errors. Maybe it just saves the error page instead.
I'm not sure what caused this problem,I wonder why this problem only hapeens on a Windows computer,but it's normal on a macbook computer.the code I run as follows:
from skyfield.api import load
planets = load('https://raw.githubusercontent.com/skyfielders/python-skyfield/master/ci/de421.bsp')
earth, mars = planets['earth'], planets['mars']
ts = load.timescale()
t = ts.now()
position = earth.at(t).observe(mars)
ra, dec, distance = position.radec()
print(ra)
print(dec)
print(distance)
the full error message as follows:
Traceback (most recent call last): File "C:/Users/15108/Desktop/test.py", line 3, in
planets = load('https://raw.githubusercontent.com/skyfielders/python-skyfield/master/ci/de421.bsp') File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\skyfield\iokit.py", line 198, in call return opener(path) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\skyfield\jpllib.py", line 71, in init self.spk = SPK.open(path) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem\spk.py", line 49, in open return cls(DAF(open(path, 'rb'))) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem\daf.py", line 61, in init raise ValueError('file starts with {0!r}, not "NAIF/DAF" or "DAF/"' ValueError: file starts with b'\n\n\n\n\n<!D', not "NAIF/DAF" or "DAF/"
I think this problem is caused by jplephem library,because when I input "python -m jplephem comment de421.bsp" on the command line to display the data inside of it,the result is:
Traceback (most recent call last): File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem__main__.py", line 3, in
sys.stdout.write(main(sys.argv[1:])) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem\commandline.py", line 56, in main lines = list(func(args)) File "C:\Users\15108\AppData\Local\Programs\Python\Python39\lib\site-packages\jplephem\commandline.py", line 62, in comment with open(args.path, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: 'de421.bsp'
I've downloaded 'de421.bsp' file,and put it into jplephem directory
I still suggest opening the file and looking at it contents. The snippet of file content that's displayed in the error looks like plain HTML text: \n\n\n\n\n<!D
.
The error from jplephem
seems to indicate that the file is not in the current directory, but in another directory. Maybe you need to cd
to the directory first?
I've solved this problem by replacing
planets = load('https://raw.githubusercontent.com/skyfielders/python-skyfield/master/ci/de421.bsp')
with
planets= load('C:\Users\15108\AppData\Local\Programs\Python\Python39\Lib\site-packages\jplephem\de421.bsp')
while 'C:\Users\15108\AppData\Local\Programs\Python\Python39\Lib\site-packages\jplephem\' is the local directory which de421.bsp in.
thanks for your help!
when i first run skyfield on my windows,it return this,i find ftp://ssd.jpl.nasa.gov/pub/eph/planets/bsp/de421.bsp can't open