Example Notebook

This Jupyter Notebook is meant to illustrate how the SatChecker Ephemeris API (https://cps.iau.org/tools/satchecker/api) can be used with python. The example below is for the name-jdstep endpoint.

[21]:
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.

[22]:
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.

[23]:
visible_satellites = []
not_visible_satellites = []

for satellite in satellite_list:
    info = requests.get(
        f"https://cps.iau.org/tools/satchecker/api/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,
    )
    visible = False
    for point in info.json():

        if point["ALTITUDE-DEG"] > 0:
            visible_satellites.append(point)
            visible = True

        if not visible:
            not_visible_satellites.append(point)
            visible = False

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:

[24]:
print("\n")
print("Visible Satellites: ")
for satellite in visible_satellites:
    print(satellite["NAME"])
    print("Altitude (degrees): ", satellite["ALTITUDE-DEG"])
    print("Azimuth (degrees): ", satellite["AZIMUTH-DEG"])
    print("Time: ", satellite["JULIAN_DATE"])
    print("--------------------------------------")

print("\n\n")



Visible Satellites:
STARLINK-30109
Altitude (degrees):  60.70051088535
Azimuth (degrees):  13.80765936402
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:

[25]:
print("Not Currently Visible: ")
for satellite in not_visible_satellites:
    print(satellite["NAME"])
    print(satellite["JULIAN_DATE"])
    print("-------------------------")
Not Currently Visible:
STARLINK-30109
2460208.5
-------------------------
STARLINK-30109
2460208.7
-------------------------
STARLINK-30109
2460208.9
-------------------------
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
-------------------------