Skip to content

Conversation

@andibarg
Copy link

I implemented the changes discussed in #1036. This allows us to observe the apparent positions of multiple WGS84 locations on earth with a single line of code and without a for loop.

Example script to validate:

from skyfield.api import load, wgs84, EarthSatellite

ts = load.timescale()
t = ts.now()

planets = load('de440.bsp')
earth = planets['earth']
moon = planets['moon']

ts = load.timescale()
line1 = '1 25544U 98067A   14020.93268519  .00009878  00000-0  18200-3 0  5082'
line2 = '2 25544  51.6498 109.4756 0003572  55.9686 274.8005 15.49815350868473'
satellite = EarthSatellite(line1, line2, 'ISS (ZARYA)', ts)

geopos = wgs84.latlon(latitude_degrees = [0,0],
                      longitude_degrees = [0,10])

# View from moon to geographic positions
pos = moon.at(t).observe(geopos+earth).apparent()
print(pos.xyz)

pos1 = moon.at(t).observe(earth + wgs84.latlon(
    latitude_degrees = 0,
    longitude_degrees = 0,
)).apparent()
print(pos1.xyz)

pos2 = moon.at(t).observe(earth + wgs84.latlon(
    latitude_degrees = 0,
    longitude_degrees = 10,
)).apparent()
print(pos2.xyz)


# View from Satellite to geographic positions
pos = (satellite+earth).at(t).observe(geopos+earth).apparent()
print(pos.xyz)

pos1 = (satellite+earth).at(t).observe(earth + wgs84.latlon(
    latitude_degrees = 0,
    longitude_degrees = 0,
)).apparent()
print(pos1.xyz)

pos2 = (satellite+earth).at(t).observe(earth + wgs84.latlon(
    latitude_degrees = 0,
    longitude_degrees = 10,
)).apparent()
print(pos2.xyz)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant