Pure MoonBit toolkit for satellite orbit data, pass prediction, and visualization
Project status: near-earth propagation phase. The package now includes a pure MoonBit near-earth SGP4 implementation validated against the Vallado 00005 reference state, plus SGP4-based ground-station pass prediction. Deep-space SDP4, full official vector coverage, and export formats remain planned work.
moon run cmd/main -- time parse 2026-08-11T12:00:00moon run cmd/main -- tle validate "1 25544U 98067A 26224.50000000 .00001234 00000-0 12345-4 0 9991" "2 25544 51.6416 21.0000 0001234 123.4567 234.5678 15.50000000"moon run cmd/main -- propagate "<line1>" "<line2>" --at 2026-08-23T12:00:00moon run cmd/main -- passes "<line1>" "<line2>" --station 31.2304,121.4737,10 --from 2026-08-23T12:00:00 --hours 24 --min-elevation 10 --format jsonmoon run cmd/main -- track "<line1>" "<line2>" --from 2026-08-23T12:00:00 --seconds 86400 --step 60moon run cmd/main -- eclipse "<line1>" "<line2>" --at 2026-08-23T12:00:00let tle = @moonsatkit.validate_tle(line1, line2).unwrap()
let station : @moonsatkit.GroundStation = {
latitude_deg: 31.2304,
longitude_deg: 121.4737,
altitude_m: 10.0,
}
let passes = @moonsatkit.predict_passes_sgp4(
tle,
station,
from=start,
duration_hours=24,
minimum_elevation_deg=10.0,
).unwrap()let catalog = @moonsatkit.parse_tle_catalog(catalog_text).unwrap()
let catalog_passes = @moonsatkit.predict_catalog_passes_sgp4(
catalog, station, from=start, duration_hours=24, minimum_elevation_deg=10.0,
).unwrap()
let json = @moonsatkit.catalog_pass_windows_to_json(catalog_passes)let json = @moonsatkit.pass_windows_to_json(passes)
let csv = @moonsatkit.pass_windows_to_csv(passes)
let track = @moonsatkit.track_geojson_sgp4(tle, start, 86400, 60).unwrap()moon info
moon fmt
moon test -p oilleelssq-wq/moonsatkit --target all --deny-warncd web
python -m http.server 4173pub(all) struct CatalogPassWindow {
name : String
catalog_number : Int
window : PassWindow
} derive(Eq, Debug)pub(all) struct GeodeticPosition {
latitude_deg : Double
longitude_deg : Double
altitude_km : Double
}pub(all) struct OrbitElements {
catalog_number : Int
epoch : UtcDateTime
epoch_julian_day : Double
inclination_deg : Double
right_ascension_deg : Double
eccentricity : Double
argument_of_perigee_deg : Double
mean_anomaly_deg : Double
mean_motion_rev_per_day : Double
mean_motion_rad_per_min : Double
}pub(all) struct PassWindow {
aos : UtcDateTime
tca : UtcDateTime
los : UtcDateTime
maximum_elevation_deg : Double
} derive(Eq, Debug)pub(all) struct SatError {
kind : SatErrorKind
line : Int
fragment : String
message : String
} derive(Eq, Debug)pub(all) struct Sgp4Elements {
catalog_number : Int
epoch : UtcDateTime
epoch_julian_day : Double
inclination_rad : Double
right_ascension_rad : Double
eccentricity : Double
argument_of_perigee_rad : Double
mean_anomaly_rad : Double
mean_motion_rad_per_min : Double
mean_motion_first_derivative_rev_per_day2 : Double
mean_motion_second_derivative_div2_rev_per_day3 : Double
bstar : Double
}pub(all) struct Tle {
line1 : String
line2 : String
catalog_number : Int
epoch : String
inclination : String
right_ascension : String
eccentricity : String
argument_of_perigee : String
mean_anomaly : String
mean_motion : String
mean_motion_first_derivative : String
mean_motion_second_derivative : String
bstar : String
checksum_line1_ok : Bool
checksum_line2_ok : Bool
} derive(Eq, Debug)fn gmst_angle(julian_day_value : Double) -> Doublefn predict_catalog_passes_sgp4(entries : Array[TleCatalogEntry], station : GroundStation, from : UtcDateTime, duration_hours : Int, minimum_elevation_deg : Double) -> Result[Array[CatalogPassWindow], SatError]fn predict_passes(tle : Tle, station : GroundStation, from : UtcDateTime, duration_hours : Int, minimum_elevation_deg : Double) -> Result[Array[PassWindow], SatError]fn predict_passes_from_elements(elements : OrbitElements, station : GroundStation, from : UtcDateTime, duration_hours : Int, minimum_elevation_deg : Double) -> Result[Array[PassWindow], SatError]fn predict_passes_sgp4(tle : Tle, station : GroundStation, from : UtcDateTime, duration_hours : Int, minimum_elevation_deg : Double) -> Result[Array[PassWindow], SatError]fn propagate_two_body(elements : OrbitElements, instant : UtcDateTime) -> Result[OrbitState, SatError]fn track_geojson_sgp4(tle : Tle, from : UtcDateTime, duration_seconds : Int, step_seconds : Int) -> Result[String, SatError]let vallado_00005_line1 : StringPure MoonBit toolkit for satellite orbit data, pass prediction, and visualization