home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume28 / ephem / part01 next >
Text File  |  1992-03-15  |  56KB  |  1,380 lines

  1. Newsgroups: comp.sources.misc
  2. From: e_downey@hwking.cca.cr.rockwell.com (Elwood C. Downey)
  3. Subject:  v28i084:  ephem - an interactive astronomical ephemeris, v4.28, Part01/09
  4. Message-ID: <csm-v28i084=ephem.155600@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 3979de5aaf5414fdf9d087b2ab640df9
  6. Date: Tue, 10 Mar 1992 21:56:23 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: e_downey@hwking.cca.cr.rockwell.com (Elwood C. Downey)
  10. Posting-number: Volume 28, Issue 84
  11. Archive-name: ephem/part01
  12. Environment: UNIX, VMS, DOS, MAC
  13. Supersedes: ephem-4.21: Volume 14, Issue 76-81
  14.  
  15. Ephem is a program that displays ephemerides for all the planets plus any
  16. two additional objects.  The additional objects may be fixed or specified
  17. via heliocentric elliptical, hyperbolic or parabolic orbital elements to
  18. accommodate solar system objects such as asteroids or comets.
  19.  
  20. Information displayed about each object includes RA and Dec precessed to
  21. any epoch, local azimuth and altitude, heliocentric coordinates, distance
  22. from sun and earth, solar elongation, angular size, visual magnitude,
  23. illumination percentage, local rise, transit and set times, length of time
  24. up, constellation, and angular separations between all combinations of
  25. objects.  A special detail of Jupiter's moons and central meridian
  26. longitude is also available.
  27.  
  28. Observing circumstance information includes UTC and local date and time,
  29. local sidereal time, times of astronomical twilight, length of day and
  30. night, local temperature, pressure and height above sea level for the
  31. refraction model and a monthly calendar.
  32.  
  33. RA/Dec calculations are geocentric and include the effects of light travel
  34. time, nutation, aberration and precession.  Alt/az and rise/set/transit
  35. and, optionally, angular separation calculations are topocentric and
  36. include the additional effects of parallax and refraction.
  37.  
  38. Plot and listing files of selected field values may be generated as the
  39. program runs.  The plot files are full precision floating point values in
  40. ASCII intended for export to other plotting programs.  The listing files
  41. are tables formatted for more general human reading.  Ephem includes
  42. simple quick-look facilities to view these files.
  43.  
  44. One may watch the sky or the solar system with a simple character-oriented
  45. screen display.
  46.  
  47. Ephem may be asked to search for interesting conditions automatically,
  48. using several algorithms. Most fields displayed on the screen may be used
  49. as terms in an arbitrary arithmetic expression that can be solved for
  50. local zero or extrema, or the time of state change of any boolean
  51. expression can be found.
  52.  
  53. The program is some 11,000 lines of C. It uses only a very simple set of
  54. io routines and should be easily ported to any 24x80 ANSI/ASCII display. 
  55. To date, it has been ported to several flavors of Unix, VMS, MS-DOS and,
  56. simplistically, the Macintosh using Think-C.
  57. ------------
  58. #! /bin/sh
  59. # This is a shell archive.  Remove anything before this line, then feed it
  60. # into a shell via "sh file" or similar.  To overwrite existing files,
  61. # type "sh file -c".
  62. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  63. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  64. # Contents:  Man.txt.a riset_c.c
  65. # Wrapped by kent@sparky on Tue Mar 10 14:34:04 1992
  66. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  67. echo If this archive is complete, you will see the following message:
  68. echo '          "shar: End of archive 1 (of 9)."'
  69. if test -f 'Man.txt.a' -a "${1}" != "-c" ; then 
  70.   echo shar: Will not clobber existing file \"'Man.txt.a'\"
  71. else
  72.   echo shar: Extracting \"'Man.txt.a'\" \(41589 characters\)
  73.   sed "s/^X//" >'Man.txt.a' <<'END_OF_FILE'
  74. X
  75. X
  76. X
  77. X
  78. X
  79. X
  80. X
  81. X                          Ephem V4.28 - February 24, 1992
  82. X
  83. X               Copyright (c) 1990,1991,1992 by Elwood Charles Downey
  84. X
  85. X
  86. X
  87. X                                 Table of Contents
  88. X      1.  Introduction ...................................................  3
  89. X      1.1.  References and Acknowledgements ..............................  3
  90. X      2.  Running Ephem ..................................................  4
  91. X      2.1.  Command Line Format ..........................................  4
  92. X      2.2.  Program Operation ............................................  4
  93. X      3.  Screen Fields ..................................................  6
  94. X      3.1.  Top Screen Fields ............................................  6
  95. X      3.2.  The "OCX" column .............................................  7
  96. X      3.3.  Data format columns ..........................................  8
  97. X      3.4.  RiseSet format columns .......................................  8
  98. X      3.5.  Separation format fields .....................................  9
  99. X      3.6.  Jupiter Aux ..................................................  9
  100. X      4.  Date and Time Formats ..........................................  9
  101. X      5.  Configuration File ............................................. 10
  102. X      5.1.  Configuration File fields .................................... 10
  103. X      5.2.  Example ephem.cfg ............................................ 12
  104. X      6.  Menu options ................................................... 12
  105. X      6.1.  Adaptive vs. Standard hzn .................................... 12
  106. X      6.2.  Geocentric vs. Topocentric ................................... 13
  107. X      7.  User Defined Objects: X and Y .................................. 13
  108. X      7.1.  Controlling Object-X or Y Operation .......................... 13
  109. X      7.1.1.  Fixed ...................................................... 14
  110. X      7.1.2.  Elliptical ................................................. 14
  111. X      7.1.3.  Hyperbolic ................................................. 14
  112. X      7.1.4.  Parabolic .................................................. 15
  113. X      7.1.5.  Lookup ..................................................... 15
  114. X      7.1.6.  On or Off .................................................. 15
  115. X      7.2.  Magnitude models ............................................. 16
  116. X      7.2.1.  g/k model .................................................. 16
  117. X      7.2.2.  H/G model .................................................. 16
  118. X      7.3.  Database File ................................................ 17
  119. X      8.  Plotting ....................................................... 17
  120. X      8.1.  Defining plot fields ......................................... 18
  121. X      8.2.  Displaying a plot file ....................................... 18
  122. X      8.3.  Cartesian or Polar coords .................................... 18
  123. X      8.4.  Begin Plotting ............................................... 18
  124. X      8.5.  Stopping Plotting ............................................ 19
  125. X      9.  Listing ........................................................ 19
  126. X      10.  Watching ...................................................... 19
  127. X      10.1.  Trails ...................................................... 19
  128. X      10.2.  Sky dome .................................................... 19
  129. X      10.3.  Alt/az sky .................................................. 19
  130. X      10.4.  Solar System ................................................ 20
  131. X      11.  Searching ..................................................... 20
  132. X      11.1.  Find extreme ................................................ 20
  133. X      11.2.  Find 0 ...................................................... 21
  134. X
  135. X
  136. X
  137. X
  138. X
  139. X
  140. X
  141. X
  142. X
  143. X                                       - 2 -
  144. X
  145. X
  146. X      11.3.  Binary ...................................................... 21
  147. X      11.4.  Define a New function ....................................... 21
  148. X      11.4.1.  Intrinsic functions ....................................... 21
  149. X      11.4.2.  Field Specifiers .......................................... 22
  150. X      11.4.3.  Constants ................................................. 22
  151. X      11.4.4.  Operators ................................................. 22
  152. X      11.5.  Specifying Search Accuracy .................................. 23
  153. X      11.6.  Stop ........................................................ 23
  154. X      11.7.  Example Searches ............................................ 23
  155. X      11.8.  Another Example ............................................. 24
  156. X      11.9.  Caution ..................................................... 24
  157. X      12.  Implementation Notes .......................................... 24
  158. X      12.1.  Program limits .............................................. 25
  159. X      13.  DOS Installation Procedure .................................... 26
  160. X      13.1.  Setting TZ .................................................. 26
  161. X      14.  Known Bugs and Wish List ...................................... 27
  162. X      15.  Sample Screens ................................................ 28
  163. X
  164. X
  165. X
  166. X
  167. X
  168. X
  169. X
  170. X
  171. X
  172. X
  173. X
  174. X
  175. X
  176. X
  177. X
  178. X
  179. X
  180. X
  181. X
  182. X
  183. X
  184. X
  185. X
  186. X
  187. X
  188. X
  189. X
  190. X
  191. X
  192. X
  193. X
  194. X
  195. X
  196. X
  197. X
  198. X
  199. X
  200. X
  201. X
  202. X
  203. X
  204. X
  205. X
  206. X
  207. X
  208. X
  209. X                                       - 3 -
  210. X
  211. X
  212. X     1.  Introduction
  213. X
  214. X     Ephem is a program that displays ephemerides for all the planets plus any
  215. X     two additional objects.  The additional objects may be fixed or specified
  216. X     via heliocentric elliptical, hyperbolic or parabolic orbital elements to
  217. X     accommodate solar system objects such as asteroids or comets.
  218. X
  219. X     Information displayed about each object includes RA and Dec precessed to
  220. X     any epoch, local azimuth and altitude, heliocentric coordinates, distance
  221. X     from sun and earth, solar elongation, angular size, visual magnitude,
  222. X     illumination percentage, local rise, transit and set times, length of time
  223. X     up, constellation, and angular separations between all combinations of
  224. X     objects.  A special detail of Jupiter's moons and central meridian
  225. X     longitude is also available.
  226. X
  227. X     Observing circumstance information includes UTC and local date and time,
  228. X     local sidereal time, times of astronomical twilight, length of day and
  229. X     night, local temperature, pressure and height above sea level for the
  230. X     refraction model and a monthly calendar.
  231. X
  232. X     RA/Dec calculations are geocentric and include the effects of light travel
  233. X     time, nutation, aberration and precession.  Alt/az and rise/set/transit
  234. X     and, optionally, angular separation calculations are topocentric and
  235. X     include the additional effects of parallax and refraction.
  236. X
  237. X     Plot and listing files of selected field values may be generated as the
  238. X     program runs.  The plot files are full precision floating point values in
  239. X     ASCII intended for export to other plotting programs.  The listing files
  240. X     are tables formatted for more general human reading.  Ephem includes
  241. X     simple quick-look facilities to view these files.
  242. X
  243. X     One may watch the sky or the solar system with a simple character-oriented
  244. X     screen display.
  245. X
  246. X     Ephem may be asked to search for interesting conditions automatically,
  247. X     using several algorithms. Most fields displayed on the screen may be used
  248. X     as terms in an arbitrary arithmetic expression that can be solved for
  249. X     local zero or extrema, or the time of state change of any boolean
  250. X     expression can be found.
  251. X
  252. X     The program is some 11,000 lines of C. It uses only a very simple set of
  253. X     io routines and should be easily ported to any 24x80 ASCII display.  To
  254. X     date, it has been ported to several flavors of Unix, VMS, MS-DOS and,
  255. X     simplistically, the Macintosh using Think-C.
  256. X
  257. X     1.1.  References and Acknowledgements
  258. X
  259. X     The planetary polynomials and correction algorithms are taken, with
  260. X     permission, from "Astronomy With Your Personal Computer", by Peter
  261. X     Duffett-Smith, Cambridge University Press, (c) 1985.
  262. X
  263. X     The constellation determination algorithm is from a paper by Nancy G.
  264. X     Roman, "Identification of a constellation from a position", Publications
  265. X     of the Astronomical Society of the Pacific, Vol.  99, pages 695-699, July
  266. X
  267. X
  268. X
  269. X
  270. X
  271. X
  272. X
  273. X
  274. X
  275. X                                       - 4 -
  276. X
  277. X
  278. X     1987.
  279. X
  280. X     The precession routine is from 1989 Astronomical Almanac.
  281. X
  282. X     Jupiter's moons are based on information in "Astronomical Formulae for
  283. X     Calculators" by Jean Meeus. Richmond, Va., U.S.A., Willmann-Bell, (c)1982.
  284. X     This reference is suitable for identification purposes but is not accurate
  285. X     enough for precise occultation work.
  286. X
  287. X     I would like to thank Craig Counterman for his very competent assistance,
  288. X     Joseph Fedock for his faithful testing and encouragement, Karsten Spang,
  289. X     Richard Dyson, Doug McDonald and Peter Newton for their contributions in
  290. X     porting ephem to various systems, and the many others who have made
  291. X     helpful suggestions along the way.  Finally, I would like to thank all of
  292. X     you who actually use ephem; it is most gratifying to make a program from
  293. X     which others derive value.
  294. X
  295. X     2.  Running Ephem
  296. X
  297. X
  298. X     2.1.  Command Line Format
  299. X
  300. X     To run ephem, just type "ephem".  You may also specify an alternate
  301. X     configuration file, an alternate database file, and specify initial values
  302. X     for several screen fields.  The command line syntax can be summarized as
  303. X     follows:
  304. X
  305. X         ephem [-c <config_file>] [-d <database_file>] [field=value  ...]
  306. X
  307. X
  308. X     The default configuration file is named ephem.cfg in the current
  309. X     directory.  Ephem also looks for one named by the EPHEMCFG environment
  310. X     variable, if it is set. You may specify an arbitrary name with the -c
  311. X     option.
  312. X
  313. X     The default database file is named ephem.db in the current directory.
  314. X     Ephem also looks for one named by the EPHEMDB environment variable, if it
  315. X     is set. You may specify an arbitrary name with the -d option.
  316. X
  317. X     The exact format of these files is described below.
  318. X
  319. X     Any additional command line arguments are treated exactly as if they too
  320. X     came from the configuration file.
  321. X
  322. X     2.2.  Program Operation
  323. X
  324. X     When ephem starts, it first displays a disclaimer banner.  Then, after any
  325. X     key is pressed, it reads the configuration file and processes the command
  326. X     line arguments to set the initial values of several fields, accessing the
  327. X     database file if OBJX or OBJY is set, It then draws all fields on the
  328. X     screen with their initial values.  The program then loops advancing time
  329. X     each step, by some amount you may control, and updating all fields each
  330. X     loop.
  331. X
  332. X
  333. X
  334. X
  335. X
  336. X
  337. X
  338. X
  339. X
  340. X
  341. X                                       - 5 -
  342. X
  343. X
  344. X     There are three fields that control this looping behavior.  NStep controls
  345. X     the number of steps, StpSz the amount of time to add each step, and Pause
  346. X     is the amount of real seconds to pause between steps.  Ephem does not
  347. X     pause between steps when plotting or searching is on.  When the number of
  348. X     steps, NStep, goes to 0 or any key is pressed, the looping stops and you
  349. X     enter a command mode.
  350. X
  351. X     Command mode allows you to modify most of the fields.  The idea is that
  352. X     you move to each field on the screen you wish to change and change it.
  353. X     When you have changed everything you want to, type "q" to resume screen
  354. X     updates.
  355. X
  356. X     To change a field:
  357. X
  358. X         1) move the cursor to the field (see below);
  359. X         2) type RETURN;
  360. X         3) type in the new value along the command line at the top according
  361. X            to the format indicated in the prompt. To accept the new value
  362. X            type RETURN, or to leave it unchanged after all type "q".
  363. X
  364. X
  365. X     A few fields don't require you to type anything; just typing RETURN does
  366. X     all the work.  If you can't move to it, you can't change it.
  367. X
  368. X     The arrow keys on most systems move the cursor around.  If these do not
  369. X     function or function incorrectly, the h/j/k/l keys also move the cursor
  370. X     left/down/up/right, respectively.  Motions off any edge of the screen will
  371. X     wrap around.
  372. X
  373. X     Several "hot-keys" move the cursor immediately to frequently used fields.
  374. X     You may move the cursor immediately to a planet row by typing one of the
  375. X     characters SMevmJsunpxy.  "x" and "y" are for the user-defined objects X
  376. X     and y on the bottom rows.  Also, the characters c, d, o, w, L and z move
  377. X     you to the Menu, UT Date, Epoch, Watch, Listing and StpSz fields
  378. X     immediately.
  379. X
  380. X     When you have changed a field that would invalidate any of the other
  381. X     fields the message NEW CIRCUMSTANCES appears in the top center of the
  382. X     screen.  This will remain until you type "q" to allow at least one screen
  383. X     update loop to occur.  If you change any field that causes new
  384. X     circumstances, the StpSz value is not added to the first loop.  Note also
  385. X     that after a series of loops, NStep is automatically reset to 1 so "q"
  386. X     will do exactly one loop and return you to command mode.
  387. X
  388. X     On some systems, you may temporarily escape from ephem while in command
  389. X     mode to run your operating system's command interpretor. This is done by
  390. X     typing an exclamation point (!) followed by your command.  When the
  391. X     command completes, you will return back to ephem where you left off.
  392. X
  393. X     To quit the program, type control-d from command mode.  For a little more
  394. X     help, type ?.  The entire screen may be erased and redrawn with control-l.
  395. X
  396. X
  397. X
  398. X
  399. X
  400. X
  401. X
  402. X
  403. X
  404. X
  405. X
  406. X
  407. X                                       - 6 -
  408. X
  409. X
  410. X     3.  Screen Fields
  411. X
  412. X     The screen is divided into two halves, top and bottom.  The top fields are
  413. X     always present. They define the general observing circumstances and
  414. X     control features.
  415. X
  416. X     The bottom half has several different forms. In three of the possible
  417. X     forms the planets and two additional objects are displayed in a table.
  418. X     There is one object per row, and several columns.  The three forms of this
  419. X     portion selected by picking the Menu selection.
  420. X
  421. X     The fourth form is a display of the planetocentric coordinates of the
  422. X     Galilean moons of Jupiter, including a simple graphical display of their
  423. X     locations as seen from Earth, and the central meridian longitude, in two
  424. X     of the adopted rotational systems.
  425. X
  426. X     Some things may be turned off to reduce compute times.  Calculations for
  427. X     each planet may be turned on and off by selecting the planet name field.
  428. X     Calculations for Dawn/Dusk/NiteLn may be turned off by selecting any of
  429. X     these fields.  Planet positions are only updated as often as necessary to
  430. X     match the display precision of the screen unless plotting or searching is
  431. X     on.  In these cases full precision is desired at all times and so
  432. X     positions are always fully recalculated at each iteration.
  433. X
  434. X     Follows is a list and description of each of the fields in each section.
  435. X     Following each name a parenthetical "p" indicates the field may be
  436. X     selected for plotting (see later). All fields may be selected for
  437. X     changing.
  438. X
  439. X
  440. X     3.1.  Top Screen Fields
  441. X
  442. X     LTZ           the local timezone name.  The name field may be changed to
  443. X                   any three-character mnemonic.
  444. X     LT(p)
  445. X     LD(p)         The local time and date are not labeled as such but are to
  446. X                   the right of the local timezone name.  They are individually
  447. X                   selectable.  Time and date fields may be changed as
  448. X                   described in a later section.  Set to "n" to set to "now"
  449. X                   from computer clock.
  450. X     UT(p)
  451. X     UD(p)         The universally coordinated time and date are not labeled as
  452. X                   such but are to the right of the UTC label.  They are
  453. X                   individually selectable.  Time and date fields may be
  454. X                   changed as described in a later section.  Set to "n" to set
  455. X                   to "now" from computer clock.
  456. X     JulianDat(p)  the current Julian date, to about 1-second accuracy.
  457. X     Listing       controls listing; see complete discussion below.
  458. X     Watch         selects the sky dome, altitude/azimuth sky or solar system
  459. X                   displays; see complete discussion below.
  460. X     Search        controls the automatic search feature of ephem. See the
  461. X                   complete discussion below.
  462. X     Plot          controls plotting; see complete discussion below.
  463. X     Menu          controls which menu is in the bottom half of the screen.
  464. X
  465. X
  466. X
  467. X
  468. X
  469. X
  470. X
  471. X
  472. X
  473. X                                       - 7 -
  474. X
  475. X
  476. X                   See their complete discussion below.
  477. X     LST(p)        the current local sidereal time.  set to "n" to set from
  478. X                   computer clock.
  479. X     Dawn(p)       local time when the sun center is 18 degrees below the
  480. X                   horizon before sunrise today.
  481. X     Dusk(p)       local time when the sun center is 18 degrees below the
  482. X                   horizon after sunset today.
  483. X     NiteLn(p)     length of astronomical night, ie, Dawn - Dusk.  If this line
  484. X                   is shown as "-----", it means the sun is either always below
  485. X                   or always above approximately -18 degrees altitude on this
  486. X                   particular day.  This and the Dawn and Dusk lines are blank
  487. X                   when their computation has been turned off.
  488. X     NStep         The number of times the display with be updated (time
  489. X                   advanced by StpSz each step) before entering command mode.
  490. X     StpSz         the amount of time UTC (and its derivatives) is incremented
  491. X                   each loop.  set this to "r" to use real-time based on the
  492. X                   computer clock.  you may also set it in terms of days by
  493. X                   appending a "d" after the number when you set it.
  494. X     Lat(p)        location latitude, positive degrees north of equator.
  495. X     Long(p)       location longitude, positive degrees west of Greenwich
  496. X                   meridian.  set to "N" to set from computer clock.
  497. X     Elev(p)       local elevation of the ground above sea level, in feet. (see
  498. X                   implementation notes).
  499. X     Temp(p)       local surface air temperature, in degrees F.
  500. X     AtmPr(p)      local surface air pressure, in inches of mercury.
  501. X     TZ(p)         hours local time is behind utc, ie, positive west or
  502. X                   negative east of Greenwich.
  503. X     Epoch         the epoch, to the nearest 0.1 years, to which the ra/dec
  504. X                   fields are precessed.  This says (OfDate) when coordinates
  505. X                   are not precessed, ie, are in the epoch of date. Set to "e"
  506. X                   to set to epoch of date.
  507. X     Pause         number of seconds to pause between screen updates. This is
  508. X                   used mainly to set up for free-running unattended operation.
  509. X                   This pause also applies to free-running "watch" screen
  510. X                   updates.  Pausing is not done when plotting or searching is
  511. X                   on.  If pausing is used with StpSz set to RT CLOCK and the
  512. X                   time was set with Now then ephem attempts to synchronize the
  513. X                   time to an integral multiple of pause seconds after the
  514. X                   minute, for aesthetic reasons.
  515. X
  516. X     Also in the upper right of the screen is a calendar for the current local
  517. X     month.  Dates of local new and full moons are marked NM and FM,
  518. X     respectively.
  519. X
  520. X
  521. X     3.2.  The "OCX" column
  522. X
  523. X     The left column of the bottom screen, when displaying planetary
  524. X     information, is labeled "OCX". This is short for "Object-Constellation-
  525. X     eXtra".  It is actually one, two or three adjacent one-column pickable
  526. X     fields.  Select the first column of the name to toggle the display and
  527. X     calculations on and off.  Select the second column of the name to show the
  528. X     constellation in which the object currently resides.  If available, the
  529. X     third column of a planet name can be picked to display additional current
  530. X
  531. X
  532. X
  533. X
  534. X
  535. X
  536. X
  537. X
  538. X
  539. X                                       - 8 -
  540. X
  541. X
  542. X     information relating to the planet. At this time, this feature is only
  543. X     available for Jupiter.
  544. X
  545. X     3.3.  Data format columns
  546. X
  547. X     R.A.(p)       apparent geocentric right ascension of object, precessed to
  548. X                   given epoch, in hours, minutes and decimal minutes.
  549. X     Dec(p)        apparent geocentric declination of object, precessed to
  550. X                   given epoch, in degrees and minutes.
  551. X     Az(p)         degrees eastward of true north for object.
  552. X     Alt(p)        degrees up from a horizontal plane Elev feet above sea
  553. X                   level.
  554. X     H Long(p)     true heliocentric longitude, in degrees.  Earth's is
  555. X                   displayed on the sun's line.  For the moon this is the
  556. X                   geocentric longitude.
  557. X     H Lat(p)      true heliocentric latitude, in degrees.  For the moon this
  558. X                   is the geocentric latitude.
  559. X     Ea Dst(p)     true distance from Earth center to object center, in AU,
  560. X                   except distance to the moon is in miles.
  561. X     Sn Dst(p)     true distance from sun center to object center, in AU.
  562. X     Elong(p)      spherical angular separation between sun and given object,
  563. X                   calculated from the their geocentric ecliptic coordinates.
  564. X                   Note this is not just the difference in ecliptic longitude.
  565. X                   The sign, however, is simply sign(obj's longitude - sun's
  566. X                   longitude), ie, degrees east.  thus, a positive elongation
  567. X                   means the object rises after the sun.  This field is not
  568. X                   generally useful in searching for conjunctions because of
  569. X                   the discontinuous sign change that occurs at conjunction.
  570. X     Size(p)       angular size of object, in arc seconds.
  571. X     VMag(p)       visual magnitude of object.
  572. X     Phs(p)        percent of visible surface in sunlight. Note the moon phase
  573. X                   is calculated simplistically as just abs(elongation)/180*100
  574. X                   which can be a few degrees off... this means that because of
  575. X                   how elongation is defined it doesn't say 0 during new moon
  576. X                   (or 100 during full) except during close eclipses (maybe
  577. X                   that's a "feature"?).
  578. X     Also, some terminals scroll when a character is written to the lower right
  579. X     character position. To avoid this, Object Y's phase is left shifted by one
  580. X     column. This can look particularly ugly when the phase is 100% because the
  581. X     "100" is right next to visual magnitude number.
  582. X     If desired, the angle between Earth and Sun from the object, p, can be
  583. X     computed from the illumination percentage, i, with the following relation:
  584. X
  585. X         cos (p) = i/50 - 1
  586. X
  587. X
  588. X     3.4.  RiseSet format columns
  589. X     Rise Time
  590. X     Rise Az       The local time and azimuth when the upper limb of the object
  591. X                   rises today.
  592. X     Transit Time
  593. X     Transit Alt   The local time and altitude when the object crosses the
  594. X                   meridian today, ie, when its azimuth is true south or, if no
  595. X                   precession, when the local sidereal time equals the object's
  596. X
  597. X
  598. X
  599. X
  600. X
  601. X
  602. X
  603. X
  604. X
  605. X                                       - 9 -
  606. X
  607. X
  608. X                   right ascension.
  609. X     Set Time
  610. X     Set Az        The local time and azimuth when the upper limb of the object
  611. X                   sets today.
  612. X     Hours Up      The number of hours the object is up on the local date.
  613. X
  614. X     Horizon displacement may be calculated in either of two ways; see the
  615. X     horizon discussion in the Menu selection section.
  616. X
  617. X     Various oddball conditions are accounted for, including an object that is
  618. X     up sometime during the day but that doesn't rise, transit or set as such
  619. X     on that day, an object that is circumpolar or that is never up or one that
  620. X     rises twice on the same day.  These are marked as "Never rises", "Never
  621. X     transits", "Never sets", "Circumpolar", "Never up" or appended with a plus
  622. X     "+" sign, respectively.
  623. X
  624. X     3.5.  Separation format fields
  625. X     This format is a table of angular separations between each pair of
  626. X     objects.  These angles are based on the local altitude/azimuth, and so in
  627. X     general differ somewhat from the elongations reported for the sun in the
  628. X     Data menu.
  629. X     Unfortunately, with the format "ddd:mm", there is not enough room for a
  630. X     space between columns when the angle is at least 100 degrees.  To avoid
  631. X     this, ephem drop the minutes portion if the (rounded) angle is at least
  632. X     100 degrees.
  633. X
  634. X     3.6.  Jupiter Aux
  635. X     This menu option is a table of X, Y and Z coordinates for each of the
  636. X     moons of Jupiter known to Galileo Galilei, that is, its four brightest.
  637. X     The coordinate system is such that the xy plane is the mean plane of the
  638. X     moons orbits, with +x to the east, +y to the north, and +z towards earth.
  639. X     The y coordinate is corrected for earth's angular displacement above or
  640. X     below this plane.
  641. X     The menu also displays the longitude of the central meridian of Jupiter.
  642. X     Three rotational systems have been adopted for this purpose; we show the
  643. X     two that are useful to visual work.
  644. X
  645. X     4.  Date and Time Formats
  646. X     Times are displayed and entered in h:m:s format.  If you pick a time field
  647. X     to change it any of the h, m, and s components that are not specified are
  648. X     left unchanged from their current value.  For example, 0:5:0 set hours to
  649. X     0, minutes to 5, seconds to 0, whereas :5 sets minutes to 5 but leaves
  650. X     hours and seconds unchanged.  A negative time is indicated by a minus sign
  651. X     (-) anywhere before the first digit.
  652. X
  653. X     Dates are displayed and entered in American month:day:year format.  As
  654. X     with time, components omitted when entering a new value retain the current
  655. X     value.  For example, if the current date is 10/20/1988 and you type 20/20
  656. X     the new date will become 20/20/1988. Note you must type the full year
  657. X     since the program is accurate over several centuries either side of 1900.
  658. X     If you change the date, the time (ie, partial day) will not change.
  659. X
  660. X     Negative years indicate BC dates. For example, Jan 1, 1 BC is given as
  661. X     1/1/-1.  There is no year 0.
  662. X
  663. X
  664. X
  665. X
  666. X
  667. X
  668. X
  669. X
  670. X
  671. X                                       - 10 -
  672. X
  673. X
  674. X     Two other ways to set the date are supported for compatibility with some
  675. X     published comet ephemerides.  You may enter the day portion as a real
  676. X     number.  When you set the day this way, the time will also change to
  677. X     correspond to the fractional portion of the day.
  678. X
  679. X     You may also enter a date as a decimal year, as in 1990.12345.  This is
  680. X     also useful in interpreting plot files that include a date field, since
  681. X     date fields are stored in plot files as decimal years.  If no decimal
  682. X     point is included, the number is assumed to be a year unless it is in the
  683. X     range 1-12, in which case it will be taken to mean that you are just
  684. X     changing the month of the current date.  To actually specify the years 1 -
  685. X     12, you must append a decimal point to distinguish them from months.
  686. X
  687. X     As a matter of typing convenience, the program accepts most any character
  688. X     as the separator; you don't have to type a perfect ":" or "/".
  689. X
  690. X     5.  Configuration File
  691. X     The ephem.cfg configuration file allows you to set the initial values of
  692. X     many of the screen fields. You can still change any field while the
  693. X     program is running too; this file just sets the initial conditions.  Note
  694. X     that the order of entries in this file is important because they each take
  695. X     effect immediately.  You should put them in the same order you wish them
  696. X     to be processed, just as though you were changing the fields interactively
  697. X     within ephem.
  698. X
  699. X     The default name of the file is ephem.cfg.  Ephem also looks for one named
  700. X     by the EPHEMCFG environment variable (if defined) or you may specify any
  701. X     name using the -c command line option.
  702. X
  703. X     The format of the file uses the form KEYWORD=VALUE, where the possible
  704. X     KEYWORDS and the types of VALUES for each are described below. Any
  705. X     KEYWORDS not in the file will take on some sort of default. The separator
  706. X     need not be an actual equals sign; any char will do because the VALUE is
  707. X     assumed to start one character after the KEYWORD, regardless.
  708. X
  709. X     All lines that do not begin with an alpha character (a through z, either
  710. X     case) are ignored and may be used for comments.
  711. X
  712. X     Note: because of the way unspecified time and date components are left
  713. X     unchanged (see section on Date and Time Formats) always specify the
  714. X     complete time and date for all entries in the configuration file. For
  715. X     example, to initialize the longitude to zero degrees, say 0:0:0, not just
  716. X     0.
  717. X
  718. X     5.1.  Configuration File fields
  719. X     UD        initial UTC date, such as 10/20/1988, or "NOW" to use the
  720. X               computer clock.
  721. X     UT        initial UTC time, such as 12:0:0, or "NOW" to use the computer
  722. X               clock.
  723. X     TZONE     hours the local time is behind utc, such as 5:0:0.  you need not
  724. X               set this if you use "NOW" for UT or UD.
  725. X     TZNAME    name of the local time zone, such as CDT. 3 chars max.  you need
  726. X               not set this if you use "NOW" for UT or UD.
  727. X     LONG      longitude, in degrees west of Greenwich, in the form d:m:s.
  728. X
  729. X
  730. X
  731. X
  732. X
  733. X
  734. X
  735. X
  736. X
  737. X                                       - 11 -
  738. X
  739. X
  740. X     LAT       latitude, in degrees north of the equator, in the form d:m:s.
  741. X     HEIGHT    height above sea level, in feet, such as 800
  742. X     TEMP      air temperature, in degrees F, such as 50
  743. X     PRES      air pressure, in inches of Mercury, such as 29
  744. X     STPSZ     the time increment between screen updates, such as "1" to give
  745. X               one hour updates. this can be a specific amount or RTC to use
  746. X               the system clock as a real-time source. You may also specify a
  747. X               time in days, by appending a D (or d) after the number.
  748. X     PROPTS    this selects what you want included initially in the display.
  749. X               since IBM-PC math is not very fast, you can reduce the time to
  750. X               update the screen by only printing those fields of interest. the
  751. X               VALUE is a collection of letters to turn on each item from the
  752. X               following set:
  753. X
  754. X                       T       twilight (dawn-dusk)
  755. X                       S       circumstances for the sun
  756. X                       M       circumstances for the moon
  757. X                       e       circumstances for mercury
  758. X                       v       circumstances for venus
  759. X                       m       circumstances for mars
  760. X                       j       circumstances for jupiter
  761. X                       s       circumstances for saturn
  762. X                       u       circumstances for uranus
  763. X                       n       circumstances for neptune
  764. X                       p       circumstances for pluto
  765. X                       x       circumstances for object X
  766. X                       y       circumstances for object Y
  767. X
  768. X               For example, to just track the sun and saturn, say PROPTS=Ss
  769. X
  770. X               If the delimiter between PROPTS and the selection is a plus (+)
  771. X               sign then the given planets are included IN ADDITION TO ones
  772. X               already specified. Any other delimiter sets the selection to
  773. X               exactly the set specified. This feature was added so that the
  774. X               command line version of using PROPTS could add to the set of
  775. X               planets giving in the configuration file.
  776. X     NSTEP     number of times program will loop before entering command mode.
  777. X               see the discussion under Program Operation.
  778. X     EPOCH     this sets the desired ra/dec precession epoch. you can put any
  779. X               date here or EOD to use the current instant ("Epoch of Date").
  780. X     OBJX
  781. X     OBJY      These fields specify the optional objects "x" and "y" by naming
  782. X               any item in the database file. The form is OBJX=xyz, where xyz
  783. X               must be in the database file, case sensitive.  You may define
  784. X               one object of each type for each of OBJX and OBJY; the last one
  785. X               defined will be the "current" one when ephem gets going.
  786. X     PAUSE     The number of seconds to pause between calculation steps. See
  787. X               definition of the Pause field in the "Top Screen Fields"
  788. X               section.
  789. X     MENU      establishes the initial bottom screen menu type.  This should be
  790. X               one of the keywords DATA, RISET, SEP or JUP.  There is no way to
  791. X               set horizon or center suboptions at this time.
  792. X
  793. X
  794. X
  795. X
  796. X
  797. X
  798. X
  799. X
  800. X
  801. X
  802. X
  803. X                                       - 12 -
  804. X
  805. X
  806. X     5.2.  Example ephem.cfg
  807. X
  808. X     This is the ephem.cfg file that was in effect when the sample screens (in
  809. X     another section) were generated. You might run ephem with this
  810. X     configuration file and compare with the samples as a check.
  811. X
  812. X     UT=0;0;0
  813. X     UD=5/1/1990
  814. X     TZNAME=CDT
  815. X     TZONE=5
  816. X     LONG=93:42:8
  817. X     LAT=44:50:37
  818. X     HEIGHT=800
  819. X     TEMP=40
  820. X     PRES=29.5
  821. X     STPSZ=RTC
  822. X     PROPTS=TSMevmjsunpxy
  823. X     EPOCH=2000
  824. X     NSTEP=1
  825. X
  826. X     OBJX=Austin
  827. X     OBJY=Juno
  828. X
  829. X     As another common example, this ephem.cfg creates an essentially free-
  830. X     running real-time screen based on the computer clock:
  831. X
  832. X     UT=Now
  833. X     LONG=90:10:8
  834. X     LAT=40:50:20
  835. X     HEIGHT=800
  836. X     TEMP=50
  837. X     PRES=29
  838. X     STPSZ=RTC
  839. X     PROPTS=TSMevmjsunp
  840. X     NSTEP=9999999
  841. X     EPOCH=Eod
  842. X     PAUSE=30
  843. X
  844. X
  845. X     6.  Menu options
  846. X
  847. X     When you select "Menu" you can change among the three styles of bottom
  848. X     screens. There are also two options that can be set from the Menu quick-
  849. X     choice menu. These options toggle when picked and retain their values so
  850. X     they need only be changed when desired.
  851. X
  852. X     6.1.  Adaptive vs. Standard hzn
  853. X
  854. X     This selects the horizon refraction displacement algorithm used by the
  855. X     Rise/Set menu.  "Adaptive" uses the local atmospheric conditions known to
  856. X     ephem and matches the Planet Info times nicely. "Standard" uses the
  857. X     "accepted nominal" horizon refraction value of 32 arc minutes and usually
  858. X     agrees, to a minute or so, with published tables.
  859. X
  860. X
  861. X
  862. X
  863. X
  864. X
  865. X
  866. X
  867. X
  868. X
  869. X                                       - 13 -
  870. X
  871. X
  872. X     6.2.  Geocentric vs. Topocentric
  873. X
  874. X     This selects the vantage point for the Separation menu. "Geocentric"
  875. X     ignores local conditions and gives the separation as seen from Earth
  876. X     center. "Topocentric" uses the local conditions known to ephem.  They are
  877. X     particularly critical for lunar occultations, but the effect can be
  878. X     significant for the planets.
  879. X
  880. X     Note that searching over a period that will include the rise or set times
  881. X     of either object is generally better performed from the geocentric
  882. X     viewpoint.  The refraction effect of the topocentric viewpoint causes many
  883. X     arcminutes of rapid whiplash displacement as the objects rise and set that
  884. X     overlays the smooth celestial motion of the objects.  This rapid position
  885. X     variation can confuse the solver algorithms that expect fairly smooth
  886. X     functions.
  887. X
  888. X     7.  User Defined Objects: X and Y
  889. X
  890. X     You may specify one or two extra objects for ephem to use. The objects may
  891. X     be defined in four different ways: fixed celestial sphere coordinates, or
  892. X     heliocentric elliptical, hyperbolic or parabolic orbital elements.
  893. X     Elliptical elements are typically useful for periodic comets or asteroids,
  894. X     and hyperbolic and parabolic elements are for nonrecurring solar system
  895. X     interlopers such as aperiodic comets.
  896. X
  897. X     The parameters for each type of object are stored separately, so you may
  898. X     switch between types of objects without losing parameters.
  899. X
  900. X     7.1.  Controlling Object-X or Y Operation
  901. X
  902. X     To control the type and the corresponding details for object X or Y,
  903. X     select the corresponding row near the bottom.  (Remember that typing the
  904. X     character "x" or "y" is a shorthand way to move to the bottom rows.) It
  905. X     will bring up a quick-choice menu as follows:
  906. X
  907. X     Select: Fixed, Elliptical, Hyperbolic, Parabolic, Lookup, On
  908. X
  909. X
  910. X     When you first enter the quick-choice menu the cursor will start out
  911. X     positioned at the field for the current type of object.  The first four
  912. X     selections allow you to enter or review the various parameters required to
  913. X     define an object's position of the respective type, one parameter at a
  914. X     time.
  915. X
  916. X     You set the current object type and begin to view its parameters by
  917. X     positioning the cursor over the type and pressing RETURN.  The prompt for
  918. X     each item includes a short description, the units to use, and its current
  919. X     setting is shown in parentheses. To leave the item unchanged and go to the
  920. X     next item, type RETURN.  If you do not wish to change or see any more
  921. X     items about the object then type "q" and you will return immediately to
  922. X     the object-X quick-choice menu.
  923. X
  924. X     You exit the quick-choice menu by typing "q" while over any field or
  925. X     RETURN while over On or Off, as described in a later section.
  926. X
  927. X
  928. X
  929. X
  930. X
  931. X
  932. X
  933. X
  934. X
  935. X                                       - 14 -
  936. X
  937. X
  938. X     As with all dates throughout ephem, the dates for the epochs of perihelion
  939. X     and reference epochs may be entered in month/day/year or decimal year
  940. X     formats, and the day may be entered as a real number (see the section on
  941. X     Date and Time Formats).  All dates given for comet parameters are always
  942. X     in UT.
  943. X
  944. X     7.1.1.  Fixed
  945. X
  946. X     This selection will present a series of six prompts to define a fixed
  947. X     object. The prompts are the name, RA, Dec, magnitude, the reference epoch
  948. X     for the coordinates and the angular size in arc seconds.
  949. X
  950. X     7.1.2.  Elliptical
  951. X
  952. X     This will begin a series of 13 prompts asking for a name and the
  953. X     parameters that define a heliocentric elliptic orbit and the coefficients
  954. X     for either of two magnitude models.  These elements are the same ones
  955. X     often listed in the Astronomical Almanac.  The elements are, in order:
  956. X
  957. X             i = inclination, degrees
  958. X             O = longitude of ascending node, degrees
  959. X             o = argument of perihelion, degrees
  960. X             a = mean distance (aka semi-major axis), AU
  961. X             n = daily motion, degrees per day
  962. X             e = eccentricity
  963. X             M = mean anomaly (ie, degrees from perihelion)
  964. X             E = epoch date (ie, time of M)
  965. X             D = the equinox year (ie, time of i/O/o)
  966. X             g/k or H/G  = either of two magnitude models; see below
  967. X             s = angular size at 1 AU, arc seconds
  968. X
  969. X
  970. X     You might have other parameters available that can be converted into
  971. X     these.  The following relationships might be useful:
  972. X
  973. X             P = sqrt(a*a*a)
  974. X             p = O + o
  975. X             n = 360/days_per_year/P ~ 0.98563/P
  976. X             T = E - M/n
  977. X             q = a*(1-e)
  978. X         where
  979. X             P = the orbital period, years;
  980. X             p = longitude of perihelion, degrees
  981. X             T = epoch of perihelion (add multiples of P for desired range)
  982. X             q = perihelion distance, AU
  983. X
  984. X     Note that if you know T you can then set E = T and M = 0.
  985. X
  986. X     7.1.3.  Hyperbolic
  987. X
  988. X     This will begin a series of 11 prompts asking for a name and the
  989. X     parameters that define a heliocentric hyperbolic orbit and the magnitude
  990. X     model coefficients.  These orbital parameters are, in order:
  991. X
  992. X
  993. X
  994. X
  995. X
  996. X
  997. X
  998. X
  999. X
  1000. X
  1001. X                                       - 15 -
  1002. X
  1003. X
  1004. X
  1005. X             T = epoch of perihelion
  1006. X             i = inclination, degrees
  1007. X             O = longitude of ascending node, degrees
  1008. X             o = argument of perihelion, degrees
  1009. X             e = eccentricity,
  1010. X             q = perihelion distance, AU
  1011. X             D = the equinox year (ie, time of i/O/o).
  1012. X             g/k = magnitude model
  1013. X             s = angular size at 1 AU, arc seconds
  1014. X
  1015. X     As with elliptical elements, other parameters might be available.  The
  1016. X     relationships are generally the same, except for:
  1017. X
  1018. X             q = a*(e-1)
  1019. X
  1020. X
  1021. X     7.1.4.  Parabolic
  1022. X
  1023. X     This will begin a series of 10 prompts asking for a name and the
  1024. X     parameters that define a heliocentric parabolic orbit and the magnitude
  1025. X     model coefficients.  These orbital parameters are, in order:
  1026. X
  1027. X             T = epoch of perihelion
  1028. X             i = inclination, degrees
  1029. X             o = argument of perihelion, degrees
  1030. X             q = perihelion distance, AU
  1031. X             O = longitude of ascending node, degrees
  1032. X             D = the equinox year (ie, time of i/O/o).
  1033. X             g/k = magnitude model
  1034. X             s = angular size at 1 AU, arc seconds
  1035. X
  1036. X
  1037. X     7.1.5.  Lookup
  1038. X
  1039. X     This option displays the name of each object in the database file.  Move
  1040. X     around the list (using the usual hjkl or arrow keys) and type RETURN to
  1041. X     select an object. The cursor wraps around all edges.  If there is more
  1042. X     than one page of entries, you may view the next or previous pages by
  1043. X     typing "n" or "p", respectively. Typing "q" will exit the lookup function
  1044. X     with no net effect.
  1045. X
  1046. X     If successful, the cursor will move to the type of the new object and it
  1047. X     becomes the current type.
  1048. X
  1049. X     7.1.6.  On or Off
  1050. X
  1051. X     The last selection on the right toggles the calculations for the object On
  1052. X     and Off.  It toggles when selected with RETURN and then immediately exits
  1053. X     the quick-choice menu back to the main menu.  If calculations become On,
  1054. X     then they will be performed for the current type of object; if they become
  1055. X     Off the object-X or Y row of information will be erased.
  1056. X
  1057. X
  1058. X
  1059. X
  1060. X
  1061. X
  1062. X
  1063. X
  1064. END_OF_FILE
  1065.   if test 41589 -ne `wc -c <'Man.txt.a'`; then
  1066.     echo shar: \"'Man.txt.a'\" unpacked with wrong size!
  1067.   fi
  1068.   # end of 'Man.txt.a'
  1069. fi
  1070. if [ -f Man.txt.b ]
  1071. then
  1072.         echo adding Man.txt.a to Man.txt.b to form Man.txt
  1073.         cat Man.txt.a Man.txt.b > Man.txt
  1074.         echo removing Man.txt.a and Man.txt.b
  1075.         rm Man.txt.a Man.txt.b
  1076. fi
  1077. if test -f 'riset_c.c' -a "${1}" != "-c" ; then 
  1078.   echo shar: Will not clobber existing file \"'riset_c.c'\"
  1079. else
  1080.   echo shar: Extracting \"'riset_c.c'\" \(8283 characters\)
  1081.   sed "s/^X//" >'riset_c.c' <<'END_OF_FILE'
  1082. X/* find rise and set circumstances, ie, riset_cir() and related functions. */
  1083. X
  1084. X#include <stdio.h>
  1085. X#include <math.h>
  1086. X#include "astro.h"
  1087. X#include "circum.h"
  1088. X#include "screen.h"    /* just for SUN and MOON */
  1089. X
  1090. X#define    TRACE(x)    {FILE *fp = fopen("trace","a"); fprintf x; fclose(fp);}
  1091. X
  1092. X#define    STDREF    degrad(34./60.)    /* nominal horizon refraction amount */
  1093. X#define    TWIREF    degrad(18.)    /* twilight horizon displacement */
  1094. X#define    TMACC    (15./3600.)    /* convergence accuracy, hours */
  1095. X
  1096. X/* find where and when a body, p, will rise and set and
  1097. X *   it's transit circumstances. all times are local, angles rads e of n.
  1098. X * return 0 if just returned same stuff as previous call, else 1 if new.
  1099. X * status is set from the RS_* #defines in circum.h.
  1100. X * also used to find astro twilight by calling with hzn TWILIGHT.
  1101. X */
  1102. Xriset_cir (p, np, force, hzn, ltr, lts, ltt, azr, azs, altt, status)
  1103. Xint p;        /* one of the body defines in astro.h or screen.h */
  1104. XNow *np;
  1105. Xint force;    /* set !=0 to force computations */
  1106. Xint hzn;    /* STDHZN or ADPHZN or TWILIGHT */
  1107. Xdouble *ltr, *lts; /* local rise and set times */
  1108. Xdouble *ltt;    /* local transit time */
  1109. Xdouble *azr, *azs; /* local rise and set azimuths, rads e of n */
  1110. Xdouble *altt;    /* local altitude at transit */
  1111. Xint *status;    /* one or more of the RS_* defines */
  1112. X{
  1113. X    typedef struct {
  1114. X        Now l_now;
  1115. X        double l_ltr, l_lts, l_ltt, l_azr, l_azs, l_altt;
  1116. X        int l_hzn;
  1117. X        int l_status;
  1118. X    } Last;
  1119. X    /* must be in same order as the astro.h/screen.h #define's */
  1120. X    static Last last[NOBJ] = {
  1121. X        {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD},
  1122. X        {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD}, {NOMJD}
  1123. X    };
  1124. X    Last *lp;
  1125. X    int new;
  1126. X
  1127. X    lp = last + p;
  1128. X    if (!force && same_cir (np, &lp->l_now) && same_lday (np, &lp->l_now)
  1129. X                        && lp->l_hzn == hzn) {
  1130. X        *ltr = lp->l_ltr;
  1131. X        *lts = lp->l_lts;
  1132. X        *ltt = lp->l_ltt;
  1133. X        *azr = lp->l_azr;
  1134. X        *azs = lp->l_azs;
  1135. X        *altt = lp->l_altt;
  1136. X        *status = lp->l_status;
  1137. X        new = 0;
  1138. X    } else {
  1139. X        *status = 0;
  1140. X        iterative_riset (p, np, hzn, ltr, lts, ltt, azr, azs, altt, status);
  1141. X        lp->l_ltr = *ltr;
  1142. X        lp->l_lts = *lts;
  1143. X        lp->l_ltt = *ltt;
  1144. X        lp->l_azr = *azr;
  1145. X        lp->l_azs = *azs;
  1146. X        lp->l_altt = *altt;
  1147. X        lp->l_status = *status;
  1148. X        lp->l_hzn = hzn;
  1149. X        lp->l_now = *np;
  1150. X        new = 1;
  1151. X    }
  1152. X    return (new);
  1153. X}
  1154. X
  1155. Xstatic
  1156. Xiterative_riset (p, np, hzn, ltr, lts, ltt, azr, azs, altt, status)
  1157. Xint p;
  1158. XNow *np;
  1159. Xint hzn;
  1160. Xdouble *ltr, *lts, *ltt;    /* local times of rise, set and transit */
  1161. Xdouble *azr, *azs, *altt;/* local azimuths of rise, set and transit altitude */
  1162. Xint *status;
  1163. X{
  1164. X#define    MAXPASSES    6
  1165. X    double lstr, lsts, lstt; /* local sidereal times of rising/setting */
  1166. X    double mjd0;        /* mjd estimates of rise/set event */
  1167. X    double lnoon;        /* mjd of local noon */
  1168. X    double x;        /* discarded tmp value */
  1169. X    Now n;            /* just used to call now_lst() */
  1170. X    double lst;        /* lst at local noon */
  1171. X    double diff, lastdiff;    /* iterative improvement to mjd0 */
  1172. X    int pass;
  1173. X    int rss;
  1174. X
  1175. X    /* first approximation is to find rise/set times of a fixed object
  1176. X     * in its position at local noon.
  1177. X     */
  1178. X    lnoon = mjd_day(mjd - tz/24.0) + (12.0 + tz)/24.0; /*mjd of local noon*/
  1179. X    n.n_mjd = lnoon;
  1180. X    n.n_lng = lng;
  1181. X    now_lst (&n, &lst);    /* lst at local noon */
  1182. X    mjd0 = lnoon;
  1183. X    stationary_riset (p,mjd0,np,hzn,&lstr,&lsts,&lstt,&x,&x,&x,&rss);
  1184. X    chkrss:
  1185. X    switch (rss) {
  1186. X    case  0:  break;
  1187. X    case  1: *status = RS_NEVERUP; return;
  1188. X    case -1: *status = RS_CIRCUMPOLAR; goto transit;
  1189. X    default: *status = RS_ERROR; return;
  1190. X    }
  1191. X
  1192. X    /* find a better approximation to the rising circumstances based on
  1193. X     * more passes, each using a "fixed" object at the location at
  1194. X     * previous approximation of the rise time.
  1195. X     */
  1196. X    lastdiff = 1000.0;
  1197. X    for (pass = 1; pass < MAXPASSES; pass++) {
  1198. X        diff = (lstr - lst)*SIDRATE; /* next guess at rise time wrt noon */
  1199. X        if (diff > 12.0)
  1200. X        diff -= 24.0*SIDRATE;    /* not tomorrow, today */
  1201. X        else if (diff < -12.0)
  1202. X        diff += 24.0*SIDRATE;    /* not yesterday, today */
  1203. X        mjd0 = lnoon + diff/24.0;    /* next guess at mjd of rise */
  1204. X        stationary_riset (p,mjd0,np,hzn,&lstr,&x,&x,azr,&x,&x,&rss);
  1205. X        if (rss != 0) goto chkrss;
  1206. X        if (fabs (diff - lastdiff) < TMACC)
  1207. X        break;
  1208. X        lastdiff = diff;
  1209. X    }
  1210. X    if (pass == MAXPASSES)
  1211. X        *status |= RS_NORISE;    /* didn't converge - no rise today */
  1212. X    else {
  1213. X        *ltr = 12.0 + diff;
  1214. X        if (p != MOON &&
  1215. X            (*ltr <= 24.0*(1.0-SIDRATE) || *ltr >= 24.0*SIDRATE))
  1216. X        *status |= RS_2RISES;
  1217. X    }
  1218. X
  1219. X    /* find a better approximation to the setting circumstances based on
  1220. X     * more passes, each using a "fixed" object at the location at
  1221. X     * previous approximation of the set time.
  1222. X     */
  1223. X    lastdiff = 1000.0;
  1224. X    for (pass = 1; pass < MAXPASSES; pass++) {
  1225. X        diff = (lsts - lst)*SIDRATE; /* next guess at set time wrt noon */
  1226. X        if (diff > 12.0)
  1227. X        diff -= 24.0*SIDRATE;    /* not tomorrow, today */
  1228. X        else if (diff < -12.0)
  1229. X        diff += 24.0*SIDRATE;    /* not yesterday, today */
  1230. X        mjd0 = lnoon + diff/24.0;    /* next guess at mjd of set */
  1231. X        stationary_riset (p,mjd0,np,hzn,&x,&lsts,&x,&x,azs,&x,&rss);
  1232. X        if (rss != 0) goto chkrss;
  1233. X        if (fabs (diff - lastdiff) < TMACC)
  1234. X        break;
  1235. X        lastdiff = diff;
  1236. X    }
  1237. X    if (pass == MAXPASSES)
  1238. X        *status |= RS_NOSET;    /* didn't converge - no set today */
  1239. X    else {
  1240. X        *lts = 12.0 + diff;
  1241. X        if (p != MOON &&
  1242. X            (*lts <= 24.0*(1.0-SIDRATE) || *lts >= 24.0*SIDRATE))
  1243. X        *status |= RS_2SETS;
  1244. X    }
  1245. X
  1246. X    transit:
  1247. X    /* find a better approximation to the transit circumstances based on
  1248. X     * more passes, each using a "fixed" object at the location at
  1249. X     * previous approximation of the transit time.
  1250. X     */
  1251. X    lastdiff = 1000.0;
  1252. X    for (pass = 1; pass < MAXPASSES; pass++) {
  1253. X        diff = (lstt - lst)*SIDRATE; /*next guess at transit time wrt noon*/
  1254. X        if (diff > 12.0)
  1255. X        diff -= 24.0*SIDRATE;    /* not tomorrow, today */
  1256. X        else if (diff < -12.0)
  1257. X        diff += 24.0*SIDRATE;    /* not yesterday, today */
  1258. X        mjd0 = lnoon + diff/24.0;    /* next guess at mjd of transit */
  1259. X        stationary_riset (p,mjd0,np,hzn,&x,&x,&lstt,&x,&x,altt,&rss);
  1260. X        if (fabs (diff - lastdiff) < TMACC)
  1261. X        break;
  1262. X        lastdiff = diff;
  1263. X    }
  1264. X    if (pass == MAXPASSES)
  1265. X        *status |= RS_NOTRANS;    /* didn't converge - no transit today */
  1266. X    else {
  1267. X        *ltt = 12.0 + diff;
  1268. X        if (p != MOON &&
  1269. X            (*ltt <= 24.0*(1.0-SIDRATE) || *ltt >= 24.0*SIDRATE))
  1270. X        *status |= RS_2TRANS;
  1271. X    }
  1272. X}
  1273. X
  1274. Xstatic
  1275. Xstationary_riset (p, mjd0, np, hzn, lstr, lsts, lstt, azr, azs, altt, status)
  1276. Xint p;
  1277. Xdouble mjd0;
  1278. XNow *np;
  1279. Xint hzn;
  1280. Xdouble *lstr, *lsts, *lstt;
  1281. Xdouble *azr, *azs, *altt;
  1282. Xint *status;
  1283. X{
  1284. X    extern void bye();
  1285. X    double dis;
  1286. X    Now n;
  1287. X    Sky s;
  1288. X
  1289. X    /* find object p's topocentric ra/dec at mjd0
  1290. X     * (this must include parallax)
  1291. X     */
  1292. X    n = *np;
  1293. X    n.n_mjd = mjd0;
  1294. X    (void) body_cir (p, 0.0, &n, &s);
  1295. X    if (epoch != EOD)
  1296. X        precess (epoch, mjd0, &s.s_ra, &s.s_dec);
  1297. X    if (s.s_edist > 0) {
  1298. X        /* parallax, if we can */
  1299. X        double ehp, lst, ha;
  1300. X        if (p == MOON)
  1301. X        ehp = asin (6378.14/s.s_edist);
  1302. X        else
  1303. X        ehp = (2.*6378./146e6)/s.s_edist;
  1304. X        now_lst (&n, &lst);
  1305. X        ha = hrrad(lst) - s.s_ra;
  1306. X        ta_par (ha, s.s_dec, lat, height, ehp, &ha, &s.s_dec);
  1307. X        s.s_ra = hrrad(lst) - ha;
  1308. X        range (&s.s_ra, 2*PI);
  1309. X    }
  1310. X
  1311. X    switch (hzn) {
  1312. X    case STDHZN:
  1313. X        /* nominal atmospheric refraction.
  1314. X         * then add nominal moon or sun semi-diameter, as appropriate.
  1315. X         * other objects assumes to be negligibly small.
  1316. X         */
  1317. X        dis = STDREF;
  1318. X        if (p == MOON || p == SUN)
  1319. X        dis += degrad (32./60./2.);
  1320. X        break;
  1321. X    case TWILIGHT:
  1322. X        if (p != SUN) {
  1323. X        f_msg ("Non-sun twilight bug!");
  1324. X        bye();
  1325. X        }
  1326. X        dis = TWIREF;
  1327. X        break;
  1328. X    case ADPHZN:
  1329. X        /* adaptive includes actual refraction conditions and also
  1330. X         * includes object's semi-diameter.
  1331. X         */
  1332. X        unrefract (pressure, temp, 0.0, &dis);
  1333. X        dis = -dis;
  1334. X        dis += degrad(s.s_size/3600./2.0);
  1335. X        break;
  1336. X    }
  1337. X
  1338. X    riset (s.s_ra, s.s_dec, lat, dis, lstr, lsts, azr, azs, status);
  1339. X    transit (s.s_ra, s.s_dec, np, lstt, altt);
  1340. X}
  1341. X
  1342. X
  1343. X/* find when and how hi object at (r,d) is when it transits. */
  1344. Xstatic
  1345. Xtransit (r, d, np, lstt, altt)
  1346. Xdouble r, d;    /* ra and dec, rads */
  1347. XNow *np;    /* for refraction info */
  1348. Xdouble *lstt;    /* local sidereal time of transit */
  1349. Xdouble *altt;    /* local, refracted, altitude at time of transit */
  1350. X{
  1351. X    *lstt = radhr(r);
  1352. X    *altt = PI/2 - lat + d;
  1353. X    if (*altt > PI/2)
  1354. X        *altt = PI - *altt;
  1355. X    refract (pressure, temp, *altt, altt);
  1356. X}
  1357. END_OF_FILE
  1358.   if test 8283 -ne `wc -c <'riset_c.c'`; then
  1359.     echo shar: \"'riset_c.c'\" unpacked with wrong size!
  1360.   fi
  1361.   # end of 'riset_c.c'
  1362. fi
  1363. echo shar: End of archive 1 \(of 9\).
  1364. cp /dev/null ark1isdone
  1365. MISSING=""
  1366. for I in 1 2 3 4 5 6 7 8 9 ; do
  1367.     if test ! -f ark${I}isdone ; then
  1368.     MISSING="${MISSING} ${I}"
  1369.     fi
  1370. done
  1371. if test "${MISSING}" = "" ; then
  1372.     echo You have unpacked all 9 archives.
  1373.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1374. else
  1375.     echo You still must unpack the following archives:
  1376.     echo "        " ${MISSING}
  1377. fi
  1378. exit 0
  1379. exit 0 # Just in case...
  1380.