TysonTweet.frink

View or download TysonTweet.frink in plain text format

// Neil deGrasse Tyson claimed that the sun set directly west every day for
// people on the the equator.  Huh?!
// https://twitter.com/neiltyson/status/246033957014093824

use sun.frink

lat = 0 degrees North
long = 0 degrees West
lowest = 360 degrees
lowestDate = now[]
highest = 0 degrees
highestDate = now[]

format = ### yyyy-MM-dd HH:mm:ss ###
println["<TABLE>"]
for date=#2012-01-01 12:00 UTC# to #2013-01-01 12:00 UTC# step 1 day
{
   sunset = sunset[date, lat, long]
   [az, alt] = refractedSunAzimuthAltitude[sunset, lat, long]
   geoAz = (az + 180 degrees) mod circle  // Turn Meeus azimuth to geodetic
   println["<TR><TD>" + (sunset->[format, "UTC"]) + "<TD>" + format[geoAz,"degrees",3]]
   if (geoAz < lowest)
   {
      lowest = geoAz
      lowestDate = sunset
   }
   if (geoAz > highest)
   {
      highest = geoAz
      highestDate = sunset
   }
}

println["</TABLE>"]
println["Most southerly sunset is " + format[lowest, "degrees", 3] + " on " + (lowestDate->[format, "UTC"])]
println["Most northerly sunset is " + format[highest, "degrees", 3] + " on " + (highestDate->[format, "UTC"])]

println["The sun sets as much as " + format[270 degrees - lowest, "degrees", 3] + " south of due west."]
println["The sun sets as much as " + format[highest - 270 degrees, "degrees", 3] + " north of due west."]


View or download TysonTweet.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 17478 days, 1 hours, 26 minutes ago.