Added colors for different satellite types

pull/10/head
Cees Bassa 2018-04-10 11:47:20 +02:00
parent 543c87ea14
commit 3d237f8022
3 changed files with 44 additions and 7 deletions

View File

@ -237,11 +237,8 @@ int main(int argc,char *argv[])
// Human readable frequency axis
fcen=0.5*(fmax+fmin);
cpgswin(xmin,xmax,fmin-fcen,fmax-fcen);
if (foverlay==1) {
cpgsci(3);
if (foverlay==1)
plot_traces(t,nsat,fcen);
cpgsci(1);
}
fcen=floor(1000*fcen)/1000.0;
sprintf(ylabel,"Frequency - %.3f MHz",fcen);
@ -864,6 +861,12 @@ void plot_traces(struct trace *t,int nsat,float fcen)
// Loop over objects
for (i=0;i<nsat;i++) {
// Select color
if (t[i].classfd==1)
cpgsci(8);
else
cpgsci(3);
sprintf(text," %d",t[i].satno);
// Plot label at start of trace
@ -875,7 +878,7 @@ void plot_traces(struct trace *t,int nsat,float fcen)
// Plot label for rising sources
if (j>0 && t[i].za[j-1]>90.0 && t[i].za[j]<=90.0)
cpgtext((float) j,(float) t[i].freq[j]-fcen,text);
// Plot line
if (flag==0) {
cpgmove((float) j,t[i].freq[j]-fcen);
@ -891,6 +894,7 @@ void plot_traces(struct trace *t,int nsat,float fcen)
flag=1;
}
}
cpgsci(1);
return;
}

View File

@ -439,6 +439,37 @@ void identify_trace(char *tlefile,struct trace t,int satno)
return;
}
// Is it a classified satellite
int is_classified(int satno)
{
int flag=0,no;
char *env,tlefile[128],line[LIM];
FILE *file;
// Get classfd.tle path
env=getenv("ST_TLEDIR");
sprintf(tlefile,"%s/classfd.tle",env);
// Does it exist
file=fopen(tlefile,"r");
if (file==NULL) {
printf("%s not found\n",tlefile);
flag=0;
} else {
// Loop over TLEs
while (fgetline(file,line,LIM)>0) {
// Use 1st TLE line
if (line[0]=='1') {
sscanf(line+2,"%d",&no);
if (no==satno) flag=1;
}
}
}
fclose(file);
return flag;
}
// Compute trace
struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float freq,float bw,int *nsat,int graves)
{
@ -540,7 +571,9 @@ struct trace *compute_trace(char *tlefile,double *mjd,int n,int site_id,float fr
t[j].mjd=(double *) malloc(sizeof(double)*m);
t[j].freq=(double *) malloc(sizeof(double)*m);
t[j].za=(float *) malloc(sizeof(float)*m);
t[j].classfd=is_classified(t[j].satno);
t[j].graves=graves;
sprintf(text," %d",satno);
// Loop over TLEs
file=fopen(tlefile,"r");

View File

@ -1,5 +1,5 @@
struct trace {
int satno,n,site;
int satno,n,site,classfd,graves;
double *mjd;
double *freq,freq0;
float *za;