planetLocations.frink

Download or view planetLocations.frink in plain text format


// Calculate and print the positions of the planets as seen from any location
// on earth at the specified time.
//
// The program displays the azimuth, altitude, distance, and apparent magnitude
// of each planet along with an asterisk to indicate if it's above the horizon
// at the current time.
//
// These calculations correct for refraction, parallax, nutation, and other
// subtle effects.

use planets.frink

lat = 39.58563 degrees North
long = 104.89581 degrees West

if length[ARGS] == 0
   time = now[]
else
   time = parseDate[ARGS@0]

println["\tAzimuth\t\tAltitude\tDistance (au)\tMagnitude"]
for planet = Planet.planetsMinusEarth
{
   [az, alt] = planet.refractedAzimuthAltitude[time, lat, long]
   distance = padLeft[format[trueDistance[time, Planet.Earth, planet], au, 9], 12, " "]
   mag = padLeft[format[planet.getMagnitude[time], 1, 1], 4, " "]
   println[planet.getName[] + "\t" + padLeft[format[(az + 180 degrees) mod circle, degrees, 6], 10, " "] + "\t" + padLeft[format[alt,degrees,6], 10, " "] + "\t$distance\t$mag\t" + (alt > 0 degrees ? "*" : "")]
}


Download or view planetLocations.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20203 days, 10 hours, 11 minutes ago.