Example Notebook
This Jupyter Notebook is meant to illustrate how the SatChecker Ephemeris API (https://satchecker.cps.iau.org/ephemeris) can be used with python. The example below is for the name-jdstep endpoint.
[32]:
import requests
In order to get position predictions over a range of time, you will need to provide the start and end times (JD) and the desired time step. The time step is optional, and it defaults to 2 minutes (0.00138889 JD) if not provided. Since the API can only be called for one satellite at a time with the current endpoints, you can call it over a list if you need to check multiple satellites.
[48]:
start_jd = 2460208.5
stop_jd = 2460209.75
# .2 is 4.8 hours
step_jd = 0.2
observer_latitude = 32
observer_longitude = -110
observer_elevation = 0
satellite_list = [
"STARLINK-30109",
"STARLINK-30407",
"STARLINK-30408",
"STARLINK-30377",
"STARLINK-30422",
"STARLINK-30402",
"STARLINK-30411",
"STARLINK-30418",
]
In order to see all passes, visible and not, you can specify a min_altitude of -90. The default min_altitude if you don’t specify anything is 0, which will only return visible passes.
[51]:
visible_satellites = []
not_visible_satellites = []
for satellite in satellite_list:
response = requests.get(
f"https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name={satellite}&elevation={observer_elevation}&latitude={observer_latitude}&longitude={observer_longitude}&startjd={start_jd}&stopjd={stop_jd}&stepjd={step_jd}&min_altitude=-90",
timeout=10,
)
info = response.json()
print(response.url)
#print(info)
fields = info["fields"]
altitude_index = fields.index("altitude_deg")
# Iterate through each satellite's data
for satellite_data in info["data"]:
# Extract the satellite's name and altitude using the fields' indexes
satellite_name = satellite_data[fields.index("name")]
altitude_deg = satellite_data[altitude_index]
# Check if the satellite is visible
if altitude_deg > 0:
visible_satellites.append(satellite_data)
else:
not_visible_satellites.append(satellite_data)
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30109&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30407&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30408&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30377&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30422&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30402&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30411&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
https://satchecker.cps.iau.org/ephemeris/name-jdstep/?name=STARLINK-30418&elevation=0&latitude=32&longitude=-110&startjd=2460208.5&stopjd=2460209.75&stepjd=0.2&min_altitude=-90
Results are returned in JSON, which you can use to get specific info about each pass. This shows all visible passes for all satellites in the list specified:
[4]:
fields = info["fields"]
data = info["data"]
print("\n")
print("Visible Satellites: ")
for satellite in visible_satellites:
satellite_info = dict(zip(fields, satellite))
print(satellite_info.get("name"))
print("Altitude (degrees): ", satellite_info.get("altitude_deg"))
print("Azimuth (degrees): ", satellite_info.get("azimuth_deg"))
print("Time: ", satellite_info.get("julian_date"))
print("--------------------------------------")
print("\n\n")
Visible Satellites:
STARLINK-30109
Altitude (degrees): 0.1377401
Azimuth (degrees): 244.31156368
Time: 2460209.1
--------------------------------------
This shows each pass that isn’t visible for all satellites in the list specified, skipping the position since it’s not relevant:
[5]:
print("Not Currently Visible: ")
for satellite in not_visible_satellites:
satellite_info = dict(zip(fields, satellite))
print(satellite_info["name"])
print(satellite_info["julian_date"])
print("-------------------------")
Not Currently Visible:
STARLINK-30109
2460208.5
-------------------------
STARLINK-30109
2460208.7
-------------------------
STARLINK-30109
2460208.9
-------------------------
STARLINK-30109
2460209.3
-------------------------
STARLINK-30109
2460209.5
-------------------------
STARLINK-30109
2460209.7
-------------------------
STARLINK-30407
2460208.5
-------------------------
STARLINK-30407
2460208.7
-------------------------
STARLINK-30407
2460208.9
-------------------------
STARLINK-30407
2460209.1
-------------------------
STARLINK-30407
2460209.3
-------------------------
STARLINK-30407
2460209.5
-------------------------
STARLINK-30407
2460209.7
-------------------------
STARLINK-30408
2460208.5
-------------------------
STARLINK-30408
2460208.7
-------------------------
STARLINK-30408
2460208.9
-------------------------
STARLINK-30408
2460209.1
-------------------------
STARLINK-30408
2460209.3
-------------------------
STARLINK-30408
2460209.5
-------------------------
STARLINK-30408
2460209.7
-------------------------
STARLINK-30377
2460208.5
-------------------------
STARLINK-30377
2460208.7
-------------------------
STARLINK-30377
2460208.9
-------------------------
STARLINK-30377
2460209.1
-------------------------
STARLINK-30377
2460209.3
-------------------------
STARLINK-30377
2460209.5
-------------------------
STARLINK-30377
2460209.7
-------------------------
STARLINK-30422
2460208.5
-------------------------
STARLINK-30422
2460208.7
-------------------------
STARLINK-30422
2460208.9
-------------------------
STARLINK-30422
2460209.1
-------------------------
STARLINK-30422
2460209.3
-------------------------
STARLINK-30422
2460209.5
-------------------------
STARLINK-30422
2460209.7
-------------------------
STARLINK-30402
2460208.5
-------------------------
STARLINK-30402
2460208.7
-------------------------
STARLINK-30402
2460208.9
-------------------------
STARLINK-30402
2460209.1
-------------------------
STARLINK-30402
2460209.3
-------------------------
STARLINK-30402
2460209.5
-------------------------
STARLINK-30402
2460209.7
-------------------------
STARLINK-30411
2460208.5
-------------------------
STARLINK-30411
2460208.7
-------------------------
STARLINK-30411
2460208.9
-------------------------
STARLINK-30411
2460209.1
-------------------------
STARLINK-30411
2460209.3
-------------------------
STARLINK-30411
2460209.5
-------------------------
STARLINK-30411
2460209.7
-------------------------
STARLINK-30418
2460208.5
-------------------------
STARLINK-30418
2460208.7
-------------------------
STARLINK-30418
2460208.9
-------------------------
STARLINK-30418
2460209.1
-------------------------
STARLINK-30418
2460209.3
-------------------------
STARLINK-30418
2460209.5
-------------------------
STARLINK-30418
2460209.7
-------------------------