question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

elevation angles are not believable

See original GitHub issue

I am attempting to simulate visibility of a low-Earth-orbit satellite from a fixed ground station. The satellite elevation angles are all coming out around -17 degrees. This is not believable. As the satellite travels around the earth, the elevation angles should vary widely, and the satellite should at least occasionally be visible to the ground station (positive elevation angle). I’m assuming that I’m doing something wrong, but it is possible that there is a documentation issue here. My code follows.

# This script calculates visibility of a satellite to a single ground station.

# Section 1: Imports and constants.

from numpy import arange, empty, pi
from pdb import set_trace

import cartopy.crs as ccrs
from cartopy.feature.nightshade import Nightshade

from astropy import coordinates, time, units as u
from astropy.coordinates import AltAz, CartesianRepresentation, EarthLocation

from poliastro.bodies import Earth
from poliastro.twobody import Orbit, propagation
from poliastro.frames.fixed import ITRS
from poliastro.frames.equatorial import GCRS

RAD2DEG= 180 / pi


# Section 2: Simulate orbit.

a  = 7578.1 * u.km  # semi-major axis
ecc= 0      * u.one # eccentricity
inc= 63.4   * u.deg # inclination of the orbit plane
raan= 50    * u.deg # right ascension of the ascending node
argp= 270   * u.deg # argument of perigee
nu  = 0     * u.deg # true anomaly at epoch

T_sim_hrs= 24
T_step_min= 3

epoch= time.Time("2021-05-05 10:43")
orbit= Orbit.from_classical(Earth, a, ecc, inc, raan, argp, nu, epoch=epoch)

# Create time steps covering the duration of the simulation:
times= arange(0, 60*T_sim_hrs+1, T_step_min) * u.min

xyz= propagation.propagate(
  orbit,
  time.TimeDelta(times),
  method=propagation.cowell,
  rtol=1e-10,
)

epoch_times = epoch + times

# Calculate Earth-fixed (non-inertial) coordinates `itrs_xyz`:
gcrs_xyz = GCRS(xyz, obstime=epoch_times, representation_type=CartesianRepresentation)
itrs_xyz = gcrs_xyz.transform_to(ITRS(obstime=epoch_times))

# Convert satellite positions from Cartesian to spherical coordinates (radians and km):
sat_lat_lon= coordinates.cartesian_to_spherical(itrs_xyz.x, itrs_xyz.y, itrs_xyz.z)


# Section 3: Calculate satellite elevation angles.

# Reference: https://learn.astropy.org/rst-tutorials/Coordinates-Transform.html#transform-frames-to-get-to-altitude-azimuth-altaz

ground_station= EarthLocation.from_geodetic(
  lat   = 30 * u.deg,
  lon   = 30 * u.deg,
  height= 0  * u.km)

elevation= empty(len(sat_lat_lon[0]))

for i in range(len(sat_lat_lon[0])):
   satellite  = EarthLocation.from_geodetic(
     lat   =sat_lat_lon[1][i],
     lon   =sat_lat_lon[2][i],
     height=sat_lat_lon[0][i])

   # In the following call to `transform_to`, it is unclear why time is needed as an input.
   result= satellite.get_itrs().transform_to(AltAz(obstime=time.Time('J2010'),
     location=ground_station))

   elevation[i]= result.alt.value

set_trace()

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:21 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
ayshihcommented, May 7, 2021

“test” --> “text”

1reaction
mkbrewercommented, May 7, 2021

Done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angles of elevation and depression (article) | Khan Academy
When are these terms useful? Angles of elevation and depression are often used in trigonometry word problems, so it's good to know their...
Read more >
Characteristic analysis of layered PMSEs measured with ...
We will not touch on these methods here, but will analyze the related characteristics of PMSEs with different elevation angles.
Read more >
Technical Report Lincoln Laboratory - DTIC
A radar system tracking a target at low elevation angles, namely, within one or ... anywhere between 0° and 360° and not just...
Read more >
Method for determining azimuth and elevation angles using a ...
Again, since the elevation angle (el) is not known, the nominal azimuth, A(r i, p i, h i, el, θ i, α), corresponding...
Read more >
Angles of Elevation & Depression - Varsity Tutors
The term angle of elevation denotes the angle from the horizontal upward to an object. An observer's line of sight would be above...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found