Return result in radians.

This commit is contained in:
curt 2000-03-27 22:30:11 +00:00
parent b0b5f5035a
commit f47fdd63f7
2 changed files with 6 additions and 3 deletions

View File

@ -271,7 +271,7 @@ double SGMagVar( double lat, double lon, double h, long dat, double* field )
field[4]=Y;
field[5]=Z; /* output fields */
/* find variation, convert to degrees! */
return rad_to_deg(atan2(Y, X)); /* E is positive */
/* find variation, leave in radians! */
return atan2(Y, X); /* E is positive */
}

View File

@ -43,9 +43,12 @@ if (argc == 8){
var = SGMagVar( deg_to_rad(lat_deg), deg_to_rad(lon_deg), h,
yymmdd_to_julian_days(yy,mm,dd), field );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[0], field[1], field[2] );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf\n", field[3], field[4], field[5] );
fprintf(stdout,"%6.0lf %6.0lf %6.0lf %4.2lf %4.2lf \n",
field[3],field[4],field[5],
rad_to_deg(atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),var);
rad_to_deg(atan(field[5]/pow(field[3]*field[3]+field[4]*field[4],0.5))),
rad_to_deg(var));
exit(0);
}