SGP.NET icon indicating copy to clipboard operation
SGP.NET copied to clipboard

Invalid sign exception due to B* two-digit exponent misaligning TLE columns

Open KrailH opened this issue 2 months ago • 3 comments

Description:

When parsing Starlink TLEs from Celestrak (https://celestrak.org/NORAD/elements/gp.php?GROUP=starlink&FORMAT=tle), SGP.NET throws:

SGPdotNET.Exception.TleException: Invalid sign

Example TLE that triggers the issue:

STARLINK-4553 1 53577U 22101BC 25345.55693763 -.00000288 00000+0 87000-10 0 9990 2 53577 53.2164 89.5151 0001372 89.9326 270.1823 15.08845301183964

Root cause:

The B* drag term (87000-10) has a two-digit exponent (-10). In a fixed-width TLE, this shifts the preceding space and misaligns columns. SGP.NET expects B* to be strictly 8 characters: 5-digit mantissa + 1-digit exponent. The misalignment causes the parser to see an invalid sign and throw an exception.

Expected behavior:

SGP.NET should either:

  1. Support B* values with two-digit exponents while keeping proper column alignment, or
  2. Provide a way to preprocess/normalize such TLEs to compatible single-digit exponent format.

20251212095028.txt

KrailH avatar Dec 12 '25 02:12 KrailH