home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume9 / ephem2 / part01 next >
Text File  |  1989-11-27  |  58KB  |  1,471 lines

  1. Newsgroups: comp.sources.misc
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Subject: v09i038: ephem, v4.8, 1 of 5
  4. Reply-To: ecd@umn-cs.cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
  5.  
  6. Posting-number: Volume 9, Issue 38
  7. Submitted-by: ecd@umn-cs.cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
  8. Archive-name: ephem2/part01
  9.  
  10. [Lousy shar.  Sigh.  ++bsa]
  11.  
  12. Please accept a new release of my interactive astronomical ephemeris, v4.8,
  13. for posting in comp.sources.misc. I am mailing it to you as five shar files,
  14. each under 64k bytes. thank you very much.
  15.  
  16. Elwood Downey
  17. umn-cs!ncs-med!ecd
  18.  
  19. -----------------------------------------------------------------------------
  20. # This is a "shell archive" file; run it with sh.
  21. # This is file 1.
  22. echo x Readme
  23. cat > Readme << 'xXx'
  24. 1) There is a generic-printer-ready manual in Man.
  25.  
  26. 2) for dos, here is a typical autoexec.bat
  27. set TZ=CDT5
  28. date
  29. time
  30.  
  31. 3) Note the change from ESC to 'q' from V4.6 of ephem.
  32.  
  33. If you have source:
  34.  
  35. 1) Change the define in io.c depending on whether you wish to compile under
  36. unix or dos turbo/lattice.
  37.  
  38. 2) Try changing the define in time.c if you get link undefines related to time
  39. functions.
  40.  
  41. 3) The following files are pretty much just pure transliterations from BASIC
  42. into C from machine-readable copies of the programs in Duffett-Smith's book.
  43. They have nothing to do with the rest of ephem so they may be used for
  44. completely different applications if so desired.
  45.     aa_hadec.c anomaly.c astro.h cal_mjd.c eq_ecl.c moon.c moonnf.c nutation.c
  46.     obliq.c parallax.c pelement.c plans.c precess.c refract.c riset.c
  47.     sex_dec.c sun.c utc_gst.c
  48.  
  49. 4) I didn't make a Makefile because to make ephem just compile everthing
  50. and link with -ltermcap and -lm, such as
  51.     cc -O -o ephem *.c -ltermcap -lm
  52. xXx
  53. echo x Man
  54. cat > Man << 'xXx'
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.                                      Ephem V4.8
  62.                                          by
  63.                                    Elwood Downey
  64.                                      Chaska, MN
  65.  
  66.                                  Table of Contents
  67.       1.  Introduction ...................................................  2
  68.       2.  Sample Screens .................................................  2
  69.       2.1.  Planet Data Screen ...........................................  2
  70.       2.2.  Rise/Set Info Screen .........................................  3
  71.       2.3.  Separation Screen ............................................  4
  72.       3.  Program Operation ..............................................  4
  73.       3.1.  Command Line Format ..........................................  4
  74.       4.  Screen Fields ..................................................  5
  75.       4.1.  Top Screen Fields ............................................  6
  76.       4.2.  Data format columns ..........................................  7
  77.       4.3.  RiseSet format columns .......................................  7
  78.       4.4.  Separation format fields .....................................  8
  79.       5.  Date and Time Formats ..........................................  8
  80.       6.  Configuration File .............................................  8
  81.       6.1.  Configuration file fields ....................................  9
  82.       6.2.  Example ephem.cfg ............................................  9
  83.       7.  Menu options ................................................... 10
  84.       7.1.  Adaptive vs. Standard hzn .................................... 10
  85.       7.2.  Geocentric vs. Topocentric ................................... 10
  86.       8.  Plotting ....................................................... 11
  87.       8.1.  Defining plot fields ......................................... 11
  88.       8.2.  Displaying a plot file ....................................... 12
  89.       8.3.  Cartesian or Polar coords .................................... 12
  90.       8.4.  Begin Plotting ............................................... 12
  91.       8.5.  Stopping Plotting ............................................ 12
  92.       9.  Watching ....................................................... 12
  93.       9.1.  Trails ....................................................... 12
  94.       9.2.  Night sky .................................................... 13
  95.       9.3.  Solar System ................................................. 13
  96.       10.  Searching ..................................................... 13
  97.       10.1.  Find extreme ................................................ 13
  98.       10.2.  Find 0 ...................................................... 14
  99.       10.3.  Binary ...................................................... 14
  100.       10.4.  Define a New function ....................................... 14
  101.       10.4.1.  Intrinsic functions ....................................... 14
  102.       10.4.2.  Field Specifiers .......................................... 14
  103.       10.4.3.  Constants ................................................. 15
  104.       10.4.4.  Operators ................................................. 15
  105.       10.5.  Specifying Search Accuracy .................................. 16
  106.       10.6.  Stop ........................................................ 16
  107.       10.7.  Example Searches ............................................ 16
  108.       10.8.  Another Example ............................................. 17
  109.       10.9.  Caution ..................................................... 17
  110.       11.  Implementation Notes .......................................... 17
  111.       11.1.  Program limits .............................................. 18
  112.       12.  DOS Installation Procedure .................................... 18
  113.       12.1.  Details ..................................................... 19
  114.       13.  Wish List ..................................................... 20
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.                                        - 2 -
  125.  
  126.  
  127.      1.  Introduction
  128.  
  129.      Ephem is a program that displays observing circumstances for all the
  130.      planets plus any one additional fixed object.
  131.  
  132.      Information displayed about each object includes RA and Dec precessed to
  133.      any epoch, heliocentric coordinates, local azimuth and altitude, distance
  134.      from sun and earth, solar elongation, angular size, visual magnitude,
  135.      phase, local rise, transit and set times, length of time up, and
  136.      topocentric or geocentric angular separations between all combinations of
  137.      objects.
  138.  
  139.      Observing circumstance information includes UTC and local date and time,
  140.      local sidereal time, times of astronomical twilight, length of day and
  141.      night, local temperature, pressure and height above sea level and a
  142.      monthly calendar.
  143.  
  144.      RA/Dec calculations are geocentric and include the effects of precession,
  145.      nutation and aberration.  Alt/az and rise/set/transit and, optionally,
  146.      angular separation calculations are topocentric and include effects of
  147.      refraction and parallax.
  148.  
  149.      A running plot file of selected field values may be generated as the
  150.      program runs.  Ephem includes a very crude quick-look capability to view
  151.      these plot files or they may be plotted by other programs.  One may also
  152.      watch the night sky or the solar system with a simple screen-oriented
  153.      display.
  154.  
  155.      Ephem may be asked to search for interesting conditions automatically,
  156.      using several algorithms. Most fields displayed on the screen may be used
  157.      as terms in an arbitrary arithmetic expression that can be solved for zero
  158.      or minimized or maximized, or the time of state change of any boolean
  159.      expression can be found.
  160.  
  161.      The program is written in C for unix or DOS. It uses only a very simple
  162.      set of io routines and should be easily ported to any ASCII display.  The
  163.      DOS version requires the ANSI.SYS screen driver.
  164.  
  165.      The planetary data and correction algorithms are taken, with permission,
  166.      from "Astronomy With Your Personal Computer", by Peter Duffett-Smith,
  167.      Cambridge University Press, 1985.
  168.  
  169.      2.  Sample Screens
  170.  
  171.      Here are typical ephem screens. They are generated using the sample
  172.      ephem.cfg file (listed in a later section).
  173.  
  174.      2.1.  Planet Data Screen
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.                                        - 3 -
  191.  
  192.  
  193.      Move to another field, RETURN to change this field, ? for help, or q to run
  194.  
  195.      CDT  8:10:20 10/31/1989 | LST    9:34:47 | Lat   44:50:37 |     October 1989
  196.      UTC 13:10:20 10/31/1989 |                | Long  93:42:08 | Su Mo Tu We Th Fr Sa
  197.      JulianDat 2447831.04884 | Dawn      6:13 | Elev    800 ft |  1  2  3  4  5  6  7
  198.                              | Dusk     19:43 | Temp      40 F |  8  9 10 11 12 13 FM
  199.      Watch                   | NiteLn   10:31 | AtmPr 29.50 in | 15 16 17 18 19 20 21
  200.      Search              off |                | TZ     5:00:00 | 22 23 24 25 26 27 28
  201.      Plot                off | NStep        1 | Epoch (OfDate) | NM 30 31
  202.      Menu        Planet Data | StpSz RT CLOCK |                |
  203.      --------------------------------------------------------------------------------
  204.      Ob R.A.    Dec    Az     Alt    Helio  Helio  Ea Dst Sn Dst Elong  Size VMag Phs
  205.         Hr:Mn.d Deg:Mn Deg E  Deg Up Long   Lat    AU(mi) AU     Deg E  ArcS      %
  206.      Su 14:22.9 -14:13 112:39   2:31  38:06   0:00 0.9927 0.0000    0.0 1933  -27
  207.      Mo 15:41.8 -24:46 106:59 -19:13               251296 0.9901   21.3 1773   -8  12
  208.      Me 13:59.4 -10:59 114:48   8:33 195:48   3:46 1.3809 0.4108   -6.6  4.9 -1.6  98
  209.      Ve 17:37.4 -26:43  89:49 -39:47  -8:53  -3:23 0.7287 0.7271   46.9 23.2 -5.1  53
  210.      Ma 13:43.1 -10:05 117:19  11:49 201:05   0:53 2.5823 1.6168  -10.6  3.6  1.6 100
  211.      Ju  6:47.2  22:46 251:12  49:26  90:57  -0:13 4.5980 5.1287 -117.2 42.8 -2.5  99
  212.      Sa 18:40.3 -22:44  72:49 -48:14 284:16   0:24 10.471 10.030   61.2 15.8  1.2 100
  213.      Ur 18:10.6 -23:41  80:20 -43:45 274:49  -0:17 19.931 19.369   54.3  3.3  5.7 100
  214.      Ne 18:43.5 -22:12  71:28 -48:24 281:43   0:53 30.666 30.212   62.0  2.0  8.0 100
  215.      Pl 15:06.9  -1:47  96:11   3:53 225:01  15:38 30.607 29.656   16.5  0.3 13.8 100
  216.      Or  6:00.0   0:00 242:37  24:51                             -124.5
  217.  
  218.  
  219.      2.2.  Rise/Set Info Screen
  220.  
  221.      This was done using the Adaptive option.
  222.  
  223.      Move to another field, RETURN to change this field, ? for help, or q to run
  224.  
  225.      CDT  8:10:20 10/31/1989 | LST    9:34:47 | Lat   44:50:37 |     October 1989
  226.      UTC 13:10:20 10/31/1989 |                | Long  93:42:08 | Su Mo Tu We Th Fr Sa
  227.      JulianDat 2447831.04884 | Dawn      6:13 | Elev    800 ft |  1  2  3  4  5  6  7
  228.                              | Dusk     19:43 | Temp      40 F |  8  9 10 11 12 13 FM
  229.      Watch                   | NiteLn   10:31 | AtmPr 29.50 in | 15 16 17 18 19 20 21
  230.      Search              off |                | TZ     5:00:00 | 22 23 24 25 26 27 28
  231.      Plot                off | NStep        1 | Epoch (OfDate) | NM 30 31
  232.      Menu      Rise/Set Info | StpSz RT CLOCK |                |
  233.      --------------------------------------------------------------------------------
  234.      Ob            Rise               Transit                Set            Hrs Up
  235.                Time     Az          Time     Alt         Time     Az
  236.      Su        7:51   109:07       12:58    30:55       18:06   250:41      10:15
  237.      Mo       10:09   126:04       14:30    18:57       18:46   232:37       8:37
  238.      Me        7:15   104:44       12:35    34:04       17:55   254:50      10:40
  239.      Ve       12:08   128:21       16:13    18:28       20:19   231:37       8:11
  240.      Ma        6:55   103:28       12:18    35:03       17:41   256:23      10:47
  241.      Ju       21:37    55:59        5:23    67:55       13:06   304:01      15:29
  242.      Sa       12:48   122:05       17:14    22:28       21:40   237:55       8:52
  243.      Ur       12:24   123:34       16:45    21:31       21:06   236:27       8:42
  244.      Ne       12:49   121:16       17:18    23:00       21:46   238:44       8:57
  245.      Pl        7:45    91:43       13:42    43:24       19:38   268:16      11:53
  246.      Or       22:29    89:13        4:36    45:10       10:40   270:47      12:11
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.                                        - 4 -
  257.  
  258.  
  259.      2.3.  Separation Screen
  260.  
  261.      This was done using the Geocentric option.
  262.  
  263.      Move to another field, RETURN to change this field, ? for help, or q to run
  264.  
  265.      CDT  8:10:20 10/31/1989 | LST    9:34:47 | Lat   44:50:37 |     October 1989
  266.      UTC 13:10:20 10/31/1989 |                | Long  93:42:08 | Su Mo Tu We Th Fr Sa
  267.      JulianDat 2447831.04884 | Dawn      6:13 | Elev    800 ft |  1  2  3  4  5  6  7
  268.                              | Dusk     19:43 | Temp      40 F |  8  9 10 11 12 13 FM
  269.      Watch                   | NiteLn   10:31 | AtmPr 29.50 in | 15 16 17 18 19 20 21
  270.      Search              off |                | TZ     5:00:00 | 22 23 24 25 26 27 28
  271.      Plot                off | NStep        1 | Epoch (OfDate) | NM 30 31
  272.      Menu        Separations | StpSz RT CLOCK |                |
  273.      --------------------------------------------------------------------------------
  274.      Ob   Sun   Moon   Merc   Venus  Mars    Jup  Saturn Uranus   Nep   Pluto
  275.  
  276.      Su         21:21   6:34  46:57  10:34 117:14  61:11  54:20  61:58  16:31
  277.      Mo  21:21         27:54  26:03  31:47 137:45  40:43  33:50  41:32  24:29
  278.      Me   6:34  27:54         53:30   4:07 110:45  67:40  60:50  68:25  19:07
  279.      Ve  46:57  26:03  53:30         57:31 163:41  14:49   8:06  15:41  43:52
  280.      Ma  10:34  31:47   4:07  57:31        106:40  71:45  64:54  72:31  22:25
  281.      Ju 117:14 137:45 110:45 163:41 106:40        178:25 171:33 178:58 122:40
  282.      Sa  61:11  40:43  67:40  14:49  71:45 178:25          6:53   0:55  55:47
  283.      Ur  54:20  33:50  60:50   8:06  64:54 171:33   6:53          7:42  49:32
  284.      Ne  61:58  41:32  68:25  15:41  72:31 178:58   0:55   7:42         56:22
  285.      Pl  16:31  24:29  19:07  43:52  22:25 122:40  55:47  49:32  56:22
  286.      Or 124:29 138:25 119:15 152:44 115:20  25:30 155:15 156:10 155:25 136:42
  287.  
  288.  
  289.      3.  Program Operation
  290.  
  291.  
  292.      3.1.  Command Line Format
  293.  
  294.      To run ephem, just type "ephem".  You may also optionally specify an
  295.      alternate configuration file, and optionally specify values for several
  296.      screen fields.  The command line syntax can be summarized as follows:
  297.  
  298.          ephem [-c <configfile>] [field=value] ...
  299.  
  300.      When ephem starts, it first displays a disclaimer banner.  Then, after any
  301.      key is pressed, it reads a configuration file to set the initial values of
  302.      several fields.  The default filename is ephem.cfg or .ephemrc in the HOME
  303.      environment variable directory if available.  The exact format of the file
  304.      is described below.  Then it processes any additional command line
  305.      arguments exactly as it would if they too came from the configuration
  306.      file.  It then draws all fields on the screen with their initial values.
  307.      The program then loops advancing time each step, by some amount you may
  308.      control, and updating all fields each loop.
  309.  
  310.      There are two fields that control this looping behavior: NStep and StpSz.
  311.      These control the number of steps and the amount of time to add each step,
  312.      respectively. When the number of steps, NStep, goes to 0 or any key is
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.                                        - 5 -
  323.  
  324.  
  325.      pressed, the looping stops and you enter a command mode.
  326.  
  327.      Command mode allows you to modify most of the fields.  The idea is that
  328.      you move to each field on the screen you wish to change and change it.
  329.      When you have changed everything you want to, type "q" to resume screen
  330.      updates.
  331.  
  332.      To change a field:
  333.  
  334.          1) move the cursor to the field (see below);
  335.          2) type RETURN;
  336.          3) type in the new value along the command line at the top according
  337.             to the format indicated in the prompt. To accept the new value
  338.             type RETURN, or to leave it unchanged after all type "q".
  339.  
  340.  
  341.      A few fields don't require you to type anything; just typing RETURN does
  342.      all the work.  If you can't move to it, you can't change it.
  343.  
  344.      The arrow keys on most systems move the cursor around.  If these do not
  345.      function or function incorrectly, the h/j/k/l keys also move the cursor
  346.      left/down/up/right, respectively.  You may also move the cursor
  347.      immediately to one of the planet rows by typing one of SMevmjsunp (to
  348.      avoid conflict with j, jupiter's row must actually be typed as control-j).
  349.  
  350.      When you have changed a field that would invalidate any of the other
  351.      fields the message NEW CIRCUMSTANCES appears in the top center of the
  352.      screen.  This will remain until you type "q" to allow at least one screen
  353.      update loop to occur.  If you change any field that causes new
  354.      circumstances, the StpSz value is not added to the first loop.  Note also
  355.      that after a series of loops, NStep is automatically reset to 1 so "q"
  356.      will do exactly one loop and return you to command mode.
  357.  
  358.      To quit the program, type control-d from command mode.  For a little more
  359.      help, type ?.  The entire screen may be erased and redrawn with control-l.
  360.  
  361.      4.  Screen Fields
  362.  
  363.      The screen is divided into two halves, top and bottom.  The top fields are
  364.      always present. They define the general observing circumstances and
  365.      control features.
  366.  
  367.      The planets and one additional object are displayed in a table in the
  368.      bottom portion of the screen.  There is one object per row, and several
  369.      columns.  There are three forms of this portion selected by picking the
  370.      Menu selection.
  371.  
  372.      Some things may be turned off to reduce compute times.  Calculations for
  373.      each planet may be turned on and off by selecting the planet name field.
  374.      Calculations for Dawn/Dusk/NiteLn may be turned off by selecting any of
  375.      these fields.  Planet positions are only updated as often as necessary to
  376.      match the display precision of the screen unless plotting or searching is
  377.      on, in which case full precision is required at all times and so positions
  378.      are always fully recalculated at each iteration.
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.                                        - 6 -
  389.  
  390.  
  391.      Follows is a list and description of each of the fields in each section.
  392.      Following each name, in parentheses, might be a "c" to mean the field may
  393.      be picked to be changed or a "p" to mean the field may be picked to be
  394.      included in a plot (see below).
  395.  
  396.  
  397.      4.1.  Top Screen Fields
  398.  
  399.      LT(c)         the local timezone name, time and date.  The name field may
  400.                    be changed to any three-character mnemonic.  Local time and
  401.                    date may be changed as described in a later section.  set to
  402.                    "N" to set from computer clock.
  403.      UTC(cp)       universally coordinated time and date. set to "N" to set
  404.                    from computer clock.
  405.      JulianDat(cp) the current Julian date, to about 1-second accuracy.
  406.      LST(cp)       the current local sidereal time.  set to "N" to set from
  407.                    computer clock.
  408.      TZ(cp)        hours local time is behind utc, ie, >0 west, <0 east of
  409.                    Greenwich.  set to "N" to set from computer clock.
  410.      Lat(cp)       location latitude, positive degrees north of equator.
  411.      Long(cp)      location longitude, positive degrees west of Greenwich
  412.                    meridian.
  413.      Temp(cp)      local surface air temperature, in degrees F.
  414.      AtmPr(cp)     local surface air pressure, in inches of mercury.
  415.      Epoch(c)      the precession epoch, to nearest 0.1 years.  This says
  416.                    (OfDate) when coordinates are not precessed, ie, are in the
  417.                    epoch of date.
  418.      NStep(c)      The number of times the display with be updated (time
  419.                    advanced by StpSz each step) before entering command mode.
  420.      StpSz(c)      the amount of time UTC (and its derivatives) is incremented
  421.                    each loop.  set this to RTC to use real-time based on the
  422.                    computer clock.  you may also set it in terms of days by
  423.                    appending a D (or d) after the number when you set it.
  424.      Elev(cp)      local elevation of the ground above sea level, in feet.
  425.      Dawn(cp)      local time when the sun is about 18 degrees below the
  426.                    horizon before sunrise
  427.      Dusk(cp)      local time when the sun is about 18 degrees below the
  428.                    horizon after sunset
  429.      NiteLn(cp)    length of astronomical night, ie, Dawn - Dusk.
  430.      Plot(c)       controls plotting; see complete discussion below.
  431.      Watch         selects the sky or solar system displays; see complete
  432.                    discussion below.
  433.      Menu          The three picks after this field select the format of the
  434.                    lower half of the screen.  See their complete discussion
  435.                    below.
  436.      Search        controls the automatic search feature of ephem. See the
  437.                    complete discussion below.
  438.      Also in the upper right of the screen is a calendar for the current local
  439.      month.  Dates of new and full moons are marked NM and FM, respectively.
  440.      One object may also be added to the display by putting its name and
  441.      location in the bottom row of the screen. This is done by moving the
  442.      cursor to the bottom row (the row beneath Pluto) and selecting the field
  443.      under the Ob, R.A., and Dec columns.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.                                        - 7 -
  455.  
  456.  
  457.      4.2.  Data format columns
  458.      Ob            name of object.
  459.      R.A.(p)       right ascension of object, precessed to given epoch, in
  460.                    Hours, minutes and decimal minutes.
  461.      Dec(p)        declination of object, precessed to given epoch, in degrees
  462.                    and minutes.
  463.      Az(p)         degrees eastward of true north for object.
  464.      Alt(p)        degrees up from a horizontal plane Elev feet above sea
  465.                    level.
  466.      Helio         heliocentric longitude. the earth's is displayed on the
  467.                    Sun's line.
  468.      Helio         heliocentric latitude.
  469.      Ea Dst(p)     distance from earth center to object center, in AU, except
  470.                    distance to moon is in miles.
  471.      Sn Dst(p)     distance from sun center to object center, in AU.
  472.      Elong(p)      spherical angular separation between sun and given object,
  473.                    calculated from the their geocentric ecliptic coordinates.
  474.                    Note this is not just difference in ecliptic longitude. The
  475.                    sign, however, is simply sign(obj's longitude - sun's
  476.                    longitude), ie, degrees east.  thus, a positive elongation
  477.                    means the object rises after the sun.
  478.      Size(p)       angular size of object, in arc seconds.
  479.      VMag(p)       visual magnitude of object.
  480.      Phs(p)        percent of visible surface in sunlight, ie, the phase. Note
  481.                    the moon phase is calculated simplistically as just
  482.                    abs(elongation)/180*100 which can be a few degrees off...
  483.                    this means that because of how elongation is defined it
  484.                    doesn't say 0 during new moon (or 100 during full) except
  485.                    during close eclipses (maybe that's a "feature"?).
  486.  
  487.      4.3.  RiseSet format columns
  488.      Rise        The local time and azimuth when the upper limb of the object
  489.                  rises.
  490.      Transit     The local time and altitude when the object crosses the
  491.                  meridian, ie, when its azimuth is true south or, if no
  492.                  precession, when the local sidereal time equals the object's
  493.                  right ascension.
  494.      Set         The local time and azimuth when the upper limb of the object
  495.                  sets.
  496.      Hrs Up      The number of hours the object is up on the local date.
  497.  
  498.      Horizon displacement may be calculated in either of two ways; see the
  499.      horizon discussion in the Menu selection section.
  500.  
  501.      Various oddball conditions are accounted for, such as an object that is up
  502.      sometime during the day but that doesn't rise, transit or set as such on
  503.      that day, an object that is circumpolar or that is never up or one that
  504.      rises twice on the same day.  These are marked as "Never rises", "Never
  505.      transits", "Never sets", "Circumpolar", "Never up" or appended with a plus
  506.      "+" sign, respectively.
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.                                        - 8 -
  521.  
  522.  
  523.      4.4.  Separation format fields
  524.      This format is a table of angular separations between each pair of
  525.      objects.  These angles are based on the local altitude/azimuth, and so in
  526.      general differ somewhat from the elongations reported for the sun in the
  527.      Data menu.
  528.  
  529.      5.  Date and Time Formats
  530.      Times are displayed and entered in h:m:s format.  If you pick a time field
  531.      to change it any of the h, m, and s components that are not specified are
  532.      left unchanged from their current value.  For example, 0:5:0 set hours to
  533.      0, minutes to 5, seconds to 0, whereas :5 sets minutes to 5 but leaves
  534.      hours and seconds unchanged.  A negative time is indicated by a minus sign
  535.      (-) anywhere before the first digit.
  536.  
  537.      Dates are displayed and entered in American m:d:y format.  As with time,
  538.      components omitted when entering a new value remain the current value.
  539.      For example, if the current date is 10/20/1988 and you type 20/20 the new
  540.      date will become 20/20/1988. Note you must type the full year since the
  541.      program is accurate over several centuries either side of 1900.
  542.  
  543.      As a matter of typing convenience, the program accepts any character other
  544.      than a digit or minus as the separator; you don't have to type a perfect
  545.      ":" or "/".
  546.  
  547.      6.  Configuration File
  548.      The ephem.cfg configuration file allows you to set the initial values of
  549.      many of the screen fields. You can still change any field while the
  550.      program is running too; this file just sets the initial conditions.  Note
  551.      that the order of entries in this file is important.  They each take
  552.      effect immediately and so you should put them in the same order you wish
  553.      them to be processed, just as though you were changing the fields
  554.      interactively within ephem.
  555.  
  556.      You can have several different configuration files if you wish. By
  557.      default, ephem looks for one named ephem.cfg. You can tell it to use an
  558.      alternate file by using the -c switch as follows:
  559.  
  560.          ephem -c <filespec>
  561.  
  562.  
  563.      If your system supports the HOME environment variable then ephem also
  564.      looks for a configuration file there with the name
  565.  
  566.      The format of the file uses the form KEYWORD=VALUE, where the possible
  567.      KEYWORDS and the types of VALUES for each are described below. Any
  568.      KEYWORDS not in the file will take on some sort of default. The separator
  569.      need not be an actual equals sign; any char will do because the VALUE is
  570.      assumed to start one character after the KEYWORD, regardless.
  571.  
  572.      Note:  because of the way unspecified time and date components are left
  573.      unchanged (see section on Date and Time Formats) always specify the
  574.      complete time and date for all entries in the configuration file. For
  575.      example, to initialize the longitude to zero degrees, say 0:0:0, not just
  576.      0.
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.                                        - 9 -
  587.  
  588.  
  589.      6.1.  Configuration file fields
  590.      UD        initial UTC date, such as 10/20/1988, or "NOW" to use the
  591.                computer clock.
  592.      TZONE     hours the local time is behind utc, such as 5:0:0.  you need not
  593.                set this if you use "NOW" for UT or UD.
  594.      TZNAME    name of the local time zone, such as CDT. 3 chars max.  you need
  595.                not set this if you use "NOW" for UT or UD.
  596.      LONG      longitude, in degrees west of greenwich, in the form d:m:s.
  597.      LAT       latitude, in degrees north of the equator, in the form d:m:s.
  598.      HEIGHT    height above sea level, in feet, such as 800
  599.      TEMP      air temperature, in degrees F, such as 50
  600.      PRES      air pressure, in inches of Mercury, such as 29
  601.      STPSZ     the time increment between screen updates, such as "1" to give
  602.                one hour updates. this can be a specific amount or RTC to use
  603.                the system clock as a real-time source. You may also specify a
  604.                time in days, by appending a D (or d) after the number.
  605.      PROPTS    this selects what you want included initially in the display.
  606.                since IBM-PC math is not very fast, you can reduce the time to
  607.                update the screen by only printing those fields of interest. the
  608.                VALUE is a collection of letters to turn on each item from the
  609.                following set:
  610.  
  611.                        T       twilight (dawn-dusk)
  612.                        S       circumstances for the sun
  613.                        M       circumstances for the moon
  614.                        e       circumstances for mercury
  615.                        v       circumstances for venus
  616.                        m       circumstances for mars
  617.                        j       circumstances for jupiter
  618.                        s       circumstances for saturn
  619.                        u       circumstances for uranus
  620.                        n       circumstances for neptune
  621.                        p       circumstances for pluto
  622.  
  623.                For example, to just track the sun and saturn, say PROPTS Ss
  624.      NSTEP     number of times program will loop before entering command mode.
  625.                see the discussion under Program Operation.
  626.      EPOCH     this sets the desired ra/dec precession epoch. you can put any
  627.                date here or EOD to use the current instant ("Epoch of Date").
  628.      OBJN      name of the extra object to track.
  629.      OBJRA     right ascension of the extra object to track.
  630.      OBJDEC    declination of the extra object to track.
  631.  
  632.      6.2.  Example ephem.cfg
  633.  
  634.      This is the ephem.cfg file that was in effect when the sample screens (in
  635.      an earlier section) were generated. You might run ephem with this
  636.      configuration file and compare with the samples as a check.
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.                                        - 10 -
  653.  
  654.  
  655.      TZONE 5
  656.      TZNAME CDT
  657.      UT 13:10:20
  658.      UD 10/31/1989
  659.      LONG 93:42:8
  660.      LAT 44:50:37
  661.      HEIGHT 800
  662.      TEMP 40
  663.      PRES 29.5
  664.      STPSZ RTC
  665.      PROPTS TSMevmjsunp
  666.      EPOCH EOD
  667.      NSTEP 1
  668.      OBJN Or
  669.      OBJRA 6:0:0
  670.      OBJDEC 0:0:0
  671.  
  672.      As another common example, this ephem.cfg creates an essentially free-
  673.      running real-time screen based on the computer clock:
  674.  
  675.  
  676.      UT NOW
  677.      LONG 90:10:8
  678.      LAT 40:50:20
  679.      HEIGHT 800
  680.      TEMP 50
  681.      PRES 29
  682.      STPSZ RTC
  683.      PROPTS TSMevmjsunp
  684.      NSTEP 9999999
  685.      EPOCH EOD
  686.  
  687.  
  688.      7.  Menu options
  689.  
  690.      When you select "Menu" you can change among the three styles of bottom
  691.      screens. There are also two options that can be set from the Menu quick-
  692.      choice menu. These options toggle when picked and retain their values so
  693.      they need only be changed when desired.
  694.  
  695.      7.1.  Adaptive vs. Standard hzn
  696.  
  697.      This selects the horizon refraction displacement algorithm used by the
  698.      Rise/Set menu.  "Adaptive" uses the local conditions known to ephem and
  699.      matches the Planet Info times very nicely. "Standard" uses the "accepted
  700.      nominal" refraction value of 32 arc minutes, and agrees to a minute or two
  701.      with published tables.
  702.  
  703.      7.2.  Geocentric vs. Topocentric
  704.  
  705.      This selects the vantage point for the Separation menu. "Geocentric"
  706.      ignores local conditions and gives the separation as seen from Earth
  707.      center. "Topocentric" uses the local conditions known to ephem.  They are
  708.      particularly critical for lunar occultations, but the effect can be
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.                                        - 11 -
  719.  
  720.  
  721.      significant for the planets.
  722.  
  723.      Note that searching over a period that will include the rise or set times
  724.      of either object is generally better performed from the geocentric
  725.      viewpoint.  The refraction effect of the topocentric viewpoint causes many
  726.      arcminutes of rapid whiplash displacement as the objects rise and set that
  727.      overlays the smooth celestial motion of the objects.  This rapid position
  728.      variation can confuse the solver algorithms that expect fairly smooth
  729.      functions.
  730.  
  731.      8.  Plotting
  732.  
  733.      Each time a field is drawn on the screen its full-precision value may be
  734.      written to a file.  This implies you may not plot a field from other than
  735.      the current menu at the time plotting is on.
  736.  
  737.      Each line in the file consists of a tag character followed by two or three
  738.      floating point variables, all separated by commas. If there are two
  739.      values, they should be interpreted to be x and y (or perhaps r and theta).
  740.      If there is a third, it is a z or trace value.
  741.  
  742.      For efficiency on systems that can compute a screenfull faster than they
  743.      can display it, screen updates are suppressed while plotting is on and
  744.      NStep is greater than 1. This can greatly reduce the time to generate a
  745.      long plot file. Fields are still logged for plotting; they just are not
  746.      drawn on the screen.
  747.  
  748.      The Plot field controls plotting.  Whether plotting is currently active is
  749.      indicated by "on" or "off" immediately to its right.
  750.  
  751.      Picking "Plot" brings up a quick-choice menu, as follows:
  752.  
  753.      Select: Select fields, Display a plot file, Cartesian coords, Begin plotting
  754.  
  755.  
  756.      8.1.  Defining plot fields
  757.  
  758.      Select the "Select fields" option.  You will be asked to move the cursor
  759.      to the field you want to use as the x coordinate (abscissa), then asked to
  760.      choose the y coordinate (ordinate), then asked to choose an optional z
  761.      trace variable and finally a tag character.  (X and Y may be for other
  762.      coordinate systems too but ephem's quicky plotter can only plot in
  763.      Cartesian coordinates.) If you type q for either x or y then no more
  764.      fields will be defined.  If you type q for the z field there will be no z
  765.      field.  You can not label a plot line with the letter "q" at this time.
  766.  
  767.      This then repeats so you may choose up to ten of these sets for any given
  768.      plot run.  Each set defines what will become a line on the final plot.
  769.      Note that you may select the "Search" field to indicate use of the current
  770.      search function; that function must be defined by the time plotting is
  771.      turned on.
  772.  
  773.      If you turn plotting off and back on the fields selected for plotting are
  774.      reactivated the same as they were last time. You may change them if
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.                                        - 12 -
  785.  
  786.  
  787.      desired, of course, but there is no need to redefine them if you do not
  788.      wish to change them.
  789.  
  790.      8.2.  Displaying a plot file
  791.  
  792.      Select the "Display a plot file" option to make a crude plot of an
  793.      existing plot file previously created by ephem.  The entries in the file
  794.      will be drawn on the screen using their tag characters; the plot remains
  795.      on the screen until you type any character.
  796.  
  797.      The plot may be made in polar or Cartesian coordinates, depending on the
  798.      setting of the plotting mode in the quick-choice (see next section).
  799.  
  800.      8.3.  Cartesian or Polar coords
  801.  
  802.      This toggles the plotting mode coordinate system.  The mode remains until
  803.      changed.  Polar coordinates assume the first numeric field in the plot
  804.      file is the radius, and the second is the angle counterclockwise from
  805.      right, in degrees.
  806.  
  807.      8.4.  Begin Plotting
  808.  
  809.      If there are defined plot field lines then the third option, "Begin
  810.      plotting" will be available.  You will be asked for the name of the file
  811.      to use and, if it already exists, whether to overwrite it or append to it.
  812.      Once you have chosen a file, plotting is on and the top menu plotting
  813.      status field changes to "on".  The default plot filename is ephem.plt.
  814.      The values are written to the plot file each time they are updated on the
  815.      screen until you select "Plot" again and select the "Stop" option to turn
  816.      plotting back off.
  817.  
  818.      8.5.  Stopping Plotting
  819.  
  820.      If plotting is on, then selecting the Plot field in the top section will
  821.      turn plotting off. You may pick Plot again and resume with the same fields
  822.      by selecting "Begin plotting" again.
  823.  
  824.      Note that due to internal buffering the plot file will not be completely
  825.      written to disk until plotting is turned off.
  826.  
  827.      9.  Watching
  828.  
  829.      You may make a simple drawing on the screen of the night sky or the solar
  830.      system by selecting "Watch".  It will bring up a quick-choice menu as
  831.      follows:
  832.  
  833.      Select: Night sky, Solar system, No trails
  834.  
  835.  
  836.      9.1.  Trails
  837.  
  838.      You may either erase after each iteration or leave the tags up, referred
  839.      to as "trails". Picking the right-most choice will toggle between "No
  840.      trails" and "Leave trails"; set it accordingly before you select the style
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.                                        - 13 -
  851.  
  852.  
  853.      of sky plot you wish. Ephem will remember your selection.
  854.  
  855.      9.2.  Night sky
  856.  
  857.      This selection draws the currently active planets as they would appear in
  858.      the sky at the current time and date.  The coordinate system is such that
  859.      0 degrees azimuth (north) through 360 degrees (north, once around) is
  860.      mapped to the horizontal screen dimension, and 0 degrees altitude (level)
  861.      through 90 degrees (the zenith) is mapped to the vertical dimension. Thus,
  862.      the bottom row is the horizon and all across the top is the zenith.
  863.  
  864.      9.3.  Solar System
  865.  
  866.      This selection draws the currently active planets as they would appear
  867.      looking "down from the top" of the sun.
  868.  
  869.      In either style of display, pressing RETURN advances the time by whatever
  870.      amount StpSz is set to.  Pressing h advances it by one hour and d advances
  871.      it by one day.  Pressing "q" returns to the tabular main screen. Pressing
  872.      any other key starts an automatic loop with each step advancing by StpSz;
  873.      pressing any key stops the looping.
  874.  
  875.      10.  Searching
  876.  
  877.      Ephem can search for arbitrary conditions to exist among most displayed
  878.      fields.  You first enter a function, then select from among three forms of
  879.      equation solvers to iteratively solve for the next time when the function
  880.      meets the requirements of the solver. The solver selects the next time for
  881.      which it wants the function evaluated and sets StpSz so that the next
  882.      iteration will occur at that time. The solvers continue to iterate until
  883.      either they achieve their goal or NStep reaches 0.
  884.  
  885.      You may set NStep quite large and let ephem search unattended or set it to
  886.      1 and watch it converge one step at a time. You may also plot at the same
  887.      time as search to record the exact steps ephem took to converge.  (But
  888.      recall that screen updates are suppressed if plotting is also on).
  889.  
  890.      The "Search" selection in the top half of the screen controls all
  891.      searching.  Picking it brings up a quick-choice menu as follows:
  892.  
  893.      Select: Find extreme, Find 0, Binary, New function, Accuracy
  894.  
  895.  
  896.      10.1.  Find extreme
  897.  
  898.      This search algorithm searches for a local maximum or a minimum in the
  899.      search function, whichever it finds first. It begins by evaluating the
  900.      search function at the current time then for two more times each separated
  901.      by StpSz. It then fits these three points to a parabola and solves it for
  902.      the time of its maximum (or minimum). StpSz is set so that the next
  903.      iteration will evaluate at this point.  This parabolic fit solution keeps
  904.      repeating until StpSz changes by less than the desired accuracy or until
  905.      the curve becomes so flat that an extrema appears too broad to find.
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.                                        - 14 -
  917.  
  918.  
  919.      10.2.  Find 0
  920.  
  921.      This search algorithm uses the secant method to solve for the time at
  922.      which the search function is zero. The function is evaluated at the
  923.      current time and then again StpSz later to establish a slope for which the
  924.      x-intercept is found as the next zero guess. This is used to set StpSz for
  925.      the next desired time value and the slope hunting process repeats until
  926.      StpSz changes by less than the desired accuracy.
  927.  
  928.      10.3.  Binary
  929.  
  930.      This search algorithm must be used with a search function that yields a
  931.      boolean result, ie, a true or false value. The idea is that the function
  932.      is assumed to be one truth value when evaluated at the present time, and
  933.      the opposite truth value when it is evaluated StpSz later. The algorithm
  934.      will then do a binary search for the time at which the truth value
  935.      changes.
  936.  
  937.      The binary algorithm does not begin until the state change is bounded in
  938.      time.  Initially, as long as the truth value at StpSz is the same as the
  939.      previous value the algorithm will just keep moving in time by StpSz
  940.      looking for when the state changes.  That is, a linear search is initiated
  941.      to bound the state change, then the binary search proceeds.
  942.  
  943.      10.4.  Define a New function
  944.  
  945.      Select "New function" to display the current search function.  If you type
  946.      "q" it will be left unchanged.  If you type RETURN it will be erased.  If
  947.      you type anything else it will be compiled and, if there are no errors, it
  948.      will become the new search function.  Once a valid function has been
  949.      stored, it will remain unless changed.  If a search function is selected
  950.      and there is as yet no valid search function defined, you will
  951.      automatically be asked to enter one as though you had selected "New
  952.      function."
  953.  
  954.      A search function consists of intrinsic functions, field-specifiers,
  955.      constants and operators, and precedence may be overridden with
  956.      parentheses.
  957.  
  958.  
  959.      10.4.1.  Intrinsic functions
  960.  
  961.      In this release, the only intrinsic function available is abs(), which
  962.      returns the absolute value of its argument.
  963.  
  964.      10.4.2.  Field Specifiers
  965.  
  966.      A field in the bottom half of the menu is specified in the form of
  967.      "object_name.column_name". The object_name is enough of the planet name to
  968.      be unique, or the exact name of the optional object. The column_name is
  969.      from the following table, depending on which menu is up. In all cases
  970.      additional characters may be entered but are ignored.
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.                                        - 15 -
  983.  
  984.  
  985.      Planet Data Menu        Rise/Set Menu               Separation Menu
  986.      ------------------      --------------------        ---------------
  987.      al      Alt             hr      Hrs Up, or          j       Jup
  988.      az      Az              hu      Hrs Up              ma      Mars
  989.      d       Dec             raz     Rise Az             me      Merc
  990.      ed      Ea Dst          rt      Rise Time           mo      Moon
  991.      el      Elong           saz     Set Az              n       Nep
  992.      hla     Helio Lat       st      Set Time            pl      Pluto
  993.      hlo     Helio Long      ta      Transit Alt         sa      Saturn
  994.      ph      Phs             tt      Transit Time        su      Sun
  995.      ra      R.A.                                        u       Uranus
  996.      sd      Sn Dst                                      ve      Venus
  997.      si      Size
  998.      vm      VMag
  999.  
  1000.  
  1001.      In addition, the following top-half fields may be used:
  1002.  
  1003.      da      Dawn
  1004.      du      Dusk
  1005.      n       NiteLn
  1006.  
  1007.  
  1008.      Note that while you may include any field in a search function, it will
  1009.      only be calculated if it is actually being displayed.  This implies it is
  1010.      useless to define a search that uses fields from other than the one menu,
  1011.      namely, the current menu at the time the search is running.
  1012.  
  1013.      10.4.3.  Constants
  1014.  
  1015.      Constants may be integers or floating point numbers. The latter may be
  1016.      expressed in scientific notation if desired. Examples include 100, .9,
  1017.      1.234, 1e10 and 1.2e-4.  Any number may be preceded by - to make it
  1018.      negative.
  1019.  
  1020.      10.4.4.  Operators
  1021.  
  1022.      The collection of arithmetic, relational and boolean operators provided
  1023.      mimics those of C language as listed in the following table, in decreasing
  1024.      order of precedence.  Operators grouped together have the same precedence
  1025.      and all have left-to-right associativity. Parentheses may be used as
  1026.      desired.
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                                        - 16 -
  1049.  
  1050.  
  1051.      Symbol  Meaning                 Resulting type
  1052.      ------  --------------------    --------------
  1053.      *       multiply                arithmetic
  1054.      /       divide                  arithmetic
  1055.  
  1056.      +       add                     arithmetic
  1057.      -       subtract                arithmetic
  1058.  
  1059.      >       greater than            boolean
  1060.      >=      greater than or equal   boolean
  1061.      <       less than               boolean
  1062.      <=      less than or equal      boolean
  1063.  
  1064.      ==      equality                boolean
  1065.      !=      inequality              boolean
  1066.  
  1067.      &&      logical and             boolean
  1068.  
  1069.      ||      logical or              boolean
  1070.  
  1071.  
  1072.      10.5.  Specifying Search Accuracy
  1073.  
  1074.      Selecting "Accuracy" allows you to specify when the search will stop.  The
  1075.      search algorithms will stop when StpSz becomes equal to or less than this
  1076.      value. The default is one minute.  If ephem has not yet converged to the
  1077.      specified accuracy but NStep has decremented to 1, the searching will stop
  1078.      but the search status field will still indicate which search procedure is
  1079.      in effect. To try more iterations you may increase NStep and resume
  1080.      searching. If the accuracy was achieved, the search status field will
  1081.      switch to "off" with the number of "unused" steps remaining in NStep and
  1082.      the last step size in the StpSz fields.
  1083.  
  1084.      10.6.  Stop
  1085.  
  1086.      If searching is on, this option will also appear on the quick-choice menu
  1087.      and may be selected to turn off the search.
  1088.  
  1089.      10.7.  Example Searches
  1090.  
  1091.      As an example, let's find when Pluto again becomes the furthest planet
  1092.      from Sol.  You may find when the difference in their sun distance is zero,
  1093.      or you might use a binary search on the condition that Pluto's sun
  1094.      distance is larger then Neptune's.
  1095.  
  1096.      To try the former approach select Search, select "Find 0", specify the
  1097.      search function to be:
  1098.  
  1099.      pl.sd - nep.sd
  1100.  
  1101.      set StpSz to something large like 10d, NStep to allow several iterations
  1102.      like 20, and then type "q" to start the search and watch ephem do the
  1103.      hunt.  Ephem will settle on about 21:02 1/10/1999 UT.
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.                                        - 17 -
  1115.  
  1116.  
  1117.      To try a binary search, you first need to have some idea of when the event
  1118.      will occur so you can eliminate the initial linear search for the state
  1119.      change. We can start at, say, 1/1/1999, set StpSz to 30d, select Binary
  1120.      search, specify the search function to be:
  1121.  
  1122.      pl.sd > nep.sd
  1123.  
  1124.      and go. Once it brackets the state change note how StpSz keeps being cut
  1125.      in half but can go in either direction (sign) as it divides each interval
  1126.      in half.  Ephem will converge on the same answer.
  1127.  
  1128.      10.8.  Another Example
  1129.  
  1130.      To find the time of last quarter moon during December, 1989, use the "Find
  1131.      0" search algorithm to solve "moon.el + 90".  (At last quarter, the moon
  1132.      is 90 degrees west of the sun, or -90 east in ephem's elongation display.)
  1133.      Set the initial time to mid-month, 12/15/1989, StpSz to 1 day and NSteps
  1134.      to 10. Ephem takes only a few iterations to settle on 23:57 12/19 UT.
  1135.  
  1136.      10.9.  Caution
  1137.  
  1138.      Beware that most celestial phenomena are generally pseudo-periodic in
  1139.      nature.  In early search steps ephem can easily skip over a local maxima
  1140.      and find a later one, which, while correct, may not be what was desired.
  1141.      In general, the closer you can be when you start the search the better
  1142.      ephem can refine it; it is not as good with very broad searches that can
  1143.      go "wild". Set StpSz large enough to offer significant change in the
  1144.      function value, but small enough not to skip too far.
  1145.  
  1146.      For example, Saturn and Neptune had three close approaches during 1989.
  1147.      If you did not know this then just asking ephem to find a minimum would
  1148.      have produced different results depending on the starting conditions.
  1149.      When starting a search for a certain class of event it is a good idea to
  1150.      first use the plotting or watching facility of ephem to get a broad
  1151.      picture of the general circumstances then use ephem's search facility to
  1152.      refine a given region (or create and inspect a plot file and do your own
  1153.      interpolation directly from it separately).
  1154.  
  1155.      Similarly, ephem's searching techniques are not good for eclipses because
  1156.      the moon and sun are close every month; the trick is sorting through the
  1157.      frequent conjunctions for ones that are particularly close. One needs a
  1158.      way of establishing an envelope fit to the local extrema of a cyclic
  1159.      function in order to find a more global extreme.
  1160.  
  1161.      11.  Implementation Notes
  1162.  
  1163.      Remember that everything is for the current local time. So, for example,
  1164.      the calendar marks moon events in local time; commercial calendars usually
  1165.      mark the UT date.  Similarly, the rise/set times are for the current local
  1166.      day.
  1167.  
  1168.      The program uses a horizontal plane tangent to the earth as the horizon
  1169.      for all altitude calculations, rise/set events, etc.  This is not the same
  1170.      as the angle up from the local horizon unless the observer is directly on
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.                                        - 18 -
  1181.  
  1182.  
  1183.      the ground due to earth's curvature.  The effect can be found from:
  1184.  
  1185.              sin(a)**2 = (h**2 + 2Rh) / (R+h)**2
  1186.          where:
  1187.              R = radius of earth
  1188.              h = height above ground (same units as R)
  1189.              a = increase in altitude
  1190.  
  1191.      For example, the effect is more than two arc minutes at a height of 5
  1192.      feet.
  1193.  
  1194.      Visual magnitudes are not very accurate at all... I haven't bother to fix.
  1195.  
  1196.      The accuracy of ephem can not be specifically stated since the Duffett-
  1197.      Smith book does not warrant its planet position polynomials to any given
  1198.      degree. I know for sure that better accuracy could be achieved if ephem
  1199.      used ET but I have not yet decided on a suitable UT-ET algorithm.
  1200.  
  1201.      The program uses double precision throughout. While this precision might
  1202.      seem a little ridiculous, it is actually more efficient for most
  1203.      traditional K&R C compilers, the search functions are far more stable, it
  1204.      improves small angles (conjunctions) calculated using acos(), etc.
  1205.  
  1206.      Searching and plotting always use full precision but if neither of these
  1207.      are turned on pure display and watching only recompute a given planets new
  1208.      location if the time has changed enough to effect the required display
  1209.      precision, based on the planets mean apparent orbital motion.
  1210.  
  1211.      A "negative 0" is displayed when a value is negative but less than half
  1212.      the display precision.
  1213.  
  1214.      The sun-moon distance is the solution for the third side of a planar
  1215.      triangle whose two other sides are the earth-moon distance and earth-sun
  1216.      distance separated by the angle of elongation.
  1217.  
  1218.      11.1.  Program limits
  1219.  
  1220.      The search function is limited to a maximum of 32 instructions (each
  1221.      constant, field spec, and operation is one instruction), with no more than
  1222.      a total of 16 constants and fields specs. At run time, the function can
  1223.      not require more than 16 stacked values (due to operator precedence or
  1224.      explicit parenthetical expressions) to evaluate.
  1225.  
  1226.      No more than 32 fields can be tracked simultaneously for plotting and/or
  1227.      searching.
  1228.  
  1229.      No more than 10 lines may be plotted at once.
  1230.  
  1231.      The maximum file name length is 14 characters.
  1232.  
  1233.      12.  DOS Installation Procedure
  1234.  
  1235.      Summary:
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.                                        - 19 -
  1247.  
  1248.  
  1249.      You must be running DOS V2.0 or later, though somewhere between V2.0 and
  1250.      V3.21 the behavior of control-c to terminate the program was fixed.  A
  1251.      8087 floating point chip will be used if present.
  1252.  
  1253.      The distribution floppy contains two files, ephem.exe and ephem.cfg.
  1254.      Ephem.exe is the executable program; ephem.cfg is a sample configuration
  1255.      file. To run the program, make working copies of these two files in a
  1256.      directory and run "ephem" from that directory. The program uses the
  1257.      ANSI.SYS terminal driver for screen control. It also uses an environment
  1258.      variable, TZ, to establish the local timezone.
  1259.  
  1260.      12.1.  Details
  1261.  
  1262.  
  1263.      1) The ANSI.SYS screen driver is required for this program. Edit the
  1264.         CONFIG.SYS file, if necessary, so it contains the following line:
  1265.               device=ANSI.SYS
  1266.  
  1267.         If it wasn't already there and you had to add it, note it will not
  1268.         take effect until you reboot DOS.
  1269.  
  1270.  
  1271.  
  1272.      2) Set a DOS environment variable, TZ, in the following form:
  1273.               set TZ=SSSnDDD
  1274.  
  1275.         "SSS" is the 3-letter abbreviation for the local standard timezone;
  1276.         "n"   is a number between -23 to 24 indicating the number of hours
  1277.               that are subtracted from GMT to obtain local standard time;
  1278.         "DDD" is an optional 3-letter abbreviation for the local daylight
  1279.               savings time zone name. Leave it off if you do not have savings
  1280.               time in your area or it is not currently in effect. If the
  1281.               changeover dates differ from the internal algorithm, just use
  1282.               SSS and n directly.
  1283.  
  1284.  
  1285.          For example, in the midwestern United States with savings times:
  1286.               set TZ=CST6CDT
  1287.  
  1288.          If for some reason your system does not change to savings time at the
  1289.          right time, then omit the DDD parameter and just set the SSS and n
  1290.          to exactly what you want.
  1291.  
  1292.          You can put this in your AUTOEXEC.BAT file so it gets set each time
  1293.          you boot DOS.
  1294.  
  1295.          This environment variable is used to establish the timezone name and
  1296.          hours offset whenever the "NOW" shorthand is used from ephem, either
  1297.          from the configuration startup file or whenever any time field is
  1298.          changed manually.
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.                                        - 20 -
  1313.  
  1314.  
  1315.      3) place the distribution floppy into drive a:.
  1316.  
  1317.      4) copy the ephem.* files to a working diskette:
  1318.              copy ephem.* b:*.*/v
  1319.      or hard disk:
  1320.              copy ephem.* c:*.*/v
  1321.  
  1322.      5) run using the sample configuration file by just running
  1323.              ephem
  1324.  
  1325.      To run with a different configuration file, use the -c switch:
  1326.              ephem -c <filespec>
  1327.  
  1328.  
  1329.      13.  Wish List
  1330.  
  1331.      allow specifying the extra object with orbital elements so it could be
  1332.      used for earth satellites, comets, etc.
  1333.  
  1334.      incorporate ephemeris time, not just UT.
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375. xXx
  1376. echo x astro.h
  1377. cat > astro.h << 'xXx'
  1378. #ifndef PI
  1379. #define    PI        3.141592653589793
  1380. #endif
  1381.  
  1382. /* conversions among hours (of ra), degrees and radians. */
  1383. #define    degrad(x)    ((x)*PI/180.)
  1384. #define    raddeg(x)    ((x)*180./PI)
  1385. #define    hrdeg(x)    ((x)*15.)
  1386. #define    deghr(x)    ((x)/15.)
  1387. #define    hrrad(x)    degrad(hrdeg(x))
  1388. #define    radhr(x)    deghr(raddeg(x))
  1389.  
  1390. /* ratio of from synodic (solar) to sidereal (stellar) rate */
  1391. #define    SIDRATE        .9972695677
  1392.  
  1393. /* manifest names for planets.
  1394.  * N.B. must cooincide with usage in pelement.c and plans.c.
  1395.  */
  1396. #define    MERCURY    0
  1397. #define    VENUS    1
  1398. #define    MARS    2
  1399. #define    JUPITER    3
  1400. #define    SATURN    4
  1401. #define    URANUS    5
  1402. #define    NEPTUNE    6
  1403. #define    PLUTO    7
  1404. xXx
  1405. echo x circum.h
  1406. cat > circum.h << 'xXx'
  1407. #define    SPD    (24.0*3600.0)    /* seconds per day */
  1408.  
  1409. #define    EOD    (-9876)        /* special epoch flag: use epoch of date */
  1410. #define    RTC    (-1234)        /* special tminc flag: use rt clock */
  1411.  
  1412. #define    STDHZN        0    /* rise/set times based on nominal conditions */
  1413. #define    ADPHZN        1    /* rise/set times based on exact current " */
  1414. #define    TWILIGHT    2    /* rise/set times for sun 18 degs below hor */
  1415.  
  1416. /* info about our local observing circumstances */
  1417. typedef struct {
  1418.     double n_mjd;    /* modified Julian date, ie, days since
  1419.              * Jan 0.5 1900 (== 12 noon, Dec 30, 1899), utc.
  1420.              * enough precision to get well better than 1 second.
  1421.              */
  1422.     double n_lat;    /* latitude, >0 north, rads */
  1423.     double n_lng;    /* longitude, >0 east, rads */
  1424.     double n_tz;    /* time zone, hrs behind UTC */
  1425.     double n_temp;    /* atmospheric temp, degrees C */
  1426.     double n_pressure; /* atmospheric pressure, mBar */
  1427.     double n_height;    /* height above sea level, earth radii */
  1428.     double n_epoch;    /* desired precession display epoch as an mjd, or EOD */
  1429.     char n_tznm[4];    /* time zone name; 3 chars or less, always 0 at end */
  1430. } Now;
  1431. extern double    mjd_day(), mjd_hr();
  1432.  
  1433. /* info about where and how we see something in the sky */
  1434. typedef struct {
  1435.     double s_ra;    /* ra, rads (precessed to n_epoch) */
  1436.     double s_dec;    /* dec, rads (precessed to n_epoch) */
  1437.     double s_az;    /* azimuth, >0 e of n, rads */
  1438.     double s_alt;    /* altitude above topocentric horizon, rads */
  1439.     double s_sdist;    /* dist from object to sun, au */
  1440.     double s_edist;    /* dist from object to earth, au */
  1441.     double s_elong;    /* angular sep between object and sun, >0 if east */
  1442.     double s_hlong;    /* heliocentric longitude, rads */
  1443.     double s_hlat;    /* heliocentric latitude, rads */
  1444.     double s_size;    /* angular size, arc secs */
  1445.     double s_phase;    /* phase, % */
  1446.     double s_mag;    /* visual magnitude */
  1447. } Sky;
  1448.  
  1449. /* flags for riset_cir() status */
  1450. #define    RS_NORISE    0x001    /* object does not rise as such today */
  1451. #define    RS_2RISES    0x002    /* object rises more than once today */
  1452. #define    RS_NOSET    0x004    /* object does not set as such today */
  1453. #define    RS_2SETS    0x008    /* object sets more than once today */
  1454. #define    RS_CIRCUMPOLAR    0x010    /* object stays up all day today */
  1455. #define    RS_2TRANS    0x020    /* transits twice in one day */
  1456. #define    RS_NEVERUP    0x040    /* object never rises today */
  1457. #define    RS_NOTRANS    0x080    /* doesn't transit today */
  1458. #define    RS_ERROR    0x100    /* can't figure out times... */
  1459.  
  1460. /* shorthands for fields a Now pointer, np */
  1461. #define mjd    np->n_mjd
  1462. #define lat    np->n_lat
  1463. #define lng    np->n_lng
  1464. #define tz    np->n_tz
  1465. #define temp    np->n_temp
  1466. #define pressure np->n_pressure
  1467. #define height    np->n_height
  1468. #define epoch    np->n_epoch
  1469. #define tznm    np->n_tznm
  1470. xXx
  1471.