OverviewThe 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.
InstallationBy 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. OrganizationThe 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 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. UseThe .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 UseThe 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
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.
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.
|