Yes You Can... Cash In On Chaos!

The MicroMedia Planetary Database

Overview


The MicroMedia Planetary Database provides 500 years of astronomical data in a simple to use table lookup format. The data runs from Jan 1, 1700 to December 31, 2199. The data is derived from the Jet Propulsion Laboratories astronomical files, so is as accurate as is available.

The MicroMedia Planetary Database package consists of two sets of five files each, one for each century. The files consist of two types, .csv files for reading into a spread sheet such as Microsoft Excel, and .sql files, for creating a planets table inside a database server, such as Microsoft SQL Server, MySql, SQLite, or the free Microsoft SQL Server Express 2008.

The .csv file are text files which can be read by programs written in any programming language, such a AWK, C, C++, C#, VisualBasic, Python, Java, Pearl, etc. Simple desktop applications can read the .csv files into an internal two dimensional array (table), providing quick access for many applications.

The .sql files are particularly useful for creating websites that require planetary data. They can also be used in desktop applications that use a locally running database server, or in an application using an embedded database server such as SQLite.

These files are both language and operating system independent. They can be used on any version of MSDOS, Windows, Unix, or Linux. Both the .csv and .sql files are ASCII text files. They can be viewed and edited with Windows notepad, Microsoft Word, Unix VI, or any text editor.

Installation


By default, the files are downloaded to the c:\mmplanetdb directory. These files can be located using Windows Explorer. The directory contains 14 files, the 10 database files, this help file, and 3 sample use files. No entries are made in the Windows registry, and the files may be copied and moved anywhere. You have a license to use these files for yourself, but not to give them to others.

It is suggested you make at least 2 backup copies before working with these files. Burn one copy to a DVD, or a pair of CD's.

Organization


The five files each contain 100 years of planetary data, with one table row per day. Data is set for 17:00 Universal time, which is noon, New York time when on standard time. This was done for convenience in using the database for daily US market related research. Values for times other than 17:00 UT may be interpolated using two rows (days) of data.

The tables are laid out in the following columns:

1 YMD
2 JED
3 Month
4 Day
5 Year
6 HelioSunLongitude
7 HelioSunLatitude
8 HelioSunDistance
9 HelioMoonLongitude
10 HelioMoonLatitude
11 HelioMoonDistance
12 HelioMercuryLongitude
13 HelioMercuryLatitude
14 HelioMercuryDistance
15 HelioVenusLongitude
16 HelioVenusLatitude
17 HelioVenusDistance
18 HelioMarsLongitude
19 HelioMarsLatitude
20 HelioMarsDistance
21 HelioJupiterLongitude
22 HelioJupiterLatitude
23 HelioJupiterDistance
24 HelioSaturnLongitude
25 HelioSaturnLatitude
26 HelioSaturnDistance
27 HelioUranusLongitude
28 HelioUranusLatitude
29 HelioUranusDistance
30 HelioNeptuneLongitude
31 HelioNeptuneLatitude
32 HelioNeptuneDistance
33 HelioPlutoLongitude
34 HelioPlutoLatitude
35 HelioPlutoDistance
36 HelioNodeLongitude
37 HelioNodeLatitude
38 HelioNodeDistance
39 HelioEarthLongitude
40 HelioEarthLatitude
41 HelioEarthDistance
42 HelioChironLongitude
43 HelioChironLatitude
44 HelioChironDistance
45 GeoSunLongitude
46 GeoSunLatitude
47 GeoSunDistance
48 GeoMoonLongitude
49 GeoMoonLatitude
50 GeoMoonDistance
51 GeoMercuryLongitude
52 GeoMercuryLatitude
53 GeoMercuryDistance
54 GeoVenusLongitude
55 GeoVenusLatitude
56 GeoVenusDistance
57 GeoMarsLongitude
58 GeoMarsLatitude
59 GeoMarsDistance
60 GeoJupiterLongitude
61 GeoJupiterLatitude
62 GeoJupiterDistance
63 GeoSaturnLongitude
64 GeoSaturnLatitude
65 GeoSaturnDistance
66 GeoUranusLongitude
67 GeoUranusLatitude
68 GeoUranusDistance
69 GeoNeptuneLongitude
70 GeoNeptuneLatitude
71 GeoNeptuneDistance
72 GeoPlutoLongitude
73 GeoPlutoLatitude
74 GeoPlutoDistance
75 GeoNodeLongitude
76 GeoNodeLatitude
77 GeoNodeDistance
78 GeoEarthLongitude
79 GeoEarthLatitude
80 GeoEarthDistance
81 GeoChironLongitude
82 GeoChironLatitude
83 GeoChironDistance
84 EquSunRightAscension
85 EquSunDeclination
86 EquSunDistance
87 EquMoonRightAscension
88 EquMoonDeclination
89 EquMoonDistance
90 EquMercuryRightAscension
91 EquMercuryDeclination
92 EquMercuryDistance
93 EquVenusRightAscension
94 EquVenusDeclination
95 EquVenusDistance
96 EquMarsRightAscension
97 EquMarsDeclination
98 EquMarsDistance
99 EquJupiterRightAscension
100 EquJupiterDeclination
101 EquJupiterDistance
102 EquSaturnRightAscension
103 EquSaturnDeclination
104 EquSaturnDistance
105 EquUranusRightAscension
106 EquUranusDeclination
107 EquUranusDistance
108 EquNeptuneRightAscension
109 EquNeptuneDeclination
110 EquNeptuneDistance
111 EquPlutoRightAscension
112 EquPlutoDeclination
113 EquPlutoDistance
114 EquNodeRightAscension
115 EquNodeDeclination
116 EquNodeDistance
117 EquEarthRightAscension
118 EquEarthDeclination
119 EquEarthDistance
120 EquChironRightAscension
121 EquChironDeclination
122 EquChironDistance

