skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.4k stars 211 forks source link

instructions for downloading jplephem subset of .bsp file fails #678

Closed ursomniac closed 2 years ago

ursomniac commented 2 years ago

the problem doesn't appear to be inside of skyfield per se, but I'm hoping you can give insight. In https://rhodesmill.org/skyfield/planets.html the instructions have the example:


$ python -m jplephem excerpt 2018/1/1 2018/1/15 $u jup_excerpt.bsp```, however:

1. jup310.bsp is no longer active, but looking at the JPL site, I found the up-to-date (full) files.
2. Trying sat427 (or any of them), e.g.:

```$ python -m jplephem excerpt 2021/1/1 2030/1/1 https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/satellites/sat427.bsp sat_excerpt.bsp```

always throws an error:

```AttributeError: 'RemoteFile' object has no attribute 'close'```
and doing some pecking, that's true --- the class Remotefile does not have a .close() method.

I've tried to get around this (commenting out the line, etc.) but that just throws different errors.

I've tried doing a GS on this error, but came up empty-handed - so I can't tell if somehow my local install has an issue, of what.

Can you try the above command and see if you replicate the problem?

(Or, jup365, mar097, nep095, or ura111 - same issue.)
brandon-rhodes commented 2 years ago

Thanks for pointing that out! I have just released a new version of jplephem that should fix the problem. Try:

pip install -U jplephem

— and see whether that fixes the subcommand. Hopefully it will now work!

ursomniac commented 2 years ago

I will.

I’m curious why there’s not be a lot of support for the moon in the code (eg no rise/set, phase angle, etc info).

I’ve been using skyfield to support a Django site to help plan observing sessions. It definite beats coding all of the functions from Meeus!

Thanks

Bob

Sent from my iPhone

On Dec 31, 2021, at 4:25 AM, Brandon Rhodes @.***> wrote:

 Thanks for pointing that out! I have just released a new version of jplephem that should fix the problem. Try:

pip install -U jplephem — and see whether that fixes the subcommand. Hopefully it will now work!

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.

brandon-rhodes commented 2 years ago

I’m curious why there’s not be a lot of support for the moon in the code (eg no rise/set, phase angle, etc info).

I think that both of those might be available through the almanac module:

https://rhodesmill.org/skyfield/almanac.html

brandon-rhodes commented 2 years ago

I've now had time to go review the documentation in detail, and it looks like phase angle isn't explicitly discussed in the big Almanac chapter. Maybe I should think about adding it. In the meantime, look for the phase_angle() function in the main API summary:

https://rhodesmill.org/skyfield/api.html#almanac

Let me know whether it does what you need!

ursomniac commented 2 years ago

I think it does and I did find SOME documentation or at least a reference. Anyway someone else had a similar issue to mine: trying to create a plot of the Moon's phase based on the phase angle, and your advice to them worked just fine.

BUT the values I get for other planets look weird - it's not mission-critical (it's not a calculation that I think I'd use, so I don't need to display it).

In any case, this package is insane: I had started my own just working from Meeus, and only found it when I was looking for an algorithm for moon rise/set. Over the last week, I've been completely replacing all my code with calls to your package, a) because it's far less code, and b) because I trust your answers more than I trust mine. :-) --- anyway, as of yesterday about 95% of my original code is gone.

brandon-rhodes commented 2 years ago

Wonderful, I'm glad that Skyfield is helping you eliminate code that you would otherwise have to maintain yourself! Thanks for sharing your positive experience, it’s encouraging.

If you'd like to share one of the weird phase angle numbers that Skyfield is returning for a planet, I'd be interested in seeing it to determine whether the phase-angle routine needs to be tweaked to work correctly with planets.