JPL Planetary Ephemeris Export Package [1/15/96]
------------------------------------------------

It is assumed that you have read /ephem/export/README from the 
anonymous ftp site and that you have transferred the appropriate 
files to your own computer.

There are two modes: 

   1) UNIX users who have transferred binary files.
   2) All other users.  I.e., those who have transferred ASCII files.
    
The object is to have a binary file(s), written in the specific binary 
format of your computer.  For UNIX users, the binary file(s) that you 
have transferred are already in that format.  For the others, you must 
convert the ASCII blocks into a binary file.

The blocks that you have retrieved (binary or ASCII) cover specific 
intervals of time.  They may be used separately, or they may be merged 
together into a single large file.


ASCII to BINARY (for non-UNIX users)
------------------------------------

To convert the ASCII blocks into a binary ephemeris, you must first 
compile and run (one-time only) the program "asc2eph".  This program 
accepts, via standard input, a header file followed by one or more of 
the ASCII ephemeris blocks.  Thus, the input is "header.XXX" and (a 
series of) "ascSYYYY.XXX".  The blocks must be in order with no gaps 
in the intervals of time-coverage.  The binary ephemeris is written 
onto a file called "JPLEPH".

An example for running asc2eph on a PC is the following:

   C:\> copy header.200 + ascp1980.200 + ascp2000.200 + ascp2020.200 + ascp2040
   infile.200

   C:\> asc2eph < infile.200

In UNIX, one would use:

  cat header.200 ascp1980.200 ascp2000.200 ascp2020.200 ascp2040 | asc2eph.e

Alternatively, you may make an individual binary file for each of the 
ASCII blocks, by running "asc2eph" separately for each ASCII block.  
These separate binary files may later be merged together by using 
"binmerge".  This method has the advantage of requiring less storage 
during the creation process, since an ASCII file requires about three 
times as much storage as the equivalent binary file.
           
TESTING THE BINARY FILE
-----------------------

Once you have a binary ephemeris file, you may test it using the program, 
"testeph".  This program computes ephemeris positions and compares the 
results with equivalent values computed at JPL, contained in the file 
"testpo.XXX".  So, compile and run "testeph", sending "testpo.XXX" to the 
executable via standard input and assign the name "JPLEPH" to the binary 
ephemeris file that you are testing.

  The program "testeph" will print out the list of ephemeris constants
  (retrieved by the subroutine "CONST") and will then use the subroutine
  "PLEPH" to read and interpolate the ephemeris for coordinates
  corresponding to the sample ones in "testpo.xxx".  If any comparison
  yields a difference larger than 10**(-13) [in units of au or au/day],
  an error message will be printed out.  Further, a line  will be printed
  every 100 comparisons in any case, so that the progress can be monitored.


TAILORING THE SOFTWARE
----------------------

     The software was written in standard Fortran-77.  It should work on 
     any machine with a standard compiler.  

     HOWEVER, there are two parts which are compiler dependent; both have
     to do with opening and reading a direct-access file.  They are dealt
     with in the subroutine FSIZERi, i=1,3.  (There are three versions of
     this subroutine.

     1) The parameter RECL in the OPEN statement is the number of units per
        record.  For some compilers, it is given in bytes; in some, it is given
        in single precision words.  In the subroutine FSIZER of TESTEPH, the
        parameter NRECL must be set to 4 if RECL is given in bytes; NRECL must
        be set to 1 if RECL is given in words.  (If in doubt, use 4 for UNIX;
        1 for VAX and PC)

     2) Also for the OPEN statement, the program needs to know the exact value
        of RECL (number of single precision words times NRECL).  Since this
        varies from one JPL ephemeris to another, RECL must be determined somehow
        and given to the OPEN statement.  There are three methods, depending
        upon the compiler.  We have included three versions of the subroutine
        FSIZER, one for each method.

        a)  Use the INQUIRE statement to find the length of the records
            automatically before opening the file.  This works for VAX's;
            not in UNIX.
        b)  Open the file with an arbitrary value of RECL, read the first record,
            and use the information on that record to determine the exact value
            of RECL.  Then, close the file and re-open it with the exact value.
            This seems to work for UNIX compilers as long as the initial value of
            RECL is less than the exact value but large enough to get the required
            information from the first file.  (For other compilers, this doesn't
            work since you can open a file only with the exact value of RECL.)

        c)  Hardwire the value of RECL.  This number is NRECL*1652 for DE200,
            NRECL*2036 for DE403, and NRECL*1456 for DE404.


   The USER must select which version of FSIZER suits his computer/compiler.


FINAL PRODUCT
-------------

When "testeph" has run successfully, you are done, because "testeph" 
contains and uses the subroutines that are of primary interest to you.
           
   1.  PLEPH reads and interpolates the direct access ephemeris file, and 

   2.  CONST extracts the constants used in making the ephemeris (planetary 
       masses,  length of the au, etc.)

****************************************************************************

       *************   USER NOTES   *****************

  ***  Dec Alpha  ***

  The machine I'm running is a Digital Alpha workstation,
running Digital Unix, also known as OSF/1.  Nearly all
the difficulty I had getting things to go could be
traced to a single problem:

             NREC = 1       for Digital Unix (OSF/1) on Alpha machines.

Also, for some reason the DEC f77 compiler didn't like the
statement

      READ(nfil,REC=NREC,END=6,ERR=98)(DATA(K),K=1,NDATA)

because it didn't recognize the END keyword.  I got around
this by making ERR=6, which is a little dangerous but which
appeared to work ...

****************************************************************************


ASSISTANCE
----------

If you are really stuck, direct your questions to

*****************************************************
* Myles Standish; JPL 301-150; Pasadena, CA  91109  *
* TEL: 818-354-3959               FAX: 818-393-6388 *
* Internet: ems@smyles.jpl.nasa.gov [128.149.23.23] *
*****************************************************

I shall try to answer your questions when I'm free from my normal 
obligations.

However, I'm not in business to supply ephemerides to the outside 
world; please realize that I cannot provide customized service to each 
individual user.

   Please include your name, address, phone number and e-mail address.
