New tab window to the sky / by Sebastian Morales

This idea was inspired by spending too much time in front of the computer and not enough time looking at the moon. 

I first started by looking at the Astronomical Applications Department website (, in particular at their moon phase api. 

Here I learned that the most basic api call I could make was something like this:


Which in tern returned a JSON string with well... todays moon. 

  "error": false,
  "apiversion": "1.3.0",
  "year": 2016,
  "month": 10,
  "day": 27,
  "numphases": 1,
  "datechanged": false,
  "phasedata": [
      "phase": "New Moon",
      "date": "2016 Oct 30",
      "time": "17:38"

See how the date I entere (Oct, 27) doesn't match the date returned for the phase (Oct 30)? Thats because Oct 27 did not have a full phase and the next actual phase was Oct 30. 


This was my first swing at using APIs but I realized that I could go much deeper still exploring this same API.

The sun

Using a couple of extra parameters, I could get not only the phase of the moon but also the time it would set and rise for a given location. The same was true for the sun which made me excited about doing a day animation.

"city":"New York",

            {"phen":"BC", "time":"6:52 a.m. DT"},
            {"phen":"R", "time":"7:20 a.m. DT"},
            {"phen":"U", "time":"12:40 p.m. DT"},
            {"phen":"S", "time":"5:59 p.m. DT"},
            {"phen":"EC", "time":"6:27 p.m. DT"}],

            {"phen":"R", "time":"3:17 a.m. DT"},
            {"phen":"U", "time":"9:50 a.m. DT"},
            {"phen":"S", "time":"4:16 p.m. DT"}],

"closestphase":{"phase":"Last Quarter","date":"October 22, 2016","time":"3:14 p.m. DT"},
"curphase":"Waning Crescent"

The structure is slightly different so it required a little tweaking but nothing crazy. What took a while to figure out is that for some days, the moon will set before it rises... WHAT??? This happens when the moon rises duing the evening and sets in the morning, as you would usually expect, the problem is that the moon is setting on the next different day. Which means that if you only look at one day, the moon will set before it rises. This kept causing all this problems in my animation where you would see the moon come out from the wrong side and set on the opposite time at the wrong time. 

At the end I decided to include this little program as my default new tab in chrome, meaning that every time I open a new tab I see a subtle reminder that there is more than pixels in this world, and that perhaps it is worth going outside to explore it.