NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
Almanac computations
From: Paul Hirose
Date: 2009 Jul 25, 13:53 -0700
From: Paul Hirose
Date: 2009 Jul 25, 13:53 -0700
douglas.denny@btopenworld.com wrote:
> I am very pleased to see the SOFA source code algorithms are freely
available on the internet as a common international resource.
It's only recently that C language SOFA source code became available.
Earlier versions were in Fortran 77 only, and that's still the case for
the JPL ephemeris code. However, some people have put C translations on
the Web.
> It's a long time I played around with astro for amusement. Having
taken up an interest again as a hobby I shall have to brush up my 'C'
programming on the computer to try them for fun it, being the early
1990s when I last played around with programming in 'C'. I still use
a calculator programmed from the 'Explanatory Supplement' (1974
impression) and Meeus' book.
My SofaJpl package may be useful. It's a free Windows .NET Framework
implementation of the IAU SOFA library and JPL ephemeris routines.
SofaJpl is not a complete program; rather, it's a toolbox of executable
code which is installed on your computer and called from any suitably
written program.
The complete SOFA library is included. That's about one megabyte of
Fortran 77 source code. The JPL ephemeris routines are also present, and
can handle any of the JPL ephemerides available online: DE102, DE200,
DE202, DE403, DE405, DE406, DE410, DE413, DE414, DE418, and DE421. The
ephemerides themselves (the data files) are not provided; they can be
downloaded from the JPL site.
Although any SOFA or JPL routine may be called directly, the extensive
set of classes in SofaJpl normally make that unnecessary. For example,
the following C# code computes the geocentric apparent place of Venus on
2009 July 1 at 0 hours Terrestrial Time, using the DE406 ephemeris at
.01" accuracy. The precise method of Section B in the Almanac is used,
including the relativistic deflection of light due to the Sun's gravity.
Coordinates are converted to the true equator and equinox of date with
the latest IAU precession and nutation model. (The nutation part alone
has about 1500 terms.) Finally, the result in vector form (rectangular
coordinates) is converted to spherical coordinates, then each coordinate
converted from radians to sexagesimal hours or degrees and displayed
with appropriate formatting.
SofaJpl.JulianDate tt =
new SofaJpl.JulianDate(2009, 7, 1, 0, 0, 0.0);
double accuracy = SofaJpl.Angle.DmsToRad(0.0, 0.0, .01);
SofaJpl.Jpl.OpenEphemeris("binp2000_2099.406");
SofaJpl.JplEphBody venus =
new SofaJpl.JplEphBody(SofaJpl.Jpl.Body.Venus, accuracy);
SofaJpl.Vector venusVector = venus.GeocentricApparent(tt);
SofaJpl.RMatrix crsToTrue = SofaJpl.RMatrix.CrsToTrue06a(tt);
venusVector = crsToTrue * venusVector;
SofaJpl.Spherical sph = new SofaJpl.Spherical(venusVector);
SofaJpl.Sexagesimal raSex = new SofaJpl.Sexagesimal(
SofaJpl.Angle.RadiansToHours(sph.RA), 3600000.0);
SofaJpl.Sexagesimal decSex = new SofaJpl.Sexagesimal(
SofaJpl.Angle.RadiansToDegrees(sph.Dec), 360000.0);
Console.WriteLine("RA = {0:ahms}, dec. = {1:a°'\"}",
raSex, decSex);
The program output reads:
RA = 3h34m29.168s, dec. = +16°26'53.63"
That's identical to the values in The Astronomical Almanac. A perfect
match is no surprise, since the Almanac was computed with the JPL DE405
ephemeris (closely related to DE406 used above) and the SOFA library.
SofaJpl is described in detail at my Web site:
http://home.earthlink.net/~s543t-24dst/sofajplNet/index.html
--
--~--~---------~--~----~------------~-------~--~----~
NavList message boards: www.navlist.net
Or post by email to: NavList@navlist.net
To , email NavList-@navlist.net
-~----------~----~----~----~------~----~------~--~---






