Skip to content

Commit

Permalink
'add_off.c' : if the input astrometry contains two or more observatio…
Browse files Browse the repository at this point in the history
…ns made at exactly the same time from the same spacecraft, we only request one position/velocity. Previously, the code wouldn't notice the duplication and would bang on the JPL Horizons server for each observation.
  • Loading branch information
Bill-Gray committed Aug 11, 2024
1 parent e8a50e9 commit 320030d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions add_off.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,18 @@ static int set_offsets( offset_t *offsets, const int n_offsets)
for( i = 0; i < n_offsets; i++)
if( !strcmp( offsets[i].mpc_code, offsets[0].mpc_code))
{
if( i)
strlcat_err( buff, ",", sizeof( buff));
snprintf_err( buff + strlen( buff), 18, "'%.6f'", offsets[i].jd - 2400000.5);
char tbuff[15];

assert( offsets[i].jd > hst_launch_jd
&& offsets[i].jd < 2700000.);
snprintf_err( tbuff, sizeof( tbuff),
"'%.6f'", offsets[i].jd - 2400000.5);
if( !strstr( buff, tbuff)) /* don't add the same time twice */
{
if( i)
strlcat_error( buff, ",");
strlcat_error( buff, tbuff);
}
if( strlen( buff) + 60 > sizeof( buff)) /* allow room for 'cmd_end' */
break;
}
Expand Down Expand Up @@ -437,7 +446,7 @@ int process_file( const char *filename, FILE *ofile)
set_offsets( offsets + i, n_offsets - i);
}
if( !ades_found)
fprintf( ofile, "COM add_off ver 2024 May 02, run %s", ctime( &t0));
fprintf( ofile, "COM add_off ver 2024 Aug 11, run %s", ctime( &t0));
fseek( ifile, 0, SEEK_SET);
while( fgets( buff, sizeof( buff), ifile))
if( (jd = get_sat_obs_jd( buff)) <= 0.) /* not an observation; */
Expand Down

0 comments on commit 320030d

Please sign in to comment.