From 02e979f2619a54f8fa499b93ca6afda8b04f8766 Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Sun, 3 Mar 2024 18:54:09 -0500 Subject: [PATCH] If a TLE has no COSPAR (international) designation, one is generated from the NORAD number. It'll have launch number 000, i.e., not one corresponding to a 'real' COSPAR designation. --- get_el.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/get_el.cpp b/get_el.cpp index 45584a8..075d858 100644 --- a/get_el.cpp +++ b/get_el.cpp @@ -320,6 +320,16 @@ int DLL_FUNC parse_elements( const char *line1, const char *line2, tle_t *sat) sat->bulletin_number = atoi( tbuff); sat->classification = line1[7]; /* almost always 'U' */ memcpy( sat->intl_desig, line1 + 9, 8); + if( !memcmp( sat->intl_desig, " ", 5)) + { /* usually 'analyst' object w/o international (COSPAR) desig; */ + int i, n = sat->norad_number; /* set launch 000, year/part */ + /* data mapped from NORAD # */ + for( i = 7; i > 4; i--, n /= 26) + sat->intl_desig[i] = 'A' + n % 26; + sat->intl_desig[2] = sat->intl_desig[3] = sat->intl_desig[4] = '0'; + sat->intl_desig[1] = '0' + n % 10; + sat->intl_desig[0] = '0' + n / 10; + } sat->intl_desig[8] = '\0'; memcpy( tbuff, line2 + 63, 5); tbuff[5] = '\0';