Welcome to the NavList Message Boards.


A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

Compose Your Message

Add Images & Files
    Almanac computations
    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.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:
    I filter out messages with attachments or HTML.
    NavList message boards: www.fer3.com/arc
    Or post by email to: NavList@fer3.com
    To unsubscribe, email NavList-unsubscribe@fer3.com

    Browse Files

    Drop Files


    What is NavList?

    Join NavList

    (please, no nicknames or handles)
    Do you want to receive all group messages by email?
    Yes No

    You can also join by posting. Your first on-topic post automatically makes you a member.

    Posting Code

    Enter the email address associated with your NavList messages. Your posting code will be emailed to you immediately.

    Email Settings

    Posting Code:

    Custom Index

    Start date: (yyyymm dd)
    End date: (yyyymm dd)

    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site
    Visit this site