Improved error handling on SGPD4_ERROR

pull/30/head
Cees Bassa 2022-02-03 23:31:47 +01:00
parent 2314bb8a5e
commit 1fb156c377
2 changed files with 35 additions and 19 deletions

30
rffit.c
View File

@ -197,9 +197,10 @@ int identify_satellite_from_doppler(char *catalog,double rmsmax)
while (read_twoline(fp,0,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
// velocity(orb,d.p[d.n/2].mjd,d.p[d.n/2].s,&v,&azi,&alt);
// if (alt<0.0)
// printf("Continue?\n");
@ -247,8 +248,10 @@ int identify_satellite_from_visibility(char *catalog,double altmin)
while (read_twoline(fp,0,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
if (orb.rev<10.0)
continue;
@ -468,8 +471,10 @@ int main(int argc,char *argv[])
if (satno>0 && plot_curve==1) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
break;
}
cpgsci(15);
// for (mjd=d.mjd0,i=0;mjd<d.mjd0+xmax;mjd+=1.0/1440.0,i++) {
@ -570,8 +575,10 @@ int main(int argc,char *argv[])
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
break;
}
// Loop over sites for plotting model
for (j=0;j<nsite;j++) {
@ -775,6 +782,7 @@ int main(int argc,char *argv[])
}
satno=identify_satellite_from_doppler(catalog,rms);
if (satno>0) {
rms=fit_curve(orb,ia);
redraw=1;
plot_curve=1;
}
@ -1547,8 +1555,8 @@ double chisq(double a[])
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR)
printf("Error with %d\n",orb.satno);
// Loop over highlighted points
for (i=0,sum1=0.0,sum2=0.0;i<d.n;i++) {
@ -1596,8 +1604,8 @@ double compute_rms(void)
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR)
printf("Error with %d\n",orb.satno);
// Compute rms
for (i=0,n=0,rms=0.0;i<d.n;i++) {

View File

@ -219,8 +219,10 @@ void identify_trace_graves(char *tlefile,struct trace t,int satno)
while (read_twoline(file,satno,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("SGDP4 Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
// Loop over points
for (i=0,sum1=0.0,sum2=0.0;i<t.n;i++) {
@ -366,8 +368,10 @@ void identify_trace(char *tlefile,struct trace t,int satno)
while (read_twoline(file,satno,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("SGDP4 Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
// Loop over points
for (i=0,sum1=0.0,sum2=0.0;i<t.n;i++) {
@ -597,8 +601,10 @@ struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fr
while (read_twoline(file,satno,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
// Loop over points
for (i=0,flag=0,tflag=0;i<m;i++) {
@ -706,8 +712,10 @@ void compute_doppler(char *tlefile,double *mjd,int n,int site_id,int satno,int g
while (read_twoline(file,satno,&orb)==0) {
// Initialize
imode=init_sgdp4(&orb);
if (imode==SGDP4_ERROR)
printf("Error\n");
if (imode==SGDP4_ERROR) {
printf("Error with %d, skipping\n",orb.satno);
continue;
}
// Skip high satellites
if (skiphigh==1 && orb.rev<10.0)