skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.43k stars 213 forks source link

Azimuth and altitude of satellite from SP3 ephemeris #433

Open xmichaelx opened 4 years ago

xmichaelx commented 4 years ago

I'd like to compute apparent position on sky of GNSS satellite in similar manner it's done for TLEs. AFAIU I need to implement vector function in skyfield.

Let's say that I have already implemented function interpolate(t) that gives me position and velocity for given t in ECEF. From this point all I have to do is convert it to GCRF (using astropy for example) and stuff that inside _at method of class which inherits from VectorFunction? Is there anything I'm missing?

I'm already heavily using skyfield for computing apparent positions from TLEs and it's super convenient.

brandon-rhodes commented 4 years ago

I don't think you are missing anything, no! That's all there is to it. Is there somewhere in the docs I could add a short section on this topic?

I'm glad you're finding Skyfield convenient, it was fun to work on the design to try to make operations as clean as possible.

xmichaelx commented 4 years ago

A section on that would be awesome - something like: if you have function for your object which can output position and velocity vector in GCRF/ITRF for any given time - here's how to wrap it to get precise altitude/azimuth for your location. So basically something like:

def get_pv(t):
    # ...
    return pos, vel # in GCRF

and then how to convert it into a VectorFunction object.

brandon-rhodes commented 4 years ago

Okay, I'll see if I can add something to the docs. The last time I was in that code I was thinking about getting rid of _at() and only having at(), so maybe I'll go ahead and make that decision before doing the documentation. (Though maybe I can't really get rid of _at() support completely because of folks who might have discovered it and went ahead and used it? But I can probably at least make Skyfield's own vector functions simpler by not using it.)