Blog

Planetary Rise and Set Times Using aa

By WJR, Thu June 23 2022

A set of scripts (bash and awk) used to produce localized planet rise and set times based upon output from aa (Stephen L. Moshier's astronomical almanac program). Output formats include the raw output from aa, CSV, HTML, tabular, and postscript.

Usage

planet-rs.sh takes a standard aa input file (refer to my post on aa for an example) and, optionally, format (raw, csv, html, or ps), time zone and a time zone label. In the example outputs below, rise and set times are displayed for Jupiter in July, 2022, EDT (-4 hours from UT).

Raw Output

jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt raw -4 EDT | head
Input file: Jupiter-07-2022.txt
rises 2022 July 1 Friday 1h 20m 19.873s EDT
sets 2022 July 1 Friday 13h 36m 25.567s EDT
rises 2022 July 2 Saturday 1h 16m 37.113s EDT
sets 2022 July 2 Saturday 13h 32m 54.005s EDT
rises 2022 July 3 Sunday 1h 12m 53.963s EDT
sets 2022 July 3 Sunday 13h 29m 21.585s EDT
rises 2022 July 4 Monday 1h 09m 10.417s EDT
sets 2022 July 4 Monday 13h 25m 48.300s EDT
rises 2022 July 5 Tuesday 1h 05m 26.473s EDT

CSV Output

jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt csv -4 EDT | head
Input file: Jupiter-07-2022.txt
07/01/2022, 01:20 EDT, 13:36 EDT
07/02/2022, 01:16 EDT, 13:32 EDT
07/03/2022, 01:12 EDT, 13:29 EDT
07/04/2022, 01:09 EDT, 13:25 EDT
07/05/2022, 01:05 EDT, 13:22 EDT
07/06/2022, 01:01 EDT, 13:18 EDT
07/07/2022, 00:57 EDT, 13:15 EDT
07/08/2022, 00:54 EDT, 13:11 EDT
07/09/2022, 00:50 EDT, 13:07 EDT

Tabular Output

jeffr@Europa: ~/planet-rs $ ./planet-rs.sh Jupiter-07-2022.txt table -4 EDT | head
Input file: Jupiter-07-2022.txt
+-----------+------------+------------+
|   Date    |    Rise    |    Set     |
+-----------+------------+------------+
|07/01/2022 |  01:20 EDT |  13:36 EDT |
+-----------+------------+------------+
|07/02/2022 |  01:16 EDT |  13:32 EDT |
+-----------+------------+------------+
|07/03/2022 |  01:12 EDT |  13:29 EDT |
+-----------+------------+------------+

HTML and Postscript

Here's an example of the HTML output. The example postscript output was converted to PDF using ps2pdf.

Download

The package below includes a sample aa.ini (edit to reflect desired latitude, longitude, etc.) as well as input files for various planets. The scripts have been tested on Ubuntu Linux and Cygwin.

planet-rs.tar.gz, 22K

Known Issues

If you get an error message similar to the following when attempting to use the ps output format:

troff: fatal error: can't find macro file s

It may be due to a missing Groff macro. I solved this issue on Ubuntu Linux by installing the complete Groff package (in addition to the base package, which is installed be default).

Related Articles