The first row of a .csv file contains these column names.

Column 1 is YMD, which is an integer number representing the date in as a 4 digit year, concatenated with a 2 digit month, and a 2 digit day. Example: February 13, 1978 is 19780213.

For use with a SQL database, this provides a fast index field (column). Since these numbers are consecutive, they can also be used inside a program to easily compute the row number for the data if it has been stored in an array.

The JED column (field in database lingo) is the Julian Equivalent Date, the single number date/time system used by astronomers. One major use of JED is to compute the number of days between two dates by looking up their JED's, and subtracting them.

The database files contain astro data in 3 coordinate systems: geo, helio, and right ascension. No facilities are provided for adjusting the data to a particular point on the earth's surface using latitude and longitude. These functions must be provided by the user.

Use


The .csv file can be opened directly in Excel or any other spreadsheet.

The .sql files are Structured Query Language script files which create a table named planets and populates the table with data. For loading more than 100 years of data into a database, the files loaded after the first one should be edited to remove the table creation portion, since the table has already been created.

Most commercial databases include tools for executing the sql scripts. One exception is the free Microsoft SQL Server Express series. For running sql scripts on that database, one has to use the command line program sqlcmd. Users should refer to the Microsoft sqlcmd online documentation, but a command line will look something like this:

sqlcmd -S localhost\SQLEXPRESS -U myusername -P mypassword -d C:\myastro\mydatabase.MDF -i c:\mmplanetdb\planets20002100.sql

A good reference for working with this database is Sql Server 2008 for Dummies.

Once the planetary database is loaded into a spreadsheet, a database server, or a program, specific data may be accessed by row and column, using the first column as an index or search key. An example SQL query might be:

select [EquMercuryDeclination] from planets where [YMD] = '20000109'

Simplest Possible Use


The data files are most simply used by using the AWK scripting language. This is a free scripting language available from the GNU organization as GAWK (GNU AWK). It can be downloaded from http://www.gnu.org/software/gawk/gawk.html and http://gnuwin32.sourceforge.net/packages/gawk.htm.

AWK programs read through a file one line at a time and execute the AWK script on each line of the file. The following AWK (GAWK) script is equivalent to the SQL query above:

BEGIN {FS=","} NF>=1 && $1=="20000109" { print $1 " Mercury Dec= " $91 }

If this script is placed in a file name merdec.awk, it could be run by executing the command line

gawk -f merdec.awk pause

AWK scripts are slow compared to full blown database applications, both because the AWK language is interpreted, and because AWK reads all the way through a file. The latter problem can be reduced by editing the planetary database file to contain only the years of interest (rename the new version!). AWK scripts do run plenty fast enough for doing once a day screenings. These can be run on a schedule, so results can be displayed automatically.

The main value of AWK is that it is SIMPLE. Development is fast, and the scripts are easy to maintain. AWK has all the power of the C programming language, plus a bit, so unless one really needs interactive graphics, it is a most powerful tool. Even non-interactive graphics can be done with AWK by using it to produce a text file that can be read by a graphics interpreter program. Popular choices for this are PostScript and OpenGL.

A copy of the gawk interpreter, gawk,exe; merdec.awk; and merdec.bat are include in the download. You can run merdec.bat file from a command line, or by navigating to it with Windows Explorer and double clicking on it. This small example can be your starting point for developing any application you wish. AWK tutorial material is widely available on the web, at http://www.gnu.org/software/gawk/gawk.html and other sites. The original book on the language is The AWK Programming Language by Aho, Weinberger, and Kernigan. It is available through Amazon.com and other online bookstores.

Conclusion


It is beyond the scope of this help file to provide further instructions on the variety of uses for the MicroMedia Planetary Database. The rest of the problem is up to you to solve. The MicroMedia Planetary Database provides a platform for developing your own applications. Good luck.