Skip to content

Commit 4b0e8de

Browse files
committed
Sat_ID now has '-fa' (make identifications only to artificial objects) and '-fn' (only natural objects) command line options. Default is to make identifications to both types of objects.
1 parent a0748df commit 4b0e8de

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

sat_id.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ typedef struct
145145
#define EARTH_MINOR_AXIS 6356752.
146146
#define is_power_of_two( X) (!((X) & ((X) - 1)))
147147

148+
/* By default, Sat_ID checks for possible matches with both artificial
149+
objects (its main use) and some natural irregular satellites of the gas
150+
giants. Use the '-n0' command line option to identify only artificial
151+
objects, or '-n1' to identify only the natural irregular objects. */
152+
153+
#define IDENTIFY_ALL 2
154+
#define IDENTIFY_ARTSATS 0
155+
#define IDENTIFY_NATSATS 1
156+
157+
static int identify_filter = IDENTIFY_ALL;
158+
148159
/* For testing purposes, I sometimes want _only_ "my" TLEs (not the
149160
'classified' or Space-Watch TLEs) to be used. This is invoked with -s. */
150161
static bool my_tles_only = false;
@@ -1348,11 +1359,17 @@ static int add_tle_to_obs( object_t *objects, const size_t n_objects,
13481359
{
13491360
int n_read = sscanf( line2 + 6, "%d %s", &search_norad, search_intl);
13501361
size_t i;
1362+
bool is_natural;
13511363

13521364
assert( 2 == n_read);
13531365
for( i = strlen( search_intl); i < 8; i++)
13541366
search_intl[i] = ' ';
13551367
search_intl[8] = '\0';
1368+
is_natural = isdigit( search_intl[7]);
1369+
if( identify_filter == IDENTIFY_ARTSATS && is_natural)
1370+
look_for_tles = false;
1371+
if( identify_filter == IDENTIFY_NATSATS && !is_natural)
1372+
look_for_tles = false;
13561373
}
13571374
else if( !memcmp( line2, "# ID off", 8))
13581375
{
@@ -1554,6 +1571,18 @@ int main( const int argc, const char **argv)
15541571
case 'd':
15551572
_target_desig = param;
15561573
break;
1574+
case 'f':
1575+
if( *param == 'n')
1576+
identify_filter = IDENTIFY_NATSATS;
1577+
else if( *param == 'a')
1578+
identify_filter = IDENTIFY_ARTSATS;
1579+
else
1580+
{
1581+
fprintf( stderr, "Bad command line switch '%s'\n", argv[i]);
1582+
fprintf( stderr, "Use -fa to show only artsats, -fn to show only natsats\n");
1583+
return( -1);
1584+
}
1585+
break;
15571586
case 'i':
15581587
intl_desig = param;
15591588
break;

0 commit comments

Comments
 (0)