planetLocations.frink

View or download 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

time = now[]

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 ? "*" : "")]
}


View or download 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 17897 days, 19 hours, 41 minutes ago.