11/*
22Name: geositer500.c
3- Version: 2.7
4- Date: 2021-11-22
3+ Version: 2.8
4+ Date: 2021-12-15
55Author: zvezdochiot (https://github.com/zvezdochiot)
66Author: Zoltan Siki (https://github.com/zsiki)
77*
@@ -54,7 +54,7 @@ OKD-12 3.8890 288.39138889 133.60805556
5454#include <unistd.h>
5555
5656#define PNAME "GeoSIter500"
57- #define PVERSION "2.7 "
57+ #define PVERSION "2.8 "
5858
5959#define defREarth 6370009.0
6060#define defUnits "DEG"
@@ -68,6 +68,7 @@ void geositer500usage()
6868{
6969 fprintf (stderr , "usage: geositer500 [option] input-file report-file\n" );
7070 fprintf (stderr , "options:\n" );
71+ fprintf (stderr , " -a N.N atmospheric refractive index, default=0.0\n" );
7172 fprintf (stderr , " -d N decimal after comma, default=4\n" );
7273 fprintf (stderr , " -r N.N radius Earth, default=6370009.0\n" );
7374 fprintf (stderr , " -u str units angles {RAD,DEG,GON,DMS}, default=DEG\n" );
@@ -152,20 +153,23 @@ int main(int argc, char *argv[])
152153 FILE * fp0 , * fp1 ;
153154
154155 int opt ;
155- double RE = defREarth ;
156156 int decimals = 4 ; /* number of decimals in the calculated coordinates */
157+ double atmospheric = 0.0 , RE = defREarth ;
157158 int fhelp = 0 ;
158159 units = defUnits ;
159- while ((opt = getopt (argc , argv , "d:r:u:h" )) != -1 )
160+ while ((opt = getopt (argc , argv , "a: d:r:u:h" )) != -1 )
160161 {
161162 switch (opt )
162163 {
163- case 'h ' :
164- fhelp = 1 ;
164+ case 'a ' :
165+ atmospheric = atof ( optarg ) ;
165166 break ;
166167 case 'd' :
167168 decimals = atoi (optarg );
168169 break ;
170+ case 'h' :
171+ fhelp = 1 ;
172+ break ;
169173 case 'r' :
170174 RE = atof (optarg );
171175 break ;
@@ -247,7 +251,7 @@ int main(int argc, char *argv[])
247251 j ++ ;
248252 }
249253 x [1 ] = ANGLEtoRAD (x [1 ], units );
250- x [1 ] -= (RE > 0.0 ) ? (x [0 ] * sin (x [1 ]) * 0.5 / RE ) : 0.0 ;
254+ x [1 ] -= (RE > 0.0 ) ? (x [0 ] * sin (x [1 ]) * 0.5 / RE * ( 1.0 - atmospheric ) ) : 0.0 ;
251255 x [2 ] = ANGLEtoRAD (x [2 ], units );
252256 y [2 ] = x [0 ] * cos (x [1 ]);
253257 x [0 ] *= sin (x [1 ]);
@@ -287,7 +291,7 @@ int main(int argc, char *argv[])
287291 j ++ ;
288292 }
289293 x [1 ] = ANGLEtoRAD (x [1 ], units );
290- x [1 ] -= (RE > 0.0 ) ? (x [0 ] * sin (x [1 ]) * 0.5 / RE ) : 0.0 ;
294+ x [1 ] -= (RE > 0.0 ) ? (x [0 ] * sin (x [1 ]) * 0.5 / RE * ( 1.0 - atmospheric ) ) : 0.0 ;
291295 x [2 ] = ANGLEtoRAD (x [2 ], units );
292296 y [2 ] = x [0 ] * cos (x [1 ]);
293297 x [0 ] *= sin (x [1 ]);
0 commit comments