home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-04-06 | 57.3 KB | 2,226 lines |
- Newsgroups: comp.sources.misc
- subject: v11i100: upgrade kit for ephem 4.12 to 4.13
- From: ecd@cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 11, Issue 100
- Submitted-by: ecd@cs.umn.edu@ncs-med.UUCP (Elwood C. Downey)
- Archive-name: ephem4.13/part01
-
- [Invasion of the non-context diffs! ++bsa]
-
- Here is an update to ephem, my interactive astronomical ephemeris program.
- It converts v4.12 to v4.13. The changes include:
-
- add support for second user-defined object, "object y".
- fix bug updating object x reference epoch (always used PARABOLIC's).
- fix Turbo C workaround that prevented plotting sun distance.
- fix bug preventing searching on separation column for objx.
- revamp elliptical object definition parameters to match Astro Almanac.
- permit exiting/redrawing properly from within a popup too.
- add a bit more precision to plot labels.
- let plot files have comments too, ie, leading *'s
- add separate database and "Lookup" facility for objects.
- catch SIGFPE and longjmp() back into main interation loop on errors.
- add magnitude to fixed-object database fields.
-
- This update is basically a "diff -e" between 4.12 and 4.13. To use this upgrade
- kit:
- put all the original source to 4.12 into a directory.
- extract the included shell archive to create:
- Ephem_4.12-13
- ephem.db
- ell_e-ephem
- par_e-ephem
- sac-ephem
- star-ephem
- run the upgrade script:
- sh < Ephem_4.12-13
- this will make all the necessary changes IN PLACE. then you should
- rebuild ephem, keeping the same site configuration changes in mind you
- made when you built 4.12.
-
- Note the new database file, ephem.db. This is a new feature that contains
- objects ephem uses to set up the used defined objects. You may modify the
- list as desired. To assist with this, I have also included four simple
- awk-based scripts that will convert from several popular formats into
- the form needed by ephem.db. ell_e-ephem and par_e-ephem convert
- starchart/observe elliptical and parabolic objects (*.ell_e and *.par_e
- files), sac-ephem converts from the Saguaro Astronomy Club deep-sky
- database, and star-ephem converts from the Yale.star database.
-
- Good luck, enjoy, and please contact me if you have any problems,
- suggestions, or comments.
-
- Elwood Downey
- 612-936-8508
- {most any university}!umn-cs!ncs-med!ecd
- (umn-cs is U. of Minnesota, CS Dept)
- (sorry, no uunet address for me at ncs-med)
- -----------------------------------------------------------------------------
- # This is the first line of a "shell archive" file.
- # This means it contains several files that can be extracted into
- # the current directory when run with the sh shell, as follows:
- # sh < this_file_name
- # This is file 1.
- echo x Ephem_4.12-13
- sed -e 's/^X//' << 'EOFxEOF' > D
- Xed - Man.txt << '-*-END-*-'
- X1565,1575c
- X
- X
- X.
- X1554,1563d
- X1552d
- X1527,1548d
- X1525d
- X1522d
- X1471,1492c
- X
- X.
- X1469d
- X1437,1458d
- X1434a
- X - 24 -
- X.
- X1397a
- X add search criteria for database objects.
- X.
- X1381,1392d
- X1358,1359d
- X1356c
- X - 23 -
- X.
- X1352,1354d
- X1349d
- X1347d
- X1345d
- X1339,1343d
- X1335,1337d
- X1333d
- X1331d
- X1329d
- X1327d
- X1325a
- X n is a number between -23 to 24 indicating the number of hours that are
- X subtracted from GMT to obtain local standard time;
- X.
- X1324c
- X SSS is the 3-letter abbreviation for the local standard timezone;
- X.
- X1322a
- X where
- X.
- X1321a
- X set TZ=SSSnDDD
- X.
- X1320a
- X Before running ephem, you should set a DOS environment variable, TZ. It
- X is is used to establish the timezone name and hours offset whenever the
- X "Now" shorthand is used from ephem, either from the configuration startup
- X file or whenever any time field is changed manually. Set it in the
- X following form:
- X.
- X1319a
- X 12.1. Setting TZ
- X.
- X1318a
- X The distribution floppy contains five files:
- X README describes last minute items and details of this release.
- X MAN.TXT is this manual, hopefully formatted and printable on most any
- X printer.
- X EPHEM.EXE is the executable program.
- X EPHEM.CFG is a sample configuration file.
- X EPHEM.DB is a sample database.
- X To run the program, make working copies of these files in a directory and
- X run "ephem" from that directory.
- X.
- X1317a
- X You must be running DOS V2.0 or later, though somewhere between V2.0 and
- X V3.21 the behavior of control-c to terminate the program was fixed. An
- X 8087 floating point chip will be used if present.
- X.
- X1316a
- X 12. DOS Installation Procedure
- X.
- X1315a
- X The maximum file name length is 14 characters.
- X.
- X1314a
- X No more than 10 lines may be plotted at once.
- X.
- X1303a
- X
- X
- X
- X
- X
- X
- X
- X
- X - 22 -
- X
- X
- X Beware of specifying a year of 0, or of computing with the user-defined
- X objects before they are properly defined. These conditions can cause ephem
- X to blow.
- X
- X.
- X1292,1293c
- X traditional K&R C compilers and the search functions seem to be are far
- X more stable.
- X.
- X1287,1288c
- X used TDT but I have not yet decided on a suitable algorithm. Allowing for
- X this manually, (see the Wish List section) comparisons with the
- X Astronomical Almanac are often within a few arcseconds.
- X.
- X1258,1260d
- X1256a
- X Similarly, ephem's searching techniques are not good for eclipses because
- X the moon and sun are close every month; the trick is sorting through the
- X frequent conjunctions for ones that are particularly close. One needs a
- X way of establishing an envelope fit to the local extrema of a cyclic
- X function in order to find a more global extreme.
- X.
- X1255a
- X first use the plotting or watching facility of ephem to get a broad
- X picture of the general circumstances then use ephem's search facility to
- X refine a given region (or create and inspect a plot file and do your own
- X interpolation directly from it separately).
- X.
- X1253a
- X - 21 -
- X.
- X1241,1245d
- X1236,1239d
- X1194a
- X To try the former approach select Search, select "Find 0", specify the
- X.
- X1193a
- X As an example, let's find when Pluto again becomes the furthest planet
- X from Sol. You may find when the difference in their sun distance is zero,
- X or you might use a binary search on the condition that Pluto's sun
- X distance is larger then Neptune's.
- X.
- X1192c
- X 10.7. Example Searches
- X.
- X1190a
- X If searching is on, this option will also appear on the quick-choice menu
- X and may be selected to turn off the search.
- X.
- X1189a
- X 10.6. Stop
- X.
- X1187a
- X - 20 -
- X.
- X1182d
- X1177,1180d
- X1175d
- X1172,1173d
- X1170d
- X1118,1128d
- X1104a
- X
- X
- X
- X
- X
- X
- X - 19 -
- X
- X
- X.
- X1077,1079c
- X be unique; use "x" or "y" for the user-specified object X or Y. The
- X column_name is from the following table, depending on which menu is up. In
- X all cases additional characters may be entered but are ignored.
- X.
- X1052,1062d
- X1036a
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X - 18 -
- X
- X
- X.
- X996a
- X You may set NStep to be quite large and let ephem search unattended or set
- X.
- X995a
- X Ephem can search for arbitrary conditions to exist among most displayed
- X fields. You first enter a function, then select from among three forms of
- X equation solvers to iteratively solve for the next time when the function
- X meets the requirements of the solver. The solver selects the next time for
- X which it wants the function evaluated and sets StpSz so that the next
- X iteration will occur at that time. The solvers continue to iterate until
- X either they achieve their goal or NStep reaches 0.
- X.
- X994c
- X 10. Searching
- X.
- X992a
- X When you return to the main menu, the last watched time will be maintained
- X as the current time. The StpSz is not changed.
- X.
- X990a
- X - 17 -
- X.
- X984d
- X976,982d
- X974d
- X971,972d
- X952,955c
- X to roughly fill the screen according to the outer-most active planet. The
- X screen transformation assumes a screen aspect width/height ratio of 4/3.
- X Down the left column of the screen is the heliocentric altitude of the
- X planet above or below the ecliptic, drawn to the same scale as the
- X.
- X938c
- X 9.2. Sky
- X.
- X930a
- X
- X.
- X929a
- X Select: Sky, Solar system, No trails
- X.
- X928c
- X You may generate a simple drawing on the screen of the sky or the solar
- X system by selecting "Watch". It will bring up a quick-choice menu as
- X follows:
- X.
- X926a
- X 9. Watching
- X.
- X925a
- X Note that due to internal buffering the plot file will not be completely
- X written to disk until plotting is turned off.
- X.
- X924a
- X by selecting "Begin plotting" again.
- X.
- X922a
- X - 16 -
- X.
- X917d
- X913,915d
- X911d
- X908,909d
- X906d
- X853,864d
- X839a
- X
- X
- X
- X
- X
- X
- X
- X
- X - 15 -
- X
- X
- X.
- X810a
- X 7.2. Database File
- X
- X You may save a list of objects in a file to be used for setting OBJX and
- X OBJY. The default name of this file is ephem.db. You may also set it from
- X the command line with the -d option, or set it with the EPHEMDB
- X environment variable.
- X
- X The file consists of one object per line. Lines that begin with an
- X asterisk (*) are ignored. Each line contains several fields, each
- X separated by a comma. The first field is the name of the object. The
- X second field is the type of the object, that is, one of the strings
- X "fixed", "elliptical", or "parabolic"; actually, "f", "e" and "p" are
- X sufficient. The remaining fields depend on the type of object. They are
- X exactly the same parameters, and in the same order, as ephem asks for when
- X defining the object from the menu.
- X
- X.
- X809c
- X Off the object-X or Y row of information will be erased.
- X.
- X804a
- X
- X
- X
- X
- X - 14 -
- X
- X
- X becomes the current type.
- X
- X 7.1.5. On or Off
- X
- X.
- X803d
- X799,801d
- X796d
- X794a
- X If successful, the cursor will move to the type of the new object and it
- X.
- X793a
- X This option lets you define an object from any of those listed in the
- X database file, described in a subsequent section.
- X.
- X792a
- X 7.1.4. Lookup
- X.
- X791a
- X Note that this model does not take into account the phase angle of
- X sunlight on the comet.
- X.
- X790a
- X m = g + 5*log10(D) + 2.5*k*log10(r)
- X where:
- X m is the resulting visual magnitude;
- X g is the absolute visual magnitude;
- X D is the comet-earth distance, in AU;
- X k is the luminosity index; and
- X r is the comet-sun distance.
- X.
- X789a
- X A simple magnitude model is used to estimate the brightness of comets.
- X This model requires two parameters to be specified. One, the absolute
- X magnitude, is the visual magnitude of the comet if it were one AU from
- X both the sun and the earth, denoted g. The other, the luminosity index,
- X characterizes the brightness change of the comet as a function of its
- X distance from the sun, denoted k. The model may be expressed as:
- X.
- X787a
- X epoch of perihelion,
- X inclination,
- X argument of perihelion,
- X perihelion distance,
- X longitude of the ascending node,
- X and the reference epoch of the parameters.
- X absolute magnitude, g
- X luminosity index coefficients, k
- X.
- X785,786c
- X These orbital parameters are, in order:
- X.
- X782a
- X
- X You might have other parameters available that can be converted into
- X these. For example, we have the following relationships:
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X - 13 -
- X
- X
- X P = sqrt(a*a*a)
- X p = O + o
- X n = 360/days_per_year/P ~ 0.98563/P
- X T = E - M/n
- X q = a*(1-e)
- X where
- X P = the orbital period, years;
- X p = longitude of perihelion, degrees
- X n = daily motion, degrees per day;
- X T = epoch of perihelion (add multiples of P for desired range)
- X q = perihelion distance, AU
- X
- X Note that if you know T you can then set E = T and M = 0.
- X
- X 7.1.3. Parabolic
- X
- X.
- X781c
- X i = inclination, degrees
- X O = longitude of ascending node, degrees
- X o = argument of perihelion, degrees
- X a = mean distance (aka semi-major axis), AU
- X n = daily motion, degrees per day
- X e = eccentricity,
- X M = mean anomaly (ie, degrees from perihelion),
- X E = epoch date (ie, time of M),
- X D = the equinox year (ie, time of i/O/o).
- X H = absolute magnitude
- X G = magnitude slope parameter.
- X.
- X776,779c
- X These elements are the same ones often listed in the Astronomical Almanac.
- X The elements are, in order:
- X.
- X774c
- X This will begin a series of eleven prompts asking for the parameters that
- X.
- X772c
- X 7.1.2. Elliptical
- X.
- X769,770c
- X This selection will present a series of four prompts, one each for the RA,
- X Dec, magnitude and the reference epoch for the coordinates of a fixed
- X object.
- X.
- X767c
- X 7.1.1. Fixed
- X.
- X749,750c
- X define an object's position of such type, one parameter at a time.
- X
- X You set the current object type and begin to view its parameters by
- X.
- X738,746d
- X736d
- X733,734c
- X - 12 -
- X.
- X730d
- X722a
- X When you first enter the quick-choice menu the cursor will start out
- X.
- X720a
- X Select: Fixed, Elliptical, Parabolic, Lookup, On
- X.
- X718,719c
- X To control the type and the corresponding details for object X or Y,
- X select the corresponding row near the bottom. (Remember that typing the
- X character "x" or "y" is a shorthand way to move to the bottom rows.) It
- X will bring up a quick-choice menu as follows:
- X.
- X710,716c
- X 7.1. Controlling Object-X or Y Operation
- X.
- X703,708c
- X The parameters for each type of object are stored separately, so you may
- X switch between types of objects without losing parameters.
- X.
- X696,698c
- X You may specify one or two extra objects for ephem to use. The objects may
- X be defined in three different ways: fixed celestial sphere coordinates,
- X or heliocentric elliptical or parabolic orbital elements. Elliptical
- X.
- X694c
- X 7. User Defined Objects: X and Y
- X.
- X666a
- X 6. Menu options
- X
- X When you select "Menu" you can change among the three styles of bottom
- X screens. There are also two options that can be set from the Menu quick-
- X.
- X663a
- X
- X
- X.
- X653,654d
- X651d
- X627,635d
- X625a
- X OBJX=Austin
- X OBJY=Ceres
- X.
- X623,624c
- X PROPTS=TSMevmjsunpxy
- X EPOCH=2000
- X.
- X612,614c
- X UT=0:0:0
- X UD=3/21/1990
- X.
- X601,604c
- X exactly the set specified. This feature was added so that the
- X command line version of using PROPTS could add to the set of
- X planets giving in the configuration file.
- X NSTEP number of times program will loop before entering command mode.
- X see the discussion under Program Operation.
- X EPOCH this sets the desired ra/dec precession epoch. you can put any
- X date here or EOD to use the current instant ("Epoch of Date").
- X OBJX
- X OBJY These fields specify the optional objects "x" and "y" by naming
- X any item in the database file. The form is OBJX=xyz, where xyz
- X must be in the database file, case sensitive. You may define
- X one object of each type for each of OBJX and OBJY; the last one
- X defined will be the "current" one when ephem gets going.
- X.
- X574,588d
- X567a
- X y circumstances for object Y
- X.
- X534c
- X 5.1. Configuration File fields
- X UD initial UTC date, such as 10/20/1988, or "NOW" to use the
- X computer clock.
- X.
- X532c
- X Note: because of the way unspecified time and date components are left
- X unchanged (see section on Date and Time Formats) always specify the
- X complete time and date for all entries in the configuration file. For
- X example, to initialize the longitude to zero degrees, say 0:0:0, not just
- X 0.
- X.
- X530a
- X Blank lines and lines that begin with an asterisk (*) or whitespace (space
- X or tab) are ignored and may be used for comments.
- X.
- X529a
- X assumed to start one character after the KEYWORD, regardless.
- X.
- X527a
- X - 9 -
- X.
- X519,521d
- X513,517d
- X510,511d
- X508d
- X502c
- X looks for a configuration file there with the name .ephemrc.
- X.
- X498c
- X ephem -c <config_file>
- X.
- X494c
- X You may have several different configuration files if you wish. By
- X.
- X458,468d
- X442a
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X
- X - 8 -
- X
- X
- X.
- X441a
- X Unfortunately, with the format "ddd:mm", there is not enough room for a
- X space between columns when the angle is at least 100 degrees. To avoid
- X this, I drop the minutes portion if the (rounded) angle is at least 100
- X degrees.
- X.
- X417,425c
- X Rise Time
- X Rise Az The local time and azimuth when the upper limb of the object
- X rises.
- X Transit Time
- X Transit Alt The local time and altitude when the object crosses the
- X meridian, ie, when its azimuth is true south or, if no
- X precession, when the local sidereal time equals the object's
- X right ascension.
- X Set Time
- X Set Az The local time and azimuth when the upper limb of the object
- X sets.
- X Hours Up The number of hours the object is up on the local date.
- X.
- X402a
- X Elong(p) spherical angular separation between sun and given object,
- X calculated from the their geocentric ecliptic coordinates.
- X Note this is not just difference in ecliptic longitude. The
- X sign, however, is simply sign(obj's longitude - sun's
- X longitude), ie, degrees east. thus, a positive elongation
- X means the object rises after the sun.
- X.
- X399a
- X
- X.
- X384,389d
- X380c
- X H Lat(p) true heliocentric latitude, in degrees.
- X.
- X378c
- X H Long(p) true heliocentric longitude, in degrees. Earth's is
- X.
- X362,364c
- X to set to epoch of date.
- X.
- X336a
- X Plot controls plotting; see complete discussion below.
- X Menu controls which menu is in the bottom half of the screen.
- X See their complete discussion below.
- X LST(p) the current local sidereal time. set to "n" to set from
- X computer clock.
- X Dawn(p) local time when the sun is approximately 18 degrees below
- X the horizon before sunrise.
- X.
- X317,323d
- X277c
- X The planets and two additional objects are displayed in a table in the
- X.
- X270a
- X circumstances, the StpSz value is not added to the first loop. Note also
- X that after a series of loops, NStep is automatically reset to 1 so "q"
- X will do exactly one loop and return you to command mode.
- X
- X To quit the program, type control-d from command mode. For a little more
- X help, type ?. The entire screen may be erased and redrawn with control-l.
- X
- X.
- X267d
- X257,258d
- X253,255d
- X244,247c
- X typing one of the characters SMevmjsunpxy. To avoid conflict with j,
- X jupiter's row must actually be typed as control-j. "x" and "y" are for
- X the user-defined objects X and y on the bottom rows. Also, the characters
- X d, o and z move you to the UT Date, Epoch and StpSz fields immediately, if
- X appropriate.
- X.
- X209,216c
- X several fields. If OBJX or OBJY is set then a database file is also
- X accessed. The default configuration file name is ephem.cfg (or .ephemrc
- X if the HOME environment variable directory if set). The default database
- X file name is ephem.db. The exact format of these files is described
- X below. Then ephem processes any additional command line arguments exactly
- X as if they too came from the configuration file. (See the later section
- X on this manual for a description of the possible entries.) It then draws
- X all fields on the screen with their initial values. The program then
- X loops advancing time each step, by some amount you may control, and
- X updating all fields each loop.
- X.
- X204a
- X ephem [-c <config_file>] [-d <database_file>] [field=value ...]
- X
- X
- X.
- X192d
- X188,190c
- X To run ephem, just type "ephem". You may also specify an alternate
- X configuration file, an alternate database file, and specify initial values
- X for several screen fields. The command line syntax can be summarized as
- X follows:
- X.
- X167,168c
- X One may watch the sky or the solar system with a simple screen-oriented
- X display.
- X.
- X141,144c
- X Ephem is a program that displays ephemerides for all the planets plus any
- X two additional objects. The additional objects may be fixed or specified
- X via heliocentric elliptical or parabolic orbital elements to accommodate
- X solar system objects such as comets or asteroids.
- X.
- X134,135d
- X73,77c
- X 10.9. Caution ..................................................... 20
- X 11. Implementation Notes .......................................... 21
- X 11.1. Program limits .............................................. 22
- X 12. DOS Installation Procedure .................................... 22
- X 12.1. Setting TZ .................................................. 22
- X 13. Wish List ..................................................... 23
- X 14. Sample Screens ................................................ 24
- X.
- X30,60c
- X 7. User Defined Objects: X and Y .................................. 11
- X 7.1. Controlling Object-X or Y Operation .......................... 11
- X 7.1.1. Fixed ...................................................... 12
- X 7.1.2. Elliptical ................................................. 12
- X 7.1.3. Parabolic .................................................. 13
- X 7.1.4. Lookup ..................................................... 13
- X 7.1.5. On or Off .................................................. 14
- X 7.2. Database File ................................................ 14
- X 8. Plotting ....................................................... 14
- X 8.1. Defining plot fields ......................................... 15
- X 8.2. Displaying a plot file ....................................... 15
- X 8.3. Cartesian or Polar coords .................................... 15
- X 8.4. Begin Plotting ............................................... 15
- X 8.5. Stopping Plotting ............................................ 15
- X 9. Watching ....................................................... 16
- X 9.1. Trails ....................................................... 16
- X 9.2. Sky .......................................................... 16
- X 9.3. Solar System ................................................. 16
- X 10. Searching ..................................................... 17
- X 10.1. Find extreme ................................................ 17
- X 10.2. Find 0 ...................................................... 17
- X 10.3. Binary ...................................................... 17
- X 10.4. Define a New function ....................................... 18
- X 10.4.1. Intrinsic functions ....................................... 18
- X 10.4.2. Field Specifiers .......................................... 18
- X 10.4.3. Constants ................................................. 19
- X 10.4.4. Operators ................................................. 19
- X 10.5. Specifying Search Accuracy .................................. 19
- X 10.6. Stop ........................................................ 20
- X 10.7. Example Searches ............................................ 20
- X 10.8. Another Example ............................................. 20
- X.
- X27c
- X 6. Menu options ................................................... 11
- X.
- X25c
- X 5.1. Configuration File fields .................................... 9
- X.
- X23c
- X 4. Date and Time Formats .......................................... 8
- X.
- X7c
- X Ephem V4.13 - April 3, 1990
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - Readme << '-*-END-*-'
- X73,75c
- X will have to hand add string.h or your own extern declarations.
- X.
- X31,45d
- X10c
- X2) changes from 4.10 to 4.12:
- X.
- X8c
- X1) changes from 4.12 to 4.13:
- X add support for second user-defined object, "object y"
- X fix bug updating object x reference epoch (always used PARABOLIC's)
- X fix Turbo C workaround that prevented plotting sun distance.
- X fix bug preventing searching on separation column for objx.
- X revamp elliptical object definition parameters to match Astro Almanac.
- X permit exiting/redrawing properly from within a popup too.
- X add a bit more precision to plot labels.
- X let plot files have comments too, ie, leading *'s
- X add separate database and "Lookup" facility for objects.
- X catch SIGFPE and longjmp() back into main interation loop on errors.
- X add magnitude to fixed-object database fields.
- X.
- X1c
- XGeneral Notes for version 4.13:
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - altmenus.c << '-*-END-*-'
- X388,389c
- X sep = acos(spy*sin(*qy) + cpy*cos(*qy)*cos(px-*qx));
- X dsep = raddeg(sep);
- X if (dsep >= (100.0 - 1.0/60.0/2.0))
- X f_int (row, bodycol[q], "%5d:", dsep);
- X else
- X f_angle (row, bodycol[q], sep);
- X.
- X385,386c
- X if (q != p && (q != OBJX || wantx) && (q != OBJY || wanty)) {
- X double sep, dsep;
- X.
- X364c
- X int wantx = obj_ison(OBJX);
- X int wanty = obj_ison(OBJY);
- X.
- X352a
- X * we are limited to only 5 columns per object. to make it fit, we display
- X * degrees:minutes if less than 100 degrees, otherwise just whole degrees.
- X.
- X271,272c
- X /* always recalc OBJX and Y since we don't know it's the same object */
- X if (!riset_cir (p, np, p==OBJX || p==OBJY, alt2_stdhzn?STDHZN:ADPHZN,
- X <r, <s, <t, &azr, &azs, &altt, &status) && !force)
- X.
- X249,250c
- X f_int (row, col, "%3d", sky.s_phase);
- X.
- X241d
- X237,238c
- X f_double (row, C_MAG, (p==MOON||p==SUN)?"%4.0f":"%4.1f",
- X.
- X234c
- X if (p != OBJX && p != OBJY)
- X.
- X196,198c
- X f_string (R_PLANTAB, C_NEPTUNE, " Nep");
- X f_string (R_PLANTAB, C_PLUTO, "Pluto");
- X f_string (R_PLANTAB, C_OBJX, " X");
- X f_string (R_PLANTAB, C_OBJY, " Y");
- X.
- X188,194c
- X f_string (R_PLANTAB, C_SUN, " Sun");
- X f_string (R_PLANTAB, C_MOON, "Moon");
- X f_string (R_PLANTAB, C_MERCURY, "Merc");
- X f_string (R_PLANTAB, C_VENUS, "Venus");
- X f_string (R_PLANTAB, C_MARS, "Mars");
- X f_string (R_PLANTAB, C_JUPITER, " Jup");
- X f_string (R_PLANTAB, C_SATURN, " Sat");
- X.
- X171,180c
- X f_string (R_PLANTAB, C_RISETM-2, "Rise Time");
- X f_string (R_PLANTAB, C_RISEAZ, "Rise Az");
- X f_string (R_PLANTAB, C_TRANSTM-2, "Trans Time");
- X f_string (R_PLANTAB, C_TRANSALT-1, "Trans Alt");
- X f_string (R_PLANTAB, C_SETTM-1, "Set Time");
- X f_string (R_PLANTAB, C_SETAZ, "Set Az");
- X f_string (R_PLANTAB, C_TUP-1, "Hours Up");
- X.
- X163d
- X160d
- X158d
- X156d
- X154d
- X141,152c
- X f_string (R_PLANTAB, C_RA+2, "R.A.");
- X f_string (R_PLANTAB, C_DEC+2,"Dec");
- X f_string (R_PLANTAB, C_AZ+2, "Az");
- X f_string (R_PLANTAB, C_ALT+2,"Alt");
- X f_string (R_PLANTAB, C_HLONG,"H Long");
- X f_string (R_PLANTAB, C_HLAT, "H Lat");
- X.
- X133c
- X return (nxtpl[p]);
- X.
- X130c
- X if (p < MERCURY || p >= NOBJ)
- X.
- X127c
- X NEPTUNE, PLUTO, OBJX, MOON, MERCURY, OBJY, -1
- X.
- X122,123c
- Xnxtbody(p)
- Xint p;
- X.
- X23c
- X C_URANUS, C_NEPTUNE, C_PLUTO, C_SUN, C_MOON, C_OBJX, C_OBJY
- X.
- X18c
- X R_URANUS, R_NEPTUNE, R_PLUTO, R_SUN, R_MOON, R_OBJX, R_OBJY
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - circum.c << '-*-END-*-'
- X139c
- X (void) riset_cir (SUN,np,0,TWILIGHT,dawn,dusk,&x,&x,&x,&x,status);
- X.
- X95,96c
- X /* obj_cir already returned the apparent magnitude */
- X if (p != OBJX && p != OBJY)
- X.
- X92c
- X sp->s_size = (p != OBJX && p != OBJY) ? dia/rho0 : 0.0;
- X.
- X68,69c
- X if (p == OBJX || p == OBJY)
- X obj_cir(mjd,p,&lpd0,&psi0,&rp0,&rho0,&lam,&bet,&sp->s_mag);
- X.
- X52c
- X if (p != OBJX && p != OBJY && same_cir (np, &lp->l_now)
- X.
- X50c
- X * ALWAYS redo objects x and y.
- X.
- X44a
- X case OBJY: lp = &objylast; break;
- X.
- X35c
- X Last objxlast, objylast;
- X.
- X16c
- X * we always recompute the user-defined objects' position regardless.
- X.
- X2c
- X *(the user defined objects are in obj.c)
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - circum.h << '-*-END-*-'
- X5d
- Xw
- Xq
- X-*-END-*-
- Xed - compiler.c << '-*-END-*-'
- X538a
- X break;
- X case 'x':
- X c = C_OBJX;
- X break;
- X case 'y':
- X c = C_OBJY;
- X.
- X475a
- X case 'y':
- X r = R_OBJY;
- X break;
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - ephem.cfg << '-*-END-*-'
- X15,22c
- XOBJX=Austin
- XOBJY=Vesta
- X.
- X11,12c
- XPROPTS=TSMevmjsunpxy
- XEPOCH=2000
- X.
- X1,2c
- XUT=0:0:0
- XUD=3/21/1990
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - formats.c << '-*-END-*-'
- X186a
- X/* print the given double as a rounded int, with the given format.
- X * this is used to plot full precision, but display far less.
- X * N.B. wouldn't need this if Turbo-C 2.0 handled "%X.0f" correctly.
- X * N.B. caller beware that we really do expect fmt to refer to an int, not
- X * a long for example. also beware of range that implies.
- X */
- Xf_int (row, col, fmt, f)
- Xint row, col;
- Xchar fmt[];
- Xdouble f;
- X{
- X char str[80];
- X int i;
- X
- X (void) flog_log (row, col, f);
- X
- X i = (f < 0) ? (int)(f-0.5) : (int)(f+0.5);
- X sprintf (str, fmt, i);
- X f_string (row, col, str);
- X}
- X
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - main.c << '-*-END-*-'
- X779a
- X break;
- X case rcfpack (R_OBJY, C_OBJ, 0):
- X /* this might change which columns are used so erase all when
- X * returns and redraw if still on.
- X */
- X obj_setup (OBJY);
- X alt_nobody (OBJY);
- X if (obj_ison (OBJY)) {
- X oppl |= 1 << OBJY;
- X print_updating();
- X alt_body (OBJY, 1, &now);
- X } else
- X oppl &= ~(1 << OBJY); /* already erased; just clear flag */
- X.
- X774c
- X if (obj_ison (OBJX)) {
- X.
- X772c
- X obj_setup (OBJX);
- X.
- X655c
- X (void) sscanf (bp, "%lf", &x);
- X.
- X618c
- X (void) sscanf (bp, "%lf", &pressure);
- X.
- X605c
- X (void) sscanf (bp, "%lf", &temp);
- X.
- X594c
- X (void) sscanf (bp, "%d", &nstep);
- X.
- X582c
- X (void) sscanf (bp, "%lf", &height);
- X.
- X342c
- X case 'x': oppl |= (1<<OBJX); obj_on(OBJX); break;
- X case 'y': oppl |= (1<<OBJY); obj_on(OBJY); break;
- X.
- X324c
- X obj_filelookup (OBJX, buf+5);
- X else if (strncmp ("OBJY", buf, 4) == 0)
- X obj_filelookup (OBJY, buf+5);
- X.
- X283,284c
- X char why[NC];
- X sprintf (why, "Bad command line spec: %.*s", sizeof(why)-26,fs);
- X.
- X233,271d
- X228c
- X f_string (2, 1,
- X "usage: [-c <configfile>] [-d <database>] [field=value ...]\r\n");
- X.
- X221a
- Xvoid
- Xon_fpe()
- X{
- X signal (SIGFPE, on_fpe);
- X f_msg ("Floating point error has occurred - computations aborted.");
- X longjmp (fpe_err_jmp, 1);
- X}
- X
- X.
- X220a
- X/* this gets called when a floating point error occurs.
- X * we force a jump back into main() with looping terminated.
- X */
- X.
- X211c
- X/* clean up and exit.
- X.
- X165a
- X/* read in ephem's configuration file, if any.
- X * if errors in file, call usage() (which exits).
- X * if use -d, require it; else try ephem.cfg and $HOME/.ephemrc but don't
- X * complain if can't find these since, after all, one is not required.
- X * skip blank lines and lines that begin with '#', '*', ' ' or '\t'.
- X */
- Xstatic
- Xread_cfgfile()
- X{
- X char buf[128];
- X char homefile[128];
- X FILE *fp;
- X char *fn;
- X
- X /* open the config file.
- X * only REQUIRED if used -d option.
- X * if succcessful, fn points to file name.
- X */
- X if (cfgfile) {
- X fn = cfgfile;
- X fp = fopen (fn, "r");
- X if (!fp) {
- X sprintf (buf, "Can not open %s", fn);
- X usage (buf); /* does not return */
- X }
- X }
- X fn = cfgdef;
- X fp = fopen (fn, "r");
- X if (!fp) {
- X fn = getenv ("HOME");
- X if (fn) {
- X sprintf (homefile, "%s/.ephemrc", fn);
- X fn = homefile;
- X fp = fopen (fn, "r");
- X }
- X }
- X if (!fp)
- X return; /* oh well; after all, it's not required */
- X
- X while (fgets (buf, sizeof(buf), fp)) {
- X switch (buf[0]) {
- X case '#': case '*': case ' ': case '\t': case '\n':
- X continue;
- X }
- X buf[strlen(buf)-1] = '\0'; /* discard trailing \n */
- X if (crack_fieldset (buf) < 0) {
- X char why[NC];
- X sprintf (why, "Bad field spec in %s: %s\n", fn, buf);
- X usage (why);
- X }
- X }
- X fclose (fp);
- X}
- X
- X
- X.
- X118a
- X /* if get a floating error, longjmp() here and stop looping */
- X if (setjmp (fpe_err_jmp))
- X nstep = 0;
- X
- X.
- X99a
- X signal (SIGFPE, on_fpe);
- X.
- X98c
- X /* set up to clean up screen and tty if interrupted.
- X * also set up to stop if get floating error.
- X */
- X.
- X95c
- X read_cfgfile ();
- X.
- X82a
- X case 'd': /* set alternate database file name */
- X if (--ac <= 0) usage("-d but no database file");
- X obj_setdbfilename (*++av);
- X break;
- X.
- X59a
- X void on_fpe();
- X.
- X47,48c
- Xstatic jmp_buf fpe_err_jmp; /* used to recover from SIGFPE */
- Xstatic char *cfgfile; /* !0 if -c used */
- Xstatic char cfgdef[] = "ephem.cfg"; /* default configuration file name */
- X.
- X22a
- Xextern char *getenv();
- X.
- X21d
- X15a
- X#include <setjmp.h>
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - mainmenu.c << '-*-END-*-'
- X81a
- X f_string (R_OBJY, C_OBJ, "Y");
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - objx.c << '-*-END-*-'
- X678c
- X mjd_cal (*p, &m, &d, &y); /* init with current */
- X.
- X661c
- X op->o_p.p_k = atof(bp);
- X.
- X654c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_k);
- X.
- X652c
- X static char p[] = "Luminosity index (kappa):";
- X.
- X646c
- X op->o_p.p_g = atof(bp);
- X.
- X639c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_g);
- X.
- X637c
- X static char p[] = "Absolute magnitude (g):";
- X.
- X631c
- X crack_year (bp, &op->o_p.p_epoch);
- X.
- X625c
- X sts = read_line (buf, 20);
- X.
- X623c
- X mjd_year (op->o_p.p_epoch, &y);
- X.
- X614c
- X op->o_p.p_om = degrad(atof(bp));
- X.
- X607c
- X f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_om));
- X.
- X599c
- X op->o_p.p_qp = atof(bp);
- X.
- X592c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_p.p_qp);
- X.
- X584c
- X op->o_p.p_ap = degrad(atof(bp));
- X.
- X577c
- X f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_ap));
- X.
- X569c
- X op->o_p.p_inc = degrad(atof(bp));
- X.
- X562c
- X f_double(R_PROMPT,C_PROMPT+sizeof(p),"(%g) ",raddeg(op->o_p.p_inc));
- X.
- X554c
- X crack_year (bp, &op->o_p.p_ep);
- X.
- X548c
- X sts = read_line (buf, 20);
- X.
- X546c
- X mjd_cal (op->o_p.p_ep, &m, &d, &y);
- X.
- X535c
- X op->o_type = PARABOLIC;
- X.
- X528c
- Xobj_dparabolic(op, av)
- XObj *op;
- X.
- X524c
- X * o_type is set to PARABOLIC.
- X.
- X517,519c
- X * 10 args in av, in order, are epoch of perihelion, inclination, argument of
- X * perihelion, perihelion distance, longitude of ascending node, reference
- X * epoch, absolute magnitude and luminosity index.
- X.
- X513c
- X op->o_e.e_H = atof(bp);
- X
- X if (av) {
- X bp = av[10];
- X sts = 1;
- X } else {
- X static char p[] = "Magnitude slope parameter (G):";
- X f_prompt (p);
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_G);
- X sts = read_line (buf, 8+1);
- X if (sts < 0)
- X return;
- X bp = buf;
- X }
- X if (sts > 0)
- X op->o_e.e_G = atof(bp);
- X.
- X506c
- X mjd_year (op->o_e.e_epoch, &y);
- X printf ("(%g) ", y);
- X sts = read_line (buf, 20);
- X if (sts < 0)
- X return;
- X bp = buf;
- X }
- X if (sts > 0)
- X crack_year (bp, &op->o_e.e_epoch);
- X
- X
- X if (av) {
- X bp = av[9];
- X sts = 1;
- X } else {
- X static char p[] = "Absolute magnitude (H):";
- X f_prompt (p);
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_H);
- X.
- X504c
- X static char p[] = "Equinox year (UT Date, m/d.d/y or year.d): ";
- X double y;
- X.
- X498c
- X crack_year (bp, &op->o_e.e_cepoch);
- X.
- X491,492c
- X mjd_cal (op->o_e.e_cepoch, &m, &d, &y);
- X printf ("(%d/%g/%d) ", m, d, y);
- X sts = read_line (buf, 20);
- X.
- X489c
- X static char p[] =
- X "Epoch date (UT Date, m/d.d/y or year.d): ";
- X int m, y;
- X double d;
- X.
- X483c
- X op->o_e.e_M = atof(bp);
- X.
- X476c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_M);
- X.
- X474c
- X static char p[] = "Mean anomaly (degs):";
- X.
- X468c
- X op->o_e.e_e = atof(bp);
- X.
- X461c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_e);
- X.
- X459c
- X static char p[] = "Eccentricity:";
- X.
- X453c
- X op->o_e.e_n = atof(bp);
- X.
- X446c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_n);
- X.
- X444c
- X static char p[] = "Daily motion (degs/day):";
- X.
- X438c
- X op->o_e.e_a = atof(bp);
- X.
- X431c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_a);
- X.
- X429c
- X static char p[] = "Mean distance (AU):";
- X.
- X423c
- X op->o_e.e_om = atof(bp);
- X.
- X416c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_om);
- X.
- X414c
- X static char p[] = "Argument of Perihelion (degs):";
- X.
- X408c
- X op->o_e.e_Om = atof(bp);
- X.
- X401c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_Om);
- X.
- X399c
- X static char p[] = "Longitude of ascending node (degs):";
- X.
- X393c
- X op->o_e.e_inc = atof(bp);
- X.
- X385,387c
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_e.e_inc);
- X sts = read_line (buf, 8+1);
- X.
- X380,383c
- X static char p[] = "Inclination (degs):";
- X.
- X374c
- X op->o_type = ELLIPTICAL;
- X.
- X367c
- Xobj_delliptical(op, av)
- XObj *op;
- X.
- X363c
- X * o_type is set to ELLIPTICAL.
- X.
- X356,358c
- X * 11 args in av, in order, are inclination, longitude of ascending node,
- X * argument of perihelion, mean distance (aka semi-major axis), daily
- X * motion, eccentricity, mean anomaly (ie, degrees from perihelion),
- X * epoch date (ie, time of the mean anomaly value), equinox year
- X * (ie, time of inc/lon/aop) absolute visual magnitude (H) and magnitude
- X * slope parameter (G).
- X.
- X352c
- X crack_year (bp, &op->o_f.f_epoch);
- X.
- X346c
- X sts = read_line (buf, 20);
- X.
- X344c
- X mjd_year (op->o_f.f_epoch, &y);
- X.
- X340a
- X static char p[] = "Magnitude: ";
- X f_prompt (p);
- X f_double (R_PROMPT, C_PROMPT+sizeof(p), "(%g) ", op->o_f.f_mag);
- X sts = read_line (buf, 8+1);
- X if (sts < 0)
- X return;
- X bp = buf;
- X }
- X if (sts > 0)
- X op->o_f.f_mag = atof (bp);
- X
- X if (av) {
- X bp = av[3];
- X sts = 1;
- X } else {
- X.
- X333,334c
- X sex_dec (dg, m, s, &op->o_f.f_dec);
- X op->o_f.f_dec = degrad(op->o_f.f_dec);
- X.
- X331c
- X f_dec_sexsign (raddeg(op->o_f.f_dec), &dg, &m, &s);
- X.
- X322c
- X f_angle (R_PROMPT, C_PROMPT+sizeof(p)-1, op->o_f.f_dec);
- X.
- X312,313c
- X sex_dec (h, m, s, &op->o_f.f_ra);
- X op->o_f.f_ra = hrrad(op->o_f.f_ra);
- X.
- X310c
- X f_dec_sexsign (radhr(op->o_f.f_ra), &h, &m, &s);
- X.
- X301c
- X f_ra (R_PROMPT, C_PROMPT+sizeof(p)-1, op->o_f.f_ra);
- X.
- X293c
- X op->o_type = FIXED;
- X.
- X286c
- Xobj_dfixed (op, av)
- XObj *op;
- X.
- X282c
- X * o_type is set to FIXED.
- X.
- X277c
- X * args in av, in order, are ra, dec, magnitude and reference epoch.
- X.
- X275a
- X/* search through an ephem database file for an entry and use it to define
- X * either OBJX or OBJY (as set by p).
- X * if a name, np, is not set then we ask for it.
- X * if -d was used use it; else if EPHEMDB env set use it, else use default.
- X */
- Xobj_filelookup (p, np)
- Xint p; /* OBJX or OBJY */
- Xchar *np;
- X{
- X FILE *fp;
- X char *fn;
- X int nl;
- X char buf[160];
- X char name[64];
- X int found;
- X
- X /* open the database file */
- X if (dbfile)
- X fn = dbfile;
- X else {
- X fn = getenv ("EPHEMDB");
- X if (!fn)
- X fn = dbfdef;
- X }
- X fp = fopen (fn, "r");
- X if (!fp) {
- X sprintf (buf, "Can not open database file %s", fn);
- X f_msg(buf);
- X return;
- X }
- X
- X /* set up object name in name with a trailing ',' */
- X if (np) {
- X (void) strncpy (name, np, sizeof(name)-2);
- X name[sizeof(name)-2] = '\0'; /* insure trailing '\0' */
- X } else {
- X f_prompt ("Object name: ");
- X if (read_line (name, sizeof(name)-2) <= 0)
- X return;
- X }
- X (void) strcat (name, ",");
- X
- X /* search for line beginning with name followed by comma.
- X * then rest of line is the info.
- X */
- X nl = strlen (name);
- X found = 0;
- X while (fgets (buf, sizeof(buf), fp))
- X if (strncmp (name, buf, nl) == 0) {
- X found = 1;
- X break;
- X }
- X fclose (fp);
- X
- X if (found)
- X (void) obj_define (p, buf+nl);
- X else {
- X sprintf (buf, "%s not found", name);
- X f_msg (buf);
- X }
- X}
- X
- X.
- X269c
- X f_msg ("Unknown OBJ type");
- X.
- X266c
- X obj_delliptical (op, av+1);
- X.
- X262,263c
- X if (ac != 12) {
- X f_msg ("Need inc,lan,aop,md,dm,ecc,ma,cep,ep,h,g for \"elliptical\" OBJ");
- X.
- X259c
- X obj_dparabolic (op, av+1);
- X.
- X256c
- X f_msg ("Need ep,inc,ap,qp,om,epoch,abs,lum for \"parabolic\" OBJ");
- X.
- X252c
- X obj_dfixed (op, av+1);
- X.
- X248,249c
- X if (ac != 5) {
- X f_msg ("Need ra,dec,mag,epoch for \"fixed\" OBJ");
- X.
- X228a
- X Obj *op = (p == OBJX) ? &objx : &objy;
- X.
- X222c
- Xobj_define (p, s)
- Xint p; /* OBJX or OBJY */
- X.
- X216,218c
- X/* define obj based on the ephem.cfg line, s.
- X * the "OBJX " or "OBJY " keyword is already skipped and used to set p.
- X * format: type,[other fields, as per corresponding ObjX typedef]
- X.
- X210c
- X
- X beta = acos((rp*rp + rho*rho - rsn*rsn)/ (2*rp*rho));
- X psi_t = exp(log(tan(beta/2.0))*0.63);
- X Psi_1 = exp(-3.33*psi_t);
- X psi_t = exp(log(tan(beta/2.0))*1.22);
- X Psi_2 = exp(-1.87*psi_t);
- X *mag = op->o_e.e_H + 5.0*log10(rp*rho)
- X - 2.5*log10((1-op->o_e.e_G)*Psi_1 + op->o_e.e_G*Psi_2);
- X
- X.
- X195c
- X dt = rho*5.775518e-3; /* light travel time, in days */
- X.
- X188c
- X lpd = atan(y/clo)+Om;
- X.
- X184d
- X175,181c
- X
- X reduce_elements (op->o_e.e_epoch, jd-dt, degrad(op->o_e.e_inc),
- X degrad (op->o_e.e_om), degrad (op->o_e.e_Om),
- X &inc, &om, &Om);
- X
- X ma = degrad (op->o_e.e_M
- X + (jd - op->o_e.e_cepoch - dt) * op->o_e.e_n);
- X anomaly (ma, e, &nu, &ea);
- X rp= op->o_e.e_a * (1-e*e) / (1+e*cos(nu));
- X lo = nu + om;
- X.
- X172a
- X e = op->o_e.e_e;
- X.
- X161,169d
- X158a
- X double om; /* arg of perihelion */
- X double Om; /* long of ascending node. */
- X double psi_t, Psi_1, Psi_2, beta;
- X double e;
- X.
- X156c
- X double ma, rp, lo, slo, clo;
- X.
- X153,154c
- X double dt, lg, lsn, rsn;
- X.
- X151a
- X * inputs have been changed to match the Astronomical Almanac.
- X * we have added reduction of elements using reduce_elements().
- X.
- X145c
- X *mag = op->o_p.p_g + 5*log10(*rho0) + 2.5*op->o_p.p_k*log10(*rp0);
- X.
- X133,135c
- X reduce_elements (op->o_p.p_epoch, jd-dt, op->o_p.p_inc,
- X op->o_p.p_ap, op->o_p.p_om, &inc, &ap, &om);
- X comet (jd-dt, op->o_p.p_ep, inc, ap, op->o_p.p_qp, om,
- X.
- X122c
- X *mag = op->o_f.f_mag;
- X.
- X114,117c
- X xr = op->o_f.f_ra;
- X xd = op->o_f.f_dec;
- X if (op->o_f.f_epoch != jd)
- X precess (op->o_f.f_epoch, jd, &xr, &xd);
- X.
- X111c
- X Obj *op = (p == OBJX) ? &objx : &objy;
- X
- X switch (op->o_type) {
- X.
- X109c
- Xdouble *mag; /* APPARENT magnitude */
- X.
- X102a
- Xint p; /* OBJX or OBJY */
- X.
- X101c
- Xobj_cir (jd, p, lpd0, psi0, rp0, rho0, lam, bet, mag)
- X.
- X98c
- X * this is called by body_cir() for object x and y just like plans() is called
- X.
- X95c
- X/* set an alternate database file name.
- X * N.B. we assume the storage pointed to by name is permanent.
- X */
- Xobj_setdbfilename (name)
- Xchar *name;
- X{
- X dbfile = name;
- X}
- X
- X/* fill in info about object x or y.
- X.
- X92c
- X return ((p == OBJX) ? objx.o_on : objy.o_on);
- X.
- X90c
- Xobj_ison(p)
- Xint p;
- X.
- X85c
- X if (p == OBJX)
- X objx.o_on = 0;
- X else
- X objy.o_on = 0;
- X.
- X82,83c
- Xobj_off (p)
- Xint p;
- X.
- X80c
- X if (p == OBJX)
- X objx.o_on = 1;
- X else
- X objy.o_on = 1;
- X.
- X78c
- Xobj_on (p)
- Xint p;
- X.
- X76c
- X/* turn "on" or "off" but don't forget facts about object the object.
- X.
- X67,72c
- X pr[4] = op->o_on ? "On" : "Off";
- X switch (f = popup (pr, f, 5)) {
- X case 0: obj_dfixed(op, (char**)0); goto ask;
- X case 1: obj_delliptical(op, (char**)0); goto ask;
- X case 2: obj_dparabolic(op, (char**)0); goto ask;
- X case 3: obj_filelookup (p, (char *)0); goto rechk;
- X case 4: op->o_on ^= 1; break;
- X.
- X60c
- X switch (op->o_type) {
- X.
- X58a
- X op = (p == OBJX) ? &objx : &objy;
- X
- X rechk:
- X.
- X57a
- X Obj *op;
- X.
- X54,55c
- X static char *pr[5] = {
- X "Fixed", "Elliptical", "Parabolic", "Lookup"
- X.
- X52c
- Xobj_setup(p)
- Xint p;
- X.
- X49c
- Xstatic Obj objx;
- Xstatic Obj objy;
- X
- X/* run when Objx or y is picked from menu.
- X * we tell which by the planet code.
- X.
- X45,47c
- Xtypedef struct {
- X int o_type; /* see flags, below */
- X int o_on; /* !=0 while object is active */
- X ObjF o_f;
- X ObjE o_e;
- X ObjP o_p;
- X} Obj;
- X#define FIXED 0 /* just simple ra/dec object */
- X#define ELLIPTICAL 1 /* elliptical orbital elements */
- X#define PARABOLIC 2 /* parabolic " */
- X.
- X42c
- X double p_g, p_k; /* magnitude model coefficients */
- X.
- X31,33c
- X double e_Om; /* longitude of ascending node, degrees */
- X double e_om; /* argument of perihelion, degress */
- X double e_a; /* mean distance, aka, semi-maj axis, in AU */
- X double e_n; /* daily motion, degrees/day */
- X double e_e; /* eccentricity */
- X double e_M; /* mean anomaly, ie, degrees from perihelion at... */
- X double e_cepoch; /* epoch date (M reference), as an mjd */
- X double e_epoch; /* equinox year (inc/Om/om reference), as an mjd */
- X double e_H, e_G; /* magnitude model coefficients */
- X.
- X26,29d
- X22a
- X double f_mag; /* visual magnitude */
- X.
- X18c
- X/* structures to describe objects of various types.
- X.
- X13,16c
- Xstatic char *dbfile; /* !0 if set by -d option */
- Xstatic char dbfdef[] = "ephem.db"; /* default database file name */
- X.
- X11c
- Xextern char *strcat(), *strcpy(), *strncpy(), *getenv();
- X.
- X5a
- X#include <stdio.h>
- X.
- X1,3c
- X/* functions to save the user-definable objects, referred to as "x" and "y".
- X * this way, once defined, the objects can be quieried for position just like
- X * the other bodies, with obj_cir().
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - obliq.c << '-*-END-*-'
- X16c
- X lasteps = degrad(2.345229444E1
- X - ((((-1.81E-3*t)+5.9E-3)*t+4.6845E1)*t)/3600.0);
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - plans.c << '-*-END-*-'
- X48c
- X double lsn, rsn;/* true geocentric longitude of sun and sun-earth rad */
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - plot.c << '-*-END-*-'
- X416c
- X f_double (NR/2, NC-10, "%g", maxr);
- X.
- X405c
- X if (sscanf (buf, fmt, &c, &r, &th) != 3)
- X continue;
- X.
- X388c
- X if (sscanf (buf, fmt, &c, &r, &th) != 3)
- X continue;
- X.
- X359,362c
- X f_double (1, 1, "%g", maxy);
- X f_double (NR-1, 1, "%g", miny);
- X f_double (NR, 1, "%g", minx);
- X f_double (NR, NC-10, "%g", maxx);
- X.
- X350c
- X if (sscanf (buf, fmt, &c, &x, &y) != 3)
- X continue;
- X.
- X329c
- X if (sscanf (buf, fmt, &c, &x, &y) != 3)
- X continue;
- X.
- X89c
- X (void) flog_log (R_SRCH, C_SRCH, e);
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - popup.c << '-*-END-*-'
- X62,63c
- X if (++fn >= nfields)
- X fn = 0;
- X.
- X58,59c
- X if (--fn < 0)
- X fn = nfields - 1;
- X.
- X56c
- X case '\r': return (fn);
- X.
- X53a
- X case QUIT:
- X f_prompt ("Exit ephem? (y) ");
- X if (read_char() == 'y')
- X bye(); /* never returns */
- X goto again;
- X.
- X51c
- X c_pos (R_PROMPT, fcols[fn]);
- X.
- X49d
- X8a
- Xextern void bye();
- X
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - reduce.c << '-*-END-*-'
- X14c
- Xdouble *om; /* desired long of ascending node, rads */
- X.
- X11c
- Xdouble om0; /* initial long of ascending node, rads */
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - riset_c.c << '-*-END-*-'
- X42c
- X if (!force && same_cir (np, &lp->l_now) && same_lday (np, &lp->l_now)
- X.
- X22a
- Xint force; /* set !=0 to force computations */
- X.
- X20c
- Xriset_cir (p, np, force, hzn, ltr, lts, ltt, azr, azs, altt, status)
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - screen.h << '-*-END-*-'
- X196c
- X#define OBJY (PLUTO+4) /* the user-defined object */
- X#define NOBJ (OBJY+1) /* total number of objects */
- X.
- X157,166c
- X#define C_MOON 10
- X#define C_MERCURY 17
- X#define C_VENUS 23
- X#define C_MARS 30
- X#define C_JUPITER 36
- X#define C_SATURN 43
- X#define C_URANUS 49
- X#define C_NEPTUNE 56
- X#define C_PLUTO 62
- X#define C_OBJX 69
- X#define C_OBJY 75
- X.
- X149,153c
- X#define C_TRANSTM 29
- X#define C_TRANSALT 40
- X#define C_SETTM 51
- X#define C_SETAZ 62
- X#define C_TUP 73
- X.
- X147c
- X#define C_RISETM 7
- X.
- X121,131c
- X#define R_SUN (R_PLANTAB+1)
- X#define R_MOON (R_PLANTAB+2)
- X#define R_MERCURY (R_PLANTAB+3)
- X#define R_VENUS (R_PLANTAB+4)
- X#define R_MARS (R_PLANTAB+5)
- X#define R_JUPITER (R_PLANTAB+6)
- X#define R_SATURN (R_PLANTAB+7)
- X#define R_URANUS (R_PLANTAB+8)
- X#define R_NEPTUNE (R_PLANTAB+9)
- X#define R_PLUTO (R_PLANTAB+10)
- X#define R_OBJX (R_PLANTAB+11)
- X#define R_OBJY (R_PLANTAB+12)
- X
- X/* menu 1 info table */
- X.
- X119c
- X/* planet rows, for all menus */
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - sel_fld.c << '-*-END-*-'
- X530a
- X case 'y': newf = nearestfld (R_OBJY, 1, flag); break;
- X.
- X341a
- X rcfpack (R_VENUS, C_OBJY, F_MNU3|F_PLT),
- X.
- X310a
- X rcfpack (R_URANUS, C_OBJY, F_MNU3|F_PLT),
- X.
- X278a
- X rcfpack (R_SUN, C_OBJY, F_MNU3|F_PLT),
- X.
- X248a
- X rcfpack (R_SATURN, C_OBJY, F_MNU3|F_PLT),
- X.
- X217a
- X rcfpack (R_PLUTO, C_OBJY, F_MNU3|F_PLT),
- X.
- X201a
- X rcfpack (R_OBJY, C_ALT, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_AZ, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_DEC, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_EDIST, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_ELONG, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_HLAT, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_HLONG, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_JUPITER, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_MAG, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_MARS, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_MERCURY, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_MOON, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_NEPTUNE, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_OBJ, F_MMNU|F_CHG),
- X rcfpack (R_OBJY, C_OBJX, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_PHASE, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_PLUTO, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_RA, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_RISEAZ, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_RISETM, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_SATURN, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_SDIST, F_MNU1|F_PLT),
- X rcfpack (R_OBJY, C_SETAZ, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_SETTM, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_SUN, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_TRANSALT, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_TRANSTM, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_TUP, F_MNU2|F_PLT),
- X rcfpack (R_OBJY, C_URANUS, F_MNU3|F_PLT),
- X rcfpack (R_OBJY, C_VENUS, F_MNU3|F_PLT),
- X.
- X186a
- X rcfpack (R_OBJX, C_OBJY, F_MNU3|F_PLT),
- X.
- X155a
- X rcfpack (R_NEPTUNE, C_OBJY, F_MNU3|F_PLT),
- X.
- X125a
- X rcfpack (R_MOON, C_OBJY, F_MNU3|F_PLT),
- X.
- X97a
- X rcfpack (R_MERCURY, C_OBJY, F_MNU3|F_PLT),
- X.
- X67a
- X rcfpack (R_MARS, C_OBJY, F_MNU3|F_PLT),
- X.
- X30a
- X rcfpack (R_JUPITER, C_OBJY, F_MNU3|F_PLT),
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - version.c << '-*-END-*-'
- X7a
- X * 4.13 3/9/90 add support for second user-def object: "object y"
- X * fix bug updating obj ref epoch (always used PARABOLIC's)
- X * fix Turbo C workaround that prevented plotting sun dist.
- X * 3/13 fix bug preventing searching on separation column for objx
- X * 3/22 revamp elliptical object definition parameters to match AA.
- X * permit exiting/redrawing properly from within a popup too.
- X * add a bit more precision to plot labels.
- X * let plot files have comments too, ie, leading *'s
- X * 3/23 add "Lookup" to search config file for objects.
- X * 3/30 separate database from config file; add -d and EPHEMDB env var.
- X * catch SIGFPE and longjmp() back into main interation loop.
- X * 4/3 add magnitude to fixed-object database fields.
- X.
- X5c
- Xstatic char vmsg[] = "Version 4.13 April 3, 1990";
- X.
- Xw
- Xq
- X-*-END-*-
- Xed - watch.c << '-*-END-*-'
- X221c
- X
- X.
- X214,219c
- X for (p = OBJX; p != -1; p = (p == OBJX) ? OBJY : -1)
- X if (wbodies & (1<<p)) {
- X (void) body_cir (p, SSACC, np, &s);
- X if (s.s_hlong != NOHELIO && s.s_sdist <= scale) {
- X set_ss (newp+nnew, s.s_sdist/scale, s.s_hlong, s.s_hlat,
- X body_tags[p]);
- X nnew += 2;
- X }
- X.
- X56c
- X "Sky", "Solar system"
- X.
- Xw
- Xq
- X-*-END-*-
- EOFxEOF
- len=`wc -c < Ephem_4.12-13`
- if expr $len != 47612 > /dev/null
- then echo Length of Ephem_4.12-13 is $len but it should be 47612.
- fi
- echo x ephem.db
- sed -e 's/^X//' << 'EOFxEOF' > ephem.db
- X* ephem database.
- X*
- X* these are sorted for easy reading but they don't have to be in any order.
- X* things will run faster if you put the objects you use nearer the top.
- X*
- X* elliptical format: inclination, longitude of ascending node,
- X* argument of perihelion, mean distance (aka semi-major axis),
- X* daily motion, eccentricity, mean anomaly (ie, degrees from perihelion),
- X* epoch date (ie, time of M), the equinox year (ie, time of i/O/o).
- X* absolute magnitude, magnitude slope parameter.
- X*
- X* parabolic format: epoch of perihelion, inclination, argument of perihelion,
- X* perihelion distance, longitude of the ascending node, reference epoch of
- X* the parameters, absolute magnitude, luminosity index
- X*
- X* fixed format: ra, dec, magnitude, reference epoch
- X
- X* from IAU circular 4985
- XAustin,p,4/9.9715/1990,58.9574,61.5625,0.349854,75.2223,1950.0,4.5,4
- X* from IAU circular 4986
- XCernis,p,3/17.2967/1990,48.138,100.588,1.06849,347.727,1950,0,0
- X* from IAU circular 4984
- XGeorge,p,4/11.9396/1990,59.3652,137.8482,1.569001,279.3118,1950,0,0
- X
- XVesta,e,7.139,104.015,149.986,2.3607,0.27174,0.0906,152.190,11/5/1990,2000.0,3.16,0.34
- XCeres,e,10.607,80.702,71.274,2.7685,0.21396,0.0780,287.265,10/1/1989,2000.0,3.32,0.11
- XHalley,e,162.238,58.154,111.857,17.9435,0.0129674,0.9673,0,1986.109,1950,3.66,7.05
- XPallas,e,34.804,173.323,309.796,2.7703,0.21375,0.2347,273.779,10/1/1989,2000.0,4.13,0.15
- XEunomia,e,11.76001,292.89583,97.40910,2.6446692,0.22916434,0.1850083,236.28800,8/27/1988,1950.0,5.22,0.20
- XEunomia,e,11.765,293.619,97.591,2.6437,0.22929,0.1849,327.856,10/1/1989,2000.0,5.22,0.20
- XJuno,e,12.991,170.542,246.787,2.6692,0.22601,0.2575,205.808,11/5/1990,2000.0,5.31,0.30
- XHygiea,e,3.840,283.833,315.832,3.1365,0.17743,0.1202,104.089,11/5/1990,2000.0,5.37,0.15
- XIris,e,5.513,260.100,144.725,2.3864,0.26735,0.2292,239.261,11/5/1990,2000.0,5.56,0.25
- XHebe,e,14.781,139.033,238.480,2.4250,0.26100,0.2020,253.786,11/5/1990,2000.0,5.70,0.24
- XHerculina,e,16.35677,107.39552,75.08723,2.7711409,0.21365652,0.1763770,199.36894,10/1/1989,1950.0,5.78,0.22
- XAmphitrite,e,6.110,356.625,63.020,2.5546,0.24139,0.0715,294.249,11/5/1990,2000.0,5.84,0.21
- XDembowska,e,8.264,32.824,343.637,2.9246,0.19707,0.0901,257.577,11/5/1990,2000.0,5.98,0.32
- XPsyche,e,3.089,150.508,227.697,2.9229,0.19723,0.1333,37.474,11/5/1990,2000.0,5.98,0.22
- XPsyche89,e,3.089,150.508,227.581,2.9234,0.19718,0.1335,318.680,10/1/1989,2000.0,5.98,0.22
- EOFxEOF
- len=`wc -c < ephem.db`
- if expr $len != 2395 > /dev/null
- then echo Length of ephem.db is $len but it should be 2395.
- fi
-
- echo x ell_e-ephem
- sed -e 's/^X//' << 'EOFxEOF' > ell_e-ephem
- X#!/bin/csh -f
- X# convert a *.ell_e file to the form needed by ephem.db
- X# skip first three lines
- X# trim off leading digits_ in names.
- Xawk '\
- XBEGIN { OFS = "," \
- X } \
- X { if (NR <= 3 || NF < 15) next \
- X nm = $1 \
- X i = $2 \
- X O = $3 \
- X o = $4 \
- X a = $5 \
- X n = $6 \
- X e = $7 \
- X M = $8 \
- X Mon = $9 \
- X if (Mon == "Jan") Mon = 1 \
- X if (Mon == "Feb") Mon = 2 \
- X if (Mon == "Mar") Mon = 3 \
- X if (Mon == "Apr") Mon = 4 \
- X if (Mon == "May") Mon = 5 \
- X if (Mon == "Jun") Mon = 6 \
- X if (Mon == "Jul") Mon = 7 \
- X if (Mon == "Aug") Mon = 8 \
- X if (Mon == "Sep") Mon = 9 \
- X if (Mon == "Oct") Mon = 10 \
- X if (Mon == "Nov") Mon = 11 \
- X if (Mon == "Dec") Mon = 12 \
- X day = $10 \
- X yr = $11 \
- X eq = $12 \
- X H = $14 \
- X G = $15 \
- X \
- X print nm, "e", i, O, o, a, n, e, M, Mon"/"day"/"yr, eq, H, G \
- X }' | sed -e 's/^[0-9]*_//'
- EOFxEOF
- len=`wc -c < ell_e-ephem`
- if expr $len != 899 > /dev/null
- then echo Length of ell_e-ephem is $len but it should be 899.
- fi
- echo x par_e-ephem
- sed -e 's/^X//' << 'EOFxEOF' > par_e-ephem
- X#!/bin/csh -f
- X# convert a *.par_e file to the form needed by ephem.db
- X# skip first three lines
- X# trim off leading digits_ in names.
- Xawk '\
- XBEGIN { OFS = "," \
- X } \
- X { if (NR <= 3) next \
- X nm = $1 \
- X i = $2 \
- X O = $3 \
- X o = $4 \
- X q = $5 \
- X Mon = $6 \
- X if (Mon == "Jan") Mon = 1 \
- X if (Mon == "Feb") Mon = 2 \
- X if (Mon == "Mar") Mon = 3 \
- X if (Mon == "Apr") Mon = 4 \
- X if (Mon == "May") Mon = 5 \
- X if (Mon == "Jun") Mon = 6 \
- X if (Mon == "Jul") Mon = 7 \
- X if (Mon == "Aug") Mon = 8 \
- X if (Mon == "Sep") Mon = 9 \
- X if (Mon == "Oct") Mon = 10 \
- X if (Mon == "Nov") Mon = 11 \
- X if (Mon == "Dec") Mon = 12 \
- X day = $7 \
- X yr = $8 \
- X eq = $9 \
- X g = $10 \
- X k = $11 \
- X \
- X print nm, "p", Mon"/"day"/"yr, i, o, q, O, eq, g, k \
- X }' | sed -e 's/^[0-9]*_//'
- EOFxEOF
- len=`wc -c < par_e-ephem`
- if expr $len != 831 > /dev/null
- then echo Length of par_e-ephem is $len but it should be 831.
- fi
- echo x sac-ephem
- sed -e 's/^X//' << 'EOFxEOF' > sac-ephem
- X#!/bin/csh -f
- X# convert SAGUARO ASTRONOMY CLUB DATABASE VERSION 5.0 to ephem fixed format
- X
- Xawk '-F"' '\
- XBEGIN { OFS = "," \
- X } \
- X { \
- X nm = $1 \
- X ra = $5 \
- X ra = substr(ra,1,2)+0 ":" substr (ra,4,2) ":" substr(ra,7,1)*6 \
- X dec = $6 \
- X dec = substr(dec,1,3)+0 ":" substr(dec,5,2) \
- X mag = $7 \
- X \
- X print nm, ra, dec, mag, "2000" \
- X } \
- X'
- EOFxEOF
- len=`wc -c < sac-ephem`
- if expr $len != 361 > /dev/null
- then echo Length of sac-ephem is $len but it should be 361.
- fi
- echo x star-ephem
- sed -e 's/^X//' << 'EOFxEOF' > star-ephem
- X#!/bin/csh -f
- X# convert .star format to "fixed" object ephem format
- X# N.B. this is mighty crude. it does especially poorly with the name portion.
- X
- Xawk '\
- X{ \
- X if (NF < 2) \
- X next \
- X name = substr ($2, 4, 100) \
- X if (name == "") \
- X next \
- X rah = substr ($1, 1, 2) \
- X ram = substr ($1, 3, 2) \
- X ras = substr ($1, 5, 2) \
- X decd = substr ($1, 7, 3) \
- X decm = substr ($1, 10, 2) \
- X mag = substr ($1, 12, 3) \
- X if (mag < 0) \
- X mag /= 10 \
- X else \
- X mag /= 100 \
- X printf "%s,f,%d:%d:%d,%d:%d,%g,2000\n", name, rah, ram, ras, decd, decm, mag \
- X}'
- EOFxEOF
- len=`wc -c < star-ephem`
- if expr $len != 554 > /dev/null
- then echo Length of star-ephem is $len but it should be 554.
- fi
-
-