skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.38k stars 208 forks source link

Get the azimuth, altitude and distance rate. #934

Closed ghost closed 5 months ago

ghost commented 5 months ago

Hi,

I'd like to thank you for this superb library, which is very pleasant to use. It has taught me a lot about python and space physics.

Currently, the altaz() function return three values: altitude, azimuth and distance. My goal: is to determine the velocity of the azimuth, altitude and distance corresponding to these three variables

Here is a example :

satellite      // Target satellite -- Loaded from a TLE_FILE
site             // Position of the observer's site -- initialized by wgs84.latlon()
times          // Times studied

difference=satellite - site
topocentric = difference.at(times)
elevations, azimuths, distances = topocentric.altaz()
elevations_rates, azimuths_rates, distances_rates = topocentric.custom_altaz()

Do you have an idea on which transformations need to be done on topocentric.velocity to get this achieved.

Thank you for your time !!!

brandon-rhodes commented 5 months ago

Determine the rate of change of the azimuth, altitude and distance as returned by the altaz() function.

I am not quite sure, from your question, what problem has arisen for you with the three values elevations_rates, azimuths_rates, distances_rates and what value you would like to have returned to you instead. By any chance, could you provide a small few-line script that prints out those values for a specific satellite and moment in time, and then prints out But what I would like instead is ... and the sample values you would really like for that time? That will give Skyfield contributors something to aim for, and a script to edit to try to reach that goal. Thanks!

ghost commented 5 months ago

Thank you for your prompt feedback. I have edited the original message because I wasn't clear enough... I hope this would be better.

brandon-rhodes commented 5 months ago

If you call the routine to get the range-rate:

https://rhodesmill.org/skyfield/earth-satellites.html#find-a-satellites-range-rate

— then I think the 4th and 5th return values will be the rate at which the azimuth is changing and the rate at which the altitude angle is changing. Try that idea out, and see what values you get.

ghost commented 5 months ago

Thank you a lot! I am doing some testing and this procedure is the one for me. Unfortunately i don't manage to access the two angles rate but i think i am doing something wrong. I will find ahah

satellite      // Target satellite -- Loaded from a TLE_FILE
site           // Position of the observer's site -- initialized by wgs84.latlon()
times          // Times studied

difference=satellite - site
topocentric = difference.at(times)
el, az, d, el_rate, az_rate, d_rate = topocentric.frame_latlon_and_rates(site)

print(el.degrees)              // [-60.53928577 -55.82218278 -50.26851757]
print(az.degrees)              // [196.81629598 215.09966657 231.02106773]
print(d.km)                    // [12005.05645088 11496.56715013 10820.53810621]
print(el_rate.degrees)         // <skyfield.units.Rate object at 0x0000026AFA5B0C80>
print(az_rate.degrees)         // <skyfield.units.Rate object at 0x0000026AE39D2B70>
print(d_rate .km_per_s)        // [-1.38978214 -1.9882468  -2.50218604]
brandon-rhodes commented 5 months ago

The Rate object has attributes that let you choose the units of the denominator:

https://rhodesmill.org/skyfield/api-units.html#skyfield.units.Rate

ghost commented 5 months ago

Thank you very much !!! I wish you all the best

brandon-rhodes commented 5 months ago

I'll see if this week I can expand the documentation with an example, to show how to get these rates for satellites, since it's not quite obvious how to do it from the existing documentation!