Skip to content

Commit 83e5831

Browse files
committed
add geoid intersection example to docs
1 parent e0e9109 commit 83e5831

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

skyfield/documentation/earth-satellites.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,63 @@ or else in the dynamical coordinate system of the date you specify.
506506

507507
See :doc:`positions` to learn more about these possibilities.
508508

509+
Where on Earth is a satellite looking?
510+
-----------------------------------------
511+
512+
Rather than knowing where to look to observe a satellite in the sky, you might
513+
be interested in doing the reverse; finding the geographic location on Earth
514+
that a satellite would be observing for a given viewing geometry. To do this,
515+
you can define an attitude vector for the satellite position, and then use
516+
a :data:`~skyfield.toposlib.wgs84` intersection method to find the surface
517+
position in the line-of-sight:
518+
519+
* :meth:`~skyfield.toposlib.Geoid.intersection_of()`
520+
521+
For example, first contruct an inertial :data:`~skyfield.framelib.LVLH` frame
522+
for the satellite position, then use the frame to define an attitude vector:
523+
524+
.. testcode::
525+
526+
from skyfield.framelib import LVLH
527+
528+
satellite_lvlh = LVLH(geocentric)
529+
attitude = satellite_lvlh.icrf_looking_vector(pitch=0.0, roll=0.0)
530+
print('Frame:', satellite_lvlh)
531+
print('Attitude:', attitude)
532+
533+
.. testoutput::
534+
535+
Frame: <skyfield.framelib.LVLH object at 0x7fd11ab18790>
536+
Attitude: [ 0.57745914 0.2781511 -0.76757599]
537+
538+
In this case we have set the pitch and roll to zero, so the attitude vector
539+
is pointing toward the center of mass of the Earth, i.e., a unit vector
540+
anti-aligned with the position vector:
541+
542+
.. testcode::
543+
544+
neg_position = -geocentric.position.au / length_of(geocentric.position.au)
545+
print(negative_position)
546+
547+
.. testoutput::
548+
549+
[-0.57745914 -0.2781511 0.76757599]
550+
551+
Now, to find the intersection of this vector with the Earth’s surface we can
552+
use the :meth:`~skyfield.toposlib.Geoid.intersection_of()` method:
553+
554+
.. testcode::
555+
556+
intersection = wgs84.intersection_of(geocentric, attitude)
557+
print('Latitude:', intersection.latitude)
558+
print('Longitude:', intersection.longitude)
559+
560+
.. testoutput::
561+
562+
Longitude: -86deg 23' 23.3"
563+
Latitude: 50deg 15' 19.6"
564+
565+
509566
Find a satellite’s range rate
510567
-----------------------------
511568

0 commit comments

Comments
 (0)