1
0
Fork 0

Added help option

pull/13/merge
Cees Bassa 2018-02-27 17:19:34 +01:00
parent 3c221de4aa
commit 7ddd2c4cbb
7 changed files with 90 additions and 25 deletions

View File

@ -64,7 +64,7 @@ int main(int argc,char *argv[])
m.mjd=nfd2mjd(m.nfd);
// Decode options
while ((arg=getopt(argc,argv,"t:s:S:"))!=-1) {
while ((arg=getopt(argc,argv,"t:s:S:h"))!=-1) {
switch (arg) {
case 't':

View File

@ -5,7 +5,6 @@
4553 CB 53.3210 -2.2330 86 Cees Bassa
0001 MM 30.3340 -97.7610 160 Mike McCants
0002 MM 30.3138 -97.8661 280 Mike McCants
0011 VA 44.7269 34.0167 580 Crimea Astrophysical Observatory
0030 IA 47.4857 18.9727 400 Ivan Artner
0031 IA 47.5612 18.7366 149 Ivan Artner
0070 BC 53.2233 -0.6003 30 Bob Christy
@ -13,6 +12,7 @@
0110 LK 32.5408 -96.8906 200 Lyn Kennedy
0433 GR -33.9406 18.5129 10 Greg Roberts
0434 IR -26.1030 27.9288 1646 Ian Roberts
0435 GR -33.9369 18.5101 25 Greg Roberts
0710 LS 52.3261 10.6756 85 Lutz Schindler
0899 FM -34.8961 -56.1227 30 Fernando Mederos
1056 MK 57.0122 23.9833 4 Martins Keruss
@ -41,6 +41,7 @@
6226 SC 28.4861 -97.8194 110 Scott Campbell
7777 BY 38.1656 -2.3267 1608 Brad Young remote
7778 BY -31.2733 149.0644 1122 Brad Young SSO
7779 BY 32.9204 -105.5283 2225 Brad Young NM
8048 ST 49.4175 -123.6420 1. Scott Tilley
8049 ST 49.4348 -123.6685 40. Scott Tilley
8305 PG 26.2431 -98.2163 30 Paul Gabriel
@ -51,6 +52,7 @@
8539 SN 39.4707 -79.3388 839 Steve Newcomb
8597 TB -34.9638 138.6333 100 Tony Beresford
8600 PC -32.9770 151.6477 18 Paul Camilleri
0699 PC -14.4733 132.2369 108 Paul Camilleri
8730 EC 30.3086 -97.7279 150 Ed Cannon
8739 DB 37.1133 -121.7028 282 Derek Breit
9461 KO 47.9175 19.89365 938 Konkoly Obs
@ -59,11 +61,4 @@
6242 JM 42.9453 -2.8284 623 Jon Mikel
6241 JM 42.9565 -2.8203 619 Jon Mikel
4160 BD 51.2793 5.4768 35 Bram Dorreman
9004 WW 51.3521 -1.8017 133 Wilcot Wiltshire
9000 PP 40.0848 21.1581 1433 Pierros Papadeas
9001 AF 44.5700 6.68 1850 Alain Figer
9002 AO 62.2544 26.5962 150 Arto Oksanen
9003 CP -24.6272 -70.4047 2638 Cerro Paranal
9004 LP 28.7622 -17.8775 2396 Isaac Newton
9999 GR 47.348 5.5151 100 Graves
0899 FM -34.8961 -56.1227 30 Fernando Mederos

View File

@ -13,6 +13,9 @@ F77 = gfortran
all:
make addwcs angular calibrate dec2sex faketle fitsheader fitskey imgstat jpg2fits jpgstack measure pgm2fits plotfits pstrack rde2iod reduce residuals runsched satfit satid satmap satorbit sex2dec skymap tle2ole tleinfo uk2iod viewer wcsfit deproject slewto waitfor pass detect launchtle propagate fakeiod csv2tle normal posmatch posvel xyz2tle mvtle confirm allnight
geolon: geolon.o sgdp4.o satutl.o deep.o ferror.o
$(CC) -o geolon geolon.o sgdp4.o satutl.o deep.o ferror.o -lm
allnight: allnight.o
$(CC) -o allnight allnight.o -lm

View File

@ -2,6 +2,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "qfits.h"
#include "cpgplot.h"
#include "cel.h"
@ -54,6 +55,57 @@ struct image read_fits(char *filename,int pnum);
int fgetline(FILE *file,char *s,int lim);
int select_nearest(struct catalog c,float x,float y);
void plot_defects(void)
{
FILE *file;
char *env,filename[128];
float x,y;
char line[LIM];
// Environment variables
env=getenv("ST_DATADIR");
sprintf(filename,"%s/data/defects.txt",env);
file=fopen(filename,"r");
if (file==NULL) {
fprintf(stderr,"Defects file not found!\n");
return;
}
cpgsci(7);
while (fgetline(file,line,LIM)>0) {
sscanf(line,"%f %f",&x,&y);
cpgpt1(x,y,19);
}
fclose(file);
cpgsci(1);
return;
}
void log_defects(float x,float y)
{
FILE *file;
char *env,filename[128];
// Environment variables
env=getenv("ST_DATADIR");
sprintf(filename,"%s/data/defects.txt",env);
file=fopen(filename,"a");
if (file==NULL) {
fprintf(stderr,"Defects file not found!\n");
return;
}
fprintf(file,"%4.0f %4.0f\n",x,y);
fclose(file);
return;
}
// Return x modulo y [0,y)
double modulo(double x,double y)
{
@ -677,12 +729,14 @@ int main(int argc,char *argv[])
cpgsci(1);
}
plot_defects();
redraw=0;
}
// Get cursor
cpgcurs(&x,&y,&c);
// Quit
if (c=='q')
break;
@ -707,6 +761,12 @@ int main(int argc,char *argv[])
redraw=1;
}
// Mark bad pixel
if (c=='t') {
log_defects(x,y);
redraw=1;
}
// Plot catalog
if (c=='l') {
if (plotcat==1)

View File

@ -2,6 +2,7 @@
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include "cpgplot.h"
#include "sgdp4h.h"
#include "satutl.h"
@ -334,10 +335,10 @@ int main(int argc,char *argv[])
int imode,satno=0,arg,usecatalog=0,satnomin,flag=0;
FILE *file;
orbit_t orb;
xyz_t r,v,n,m,nm;
xyz_t r,v,n,m,nm,r0,v0,mr,mv;
char tlefile[LIM],catalog[LIM],nfd[32];
char line1[80],line2[80],desig[20];
double mjd,ra,de,dr,drmin;
double mjd,ra,de,dr,drmin,dmr,dmv;
char *env;
// Get environment variable
@ -395,13 +396,10 @@ int main(int argc,char *argv[])
// Propagate
imode=init_sgdp4(&orb);
imode=satpos_xyz(mjd+2400000.5,&r,&v);
imode=satpos_xyz(mjd+2400000.5,&r0,&v0);
// Convert
orb=rv2el(orb.satno,mjd,r,v);
// Compute normal
n=cross(r,v);
n=cross(r0,v0);
ra=modulo(atan2(n.y,n.x)*R2D,360.0);
de=asin(n.z/magnitude(n))*R2D;
@ -422,25 +420,33 @@ int main(int argc,char *argv[])
imode=init_sgdp4(&orb);
imode=satpos_xyz(mjd+2400000.5,&r,&v);
// Convert
orb=rv2el(orb.satno,mjd,r,v);
// Compute normal
m=cross(r,v);
// Difference
// Normal difference
nm.x=n.x-m.x;
nm.y=n.y-m.y;
nm.z=n.z-m.z;
dr=magnitude(nm);
// Position/velocity difference
mr.x=r0.x-r.x;
mr.y=r0.y-r.y;
mr.z=r0.z-r.z;
mv.x=v0.x-v.x;
mv.y=v0.y-v.y;
mv.z=v0.z-v.z;
if (flag==0 || dr<drmin) {
drmin=dr;
dmr=magnitude(mr);
dmv=magnitude(mv);
satnomin=orb.satno;
flag=1;
}
}
printf("%05d %05d %8.2f km\n",satno,satnomin,drmin);
printf("%05d %05d %8.2f km %8.2f km %10.6f km/s\n",satno,satnomin,drmin,dmr,dmv);
}
return 0;

View File

@ -79,11 +79,11 @@ double doy2mjd(int year,double doy)
int main(int argc,char *argv[])
{
int i,arg=0,imode,n=172800,satno,satname,satno2,imin,flag,status;
char catalog1[]="catalog.txt",catalog2[]="ison.txt";
int i,arg=0,imode,n=100,satno,satname,satno2,imin,flag,status;
char catalog1[]="20180121_173045_catalog.txt",catalog2[]="jsc_20180122.txt";
FILE *file1,*file2;
orbit_t orb1,orb2;
double mjd0=56908.0,mjd;
double mjd0=58140.0,mjd;
xyz_t *r,*v,r0,v0,d,n1,n2;
double dr,dv,dn,drmin,dvmin,mjdmin;
char line0[LIM],line1[LIM],line2[LIM];

View File

@ -175,7 +175,8 @@ void init_plot(char *psfile,float width,float aspect)
cpgopen(psfile);
cpgslw(2);
cpgpap(width,aspect);
// cpgpap(width,aspect);
cpgpap(0.0,aspect);
return;
}