API overview

GPKit's whole public interface, as the compiler states it, is in docs/public-api.swift. This page groups it by task.K-10

Reading

type what it's for key API
ElementSets read a provider's file read(_ input: Bytes, as: Format, checksum: TLE.Checksum = .verify) throws(Refusal) -> ElementSetFile (bytes or String)
Format which format the input is .csv, .json, .xml, .kvn, .tle
ElementSetFile what a read returns entries (.elementSet or .refusal), elementSets, refusals, providerMessage
TLE TLE specifics parse(name:line1:line2:checksum:), checksum(of:), fullYear(twoDigit:), Checksum { verify, ignore }
Alpha5 the five-column catalog field decode(_:) throws(Refusal) -> Int, encode(_:) throws(Refusal) -> String, ceiling
OMM OMM specifics catalogNumber(_:) throws(Refusal) -> Int

Values

type what it is
ElementSet one element set: catalogNumber: Int?, objectName, objectID, epoch, the six elements and B* as ExactDecimal, defaulted, otherKeywords, source, isSGP4
ExactDecimal a number as the source wrote it: init?(_ text:), double, isZero
Epoch an instant, UTC, in integers to the attosecond: init(ccsds:), init(unixTime:), seconds(since:), advanced(by:), and init(_ date:) / date where there's Foundation

Writing

type API
TLE write(_:eccentricity:) throws(Refusal) -> TLE.Lines, with Resolution { rounded, truncated }

Propagating

type API
Propagator init(_ elementSet:, gravity: Gravity = .wgs72) throws(PropagationFailure), state(at:), state(minutesFromEpoch:), position(at:) -> GeodeticPosition, look(from:at:) -> Look
Propagator.Gravity .wgs72, .wgs84, .wgs72old
StateVector, Vector TEME position (km) and velocity (km/s)
GeodeticPosition latitude, longitude (degrees), altitude (km)

Passes

type API
Observer init(latitude:longitude:height: = 0), height in metres
Propagator.passes passes(over:from:for: Duration, above minimumElevation: Double = 0) -> Passes
Passes a RandomAccessCollection of Pass, plus failure: PropagationFailure?
Pass rise: Event?, culmination: Event, set: Event?; each Event has time and look
Look azimuth, elevation, range, rangeRate, received(from:), transmit(toBeReceivedAt:), speedOfLight

Errors

type kinds
Refusal 19 kinds, below; with message, field, text, catalogField, record (from 0), line (from 1)
PropagationFailure notSGP4, eccentricity, meanMotion, perturbedEccentricity, semiLatusRectum, decayed, time; with minutesFromEpoch

Refusal.Kind

kind when
emptyInput nothing but whitespace
notUTF8 the bytes aren't UTF-8
malformedFile JSON that doesn't parse, XML that isn't well formed, a CSV without a header
cutShort the file ends inside a record
lineLength a TLE line that isn't 69 characters, or holds a character outside printable ASCII
checksum a check digit that isn't the one the line computes to
missingLine2 / missingLine1 a line 1 with no line 2 after it / a line 2 with no line 1 before it
strayLine neither an element line nor the name of the set that follows
layout a separator column that isn't a space, a field out of place
catalogNumber neither five digits nor Alpha-5; an OMM number that isn't up to nine digits; two catalog fields that differ
notANumber / notAnInteger a number field that isn't one / a counter that isn't a non-negative integer
notAnEpoch not a CCSDS time, not a YYDDD.DDDDDDDD field, or not a date
notText a designator or classification a TLE's columns can't hold
missingKeyword / duplicateKeyword a required keyword missing / one keyword twice in a record
malformedRecord a record whose structure isn't the format's
cannotEncode a value a TLE can't carry: a catalog number above 339999, a field wider than its columns

K-10K-25K-33

Sources

  1. K-10 The public API (signatures). Source: GPKit: docs/public-api.swift (generated by tools/public-api.sh).
  2. K-25 Refusals carry a kind (19 kinds), a message, a field and a line or record. One bad record costs one record. Source: GPKit: Refusal.swift:7-89; README.md:81-83.
  3. K-33 Error codes map to PropagationFailure.Kind. Source: GPKit: Propagator.swift:33-48,115-122.