GeekTool Weather Information from Yahoo! for 2019

Update (March 18, 2019): As of Thursday, Jan. 3, 2019, the and for Yahoo Weather API are retired.  New APIs using OAuth1 are now available.  Details here.  Version 2.0 incorporating OAuth1 and switching to JSON for retrieval can be found here.

Update (May 7, 2016): Many thanks to kind reader @chogc who asked about the metric option to display temperature in Celsius.   That feature has been corrected.  I also implemented a workaround of a Yahoo! weather bug in which the sunset time string drops the leading zero for the minutes in some locations.  Version 1.1 incorporating these fixes can be found here.

I’m a long-time GeekTool user, which I use to display various pieces of information on my Mac desktop. One of my favorite displays is current weather information. A few years ago after browsing on the Internet for various weather geeklets and scripts, I settled on one created by Thomas Upton written in Python that used Yahoo! weather for displaying current conditions, called

Yahoo! Weather Feeds With Python

I also used two additional scripts from other sources for displaying a current weather image icon obtained from Yahoo! and another that displayed a five-day weather forecast.

Over the years, problems arose with the current weather image icon script that required various workarounds, such as switching to the French Yahoo! weather site for images.

A few months ago, all three weather scripts stopped working. I searched around for answers, which led me to various theories (see here and here) as to why the scripts no longer worked. Ultimately, the problem was due to a query change instituted by Yahoo! in its public API for retrieving weather conditions and forecasts.

I thought about patching the various scripts.  Instead, I chose to base a consolidated solution for displaying a weather icon, current weather conditions, and forecast upon Thomas Upton’s original Python script, which I called, partnered with a custom Bash script called for assisting with the current weather icon handling.

The changes I made to the original Python script were four-fold:

  • First, I modified the query request to Yahoo! Weather to use the new format request (more about that shortly);
  • Second, I added output of a short weather description so that I could build a Bash “wrapper” script to select a corresponding weather image from a collection of icon files for display purposes;
  • Third, I added day-night awareness to permit selection of day-night-dependent weather icons; and
  • Fourth, I added the optional display of the sunrise and sunset times and a few other weather options such as wind chill (also known as the “feels-like” temperature).

Using the Yahoo! Weather Developer documentation, I added the additional data structures to the Python script needed to obtain the additional weather information, and I also added a few new runtime options for requesting the sunrise/sunset times, determining whether it is currently day or night, returning the weather code defined in the Yahoo! Weather Developer documentation, returning the last update time for the current weather conditions, and returning the wind chill.

I also used the query change information described here to alter how the script fetched weather information from Yahoo!  One of the other consequences of the query change required a switch from using ZIP Codes to using WOEID (“Where On Earth ID”) as a location identifier. For example, queries that used to look simple like this:

changed into more complex queries that looked like this:

After making the query change to the Python script (and finding my WOEID, which I did here), collecting a set of weather icons that I liked, and creating a new Bash wrapper script for handling weather images, the results on my desktop look like this:


I’m rather pleased with the result.

If you’re a GeekTool user, here is how I constructed the above, with each rounded rectangle representing a different geeklet in GeekTool:


  • ~/Applications/ is a Bash script that calls Yahoo! weather via the Python script to obtain the short description of the current weather condition. Based on that description, the Bash shell copies the associated weather icon file to the location /tmp/weather.png.
  • file:///tmp/weather.png shows the result of the ~/Applications/ Bash script
  • ~/Applications/ –lvrs 12791684 calls Yahoo! weather and displays the location, sunrise, sunset, and current conditions in verbose mode for WOEID 12791684 (which is my location).
  • ~/Applications/ –-nocurr –f5 12791684 calls Yahoo! weather and displays a five-day forecast for my location without displaying the current weather status; echo Five day forecast: is for display purposes.

I’ve put the Python script, Bash script, and a set of weather icons into a zip archive, which you can grab here. I also put the geeklets in the archive for your use if you’re a GeekTool user. Just double-click the geeklets to install them into GeekTool, and customize the geeklets based on your WOEID and where you placed the scripts and weather icon folder. I placed mine in ~/Applications (the Applications folder inside my home folder, not the main Applications folder where applications are kept). If you place the scripts and weather icon folder into an alternative location, also make the corresponding location mods to the script.


GeekTool Weather Information from Yahoo! for 2019

LED Versus Incandescent Bulbs (3rd Update)

In LED Versus Incandescent Bulbs (An Update), I mentioned that I replaced the incandescent bulbs in my kitchen with LED bulbs:

  • Former: BR-30 soft white bulb, 65 W, 635 lumens, 2700K
  • New: Philips SlimStyle 65W-equivalent BR-30 soft white bulb, 9.5 W, 650 lumens, 2700 K

Over the following year after switching to the LED bulbs, I felt as if my electricity bills were slightly lower. To verify, I pulled my electricity bills and computed the total energy cost for the year before versus the year after. I found I actually saved $120 in electricity costs. I decided to perform some match to see if the amount of savings was directly attributable to the lower energy consumption of the LED bulbs in the kitchen.[1]

If your home is like mine, the kitchen is the center of activity in the home. In my kitchen I have five bulbs that burn, on average, about eight hours per day – two hours in the morning, and six in the evening, roughly. The power consumption for one of the LED bulbs I mentioned earlier is 55.5 W less than the equivalent incandescent it replaced. Multiply by five bulbs yields 277.5 W less to light the kitchen with the LED bulbs than with the incandescent bulbs.

To figure out annual energy usage and cost per year, I’ll perform some simple math. First, I’ll convert 277.5 W into kilowatts by dividing it by 1000, and then calculate the energy usage in kilowatt-hours per year:

0.2775 kW * 8 hours/day * 365 days/year = 810 kW-hr/year

At 12 cents per kilowatt-hour rate for electricity in my area, the result is an annual net savings of about $97:

810 kW-hr/year * $0.12/kW-hr = $97/year

That’s in the ballpark of the $120 in savings I actually saw.

The bottom line is that the decrease in my electricity bills is highly correlated to the switch from incandescent bulbs to LED bulbs in my kitchen. It gives me a thought to identify other opportunities to save elsewhere in the house. At least from a lighting standpoint, I know I have to be careful to identify higher-usage lights to be able to recoup the costs of the LED bulbs. But there are other electricity-consuming devices in the house….

[1]Clearly, variations in usage of other electricity-consuming devices will pollute the answer. In Houston we rely upon air conditioning to bear the warmer months, which is often a big consumer of electricity and causes large seasonal variations in total energy cost from month to month. By taking the annual average and assuming that the usage of electricity is the same from year to year, it should negate these seasonal effects.

LED Versus Incandescent Bulbs (3rd Update)

Two Views on NASA Restructuring


In space policy circles, the House Space Subcommittee held a hearing this month on the restructuring of NASA. I found two different perspectives on this hearing, one normative and one descriptive. (On perspectives, descriptive is “the way things are”, and normative is “the way things ought to be.” Neither is wrong; they are simply two different perspectives.)

The descriptive view is from the ever excellent Marcia Smith, who describes details from the hearing in “Witnesses Support Goal of NASA Restructuring Legislation, But Not Specifics”.

The normative view is from Paul Spudis, who always tells you what he is thinking; his account in “Stability and Instability in Space” is no different.

Some tidbits from the hearing:

Former NASA Administrator Mike Griffin testified that “our space policy is bankrupt” and that the current space policy implementation offers “no dream, no vision, no plan, no budget, and no remorse.” Mike is always good for a quote or two. One of my favorites from my brief time in Washington during his tenure as NASA Administrator was “I can explain it to you, but I can’t understand it for you.”

Discussions addressed three provisions for legislation, with my comments afterwards:

  • Create a Board of Directors to govern NASA and submit its own budget request directly to Congress without going through OMB. Did you know that a GS-12 at OMB is in charge of establishing NASA’s budget? (Well, that is stretching the truth a little bit, but not by much!) I’ll go out on a limb and put my stock on the NASA budget created by the proposed Board of Directors, rather than the one established currently by a GS-12 at OMB.
  • Appoint the NASA Administrator for a fixed term of 10 years. This is similar to what is done for the FBI Director, who is appointed for a 10-year term. Other executives appointed in a similar manner but for different lengths are the NSF Director and FAA Administrator, who are appointed for six and five years, respectively.
  • Use “long term” contracting to permit NASA to contract for certain space acquisition needs at the outset. With today’s procurement restrictions, even though NASA authorizes the execution of the entire scope of a contract at the outset, the contract is still funded and budgeted on an annual basis. Using “long term” contracting is a capability similar to one that DoD has in certain areas, such as shipbuilding, and should mitigate somewhat the year-to-year policy and funding fights…and we know those are common occurrences in Congress nowadays.

Dr. Spudis uses the hearing as more evidence that the current space policy is a mess. According to Dr. Spudis, NASA’s space policy implementation has as its centerpiece a “#JourneytoMars” PR campaign, which he likens to “a hodge-podge of real hardware and fake missions, with a thick icing of Hollywood schmaltz…” This is clearly a normative argument.

Dr. Spudis also uses the hearing to support his ongoing narrative that US space policy needs to be adjusted to include a return to the lunar surface for longer-term stays and utilization. On this point we agree. Some of the comments to Dr. Spudis’s article are worth a read, too.   Many are in keeping with the normative tone that Dr. Spudis uses throughout his writings on space policy, but nevertheless raise valid points worth further discussion.

Overall, both articles are good reading about what is happening today in space policy circles. As for the likelihood that we will see any of the provisions incorporated into a bill to be enacted into law, it’s anyone’s guess. As to election politics, I fully expect space policy to play little to no role in the upcoming Presidential elections. I anticipate that it will be at least a year after the election – no sooner than early 2018 – for the new Presidential administration to decide if it is time to change course – yet again. Meanwhile, those of us in the space business will continue working towards the future.

Two Views on NASA Restructuring

Challenger at 30

This is a somber week for those of us in the space business as we pause and reflect on those who we lost. The Space Shuttle Challenger accident happened 30 years ago this week. Below are several links I collected that capture much of what I’m feeling this week.

NASA Day of Remembrance:

New York Times: The Challenger Space Shuttle Disaster, 30 Years Later

NPR: 30 Years After Explosion, Challenger Engineer Still Blames Himself The Challenger seven remembered 30 years after STS-51L

Quartz: 30 years ago, NASA lost 7 astronauts in the Challenger explosion. Here’s how it moved forward.

For anyone middle age and older, I’m sure you can recall with crystal clarity where you were when news broke that Challenger exploded a little more than a minute into its flight. Either you saw it as it happened, or heard about it moments afterwards. I was newly in graduate school, having arrived at the University of Illinois a little more than a week before the accident. I remember being shocked, seeing the tragedy unfold before my eyes, and deeply saddened about the loss of life, asking myself, “Was it worth it?” President Reagan’s words afterwards convinced me that we needed to move forward while honoring those who paid the ultimate sacrifice. His words helped build a resolve in me such that in a short two years after, I joined the ranks of the men and women who were at the time working to return Shuttles to flight. That’s where I’ve been ever since.

Challenger at 30

2015 in review

Many thanks to my loyal readers.  Here’s to a successful year just completed, and to the new year to come!

The stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 15,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 6 sold-out performances for that many people to see it.

Click here to see the complete report.

2015 in review

Space Resource Rights


Last week, the President signed H.R. 2262, the Spurring Private Aerospace Competitiveness and Entrepreneurship Act of 2015, into law. Noteworthy in the new law is a means for the United States to open up the commercial development of space beyond tourism by permitting firms to own the resources they extract from celestial bodies such as asteroids and moons.

A nice summary of the act and provision pertaining to resource rights is here.

Dr. Paul Spudis is more critical of the usefulness of the new law, which he examines here.

I don’t take as dim of a view as Dr. Spudis on the new law. Sure, H.R. 2262 skirts the problem of “property rights” by outright avoiding. Instead, it addresses the ownership of the resources extracted from celestial bodies without addressing property ownership. However, as a change enacted successfully in the current political environment, I consider H.R. 2262 as a necessary and good first step to spur development of companies willing to extract resources and make them available on the commercial market. Later, once the possibility of extraction becomes a reality, legislative steps can be enacted to address issues as they arise.

In the bigger picture, I see extraction of celestial resources as an example of a transformative change – one in which we can envision the basic concept, yet the means to accomplish the goal are so complex and the outcomes are so unpredictable that to encompass laws around it based on past precedent and what we know today would be counterproductive and naïve – and likely suppress the very thing we are attempting to grow. The provision on resource rights in H.R. 2262 is a step in the right direction.

Space Resource Rights



Today, the Cassini spacecraft is scheduled to make its closest approach ever to the Saturnian moon Enceladus. Flying to within 50 km of the surface, Cassini hopes to probe the chemical makeup of the geysers spewing from the south pole of Enceladus. Previous investigations indicate the high probability of an ocean beneath the crust of Enceladus, and this latest investigation will seek the tell-tale signs of chemistry that might indicate the presence of life.

Here are some links that explain further:


Mars News

This week NASA announced that it has discovered evidence that liquid water is flowing on Mars.  Not just in the past as previously announced, but now.

The existence of liquid water on the surface of Mars is rather unexpected. To understand why, look at the following phase diagram chart, showing the states of water as a function of pressure (vertical axis) and temperature (horizontal axis):


On the surface of the Earth, we live at 1 atm. This means that water exists as a solid (“ice”) at a temperature below 0 degrees Celsius, as a liquid (“water”) between 0 and 100 degrees Celsius, and as a gas (“water vapor”) above 100 degrees Celsius. You can see this in the diagram above by following the horizontal dotted line from left to right at P = 1 atm.

Let’s look at Mars.  The atmospheric pressure on the surface of Mars is about 0.006 atm. Look at the chart above.  At an atmospheric pressure of 0.006 atm, liquid water is just on the knife-edge of being able to exist at all. If the pressure were slightly lower than 0.006 atm, water would transition directly from a solid to a gas with an increase in temperature. (An example with which you’re familiar on Earth is carbon dioxide, which transitions directly from a solid  we call “dry ice” to a gas at 1 atm). Slightly higher, liquid water could exist, but only in a very narrow band of temperatures.

Atmospheric pressure and temperatures make the existence of liquid water on Mars an extreme challenge.  At the very least, the above phase diagram shows why finding liquid water on the surface of Mars is very surprising.  Perhaps minerals and salts dissolved in the water shift the phase diagram enough to permit liquid water to exist under a broader range of temperatures. It is certainly worth exploring further, in person.

Speaking of exploring in person, Eric Berger (@chronsciguy) of the Houston Chronicle wrote an article about why it is so hard to get to Mars. Definitely worth reading.

Mars News

August Volatility in the US Stock Market


Driving home the other day, I heard a segment on NPR that was discussing the recent market downturn and its possible causes. Interestingly enough, one of the guests during the segment asserted the following:

“Firstly, the markets are very thin right now because it is August and you have a lot of the seasoned traders away on vacation. You’ve got less volume than anywhere in the markets. And so there’s a long tradition of people overreacting during this vacation season.”

When pressed on this point, the guest analyst didn’t waiver:

“But the reality is that, you know, many of the most seasoned and senior traders tend to go on vacation this time of year. And yes, we can all remain in contact with our iPhones and our iPads and whatever else while we’re on the beaches. But traditionally, you have had a lot of pretty wild market movements in the month of August historically.”

The question of volatility seems to be an easy point to test. First, some assumptions:

  • A market index such as the S&P 500 is an indicator of the broader market performance.
  • Volatility is high if the closing price on a given day is markedly different (up or down) than the closing price on the day prior.
  • A given month is more volatile if it has more high-volatility days than another month.

Based on the assertion that August volatility is caused by junior traders, I infer that with senior traders in charge, there should be less volatility. Otherwise, I claim that the causal relationship between volatility and the seniority of the traders is not provable.

To test the theory, I downloaded the S&P 500 closing prices for the last 10 years and performed some calculations. First, for each day I calculated the change in closing price, and percentage change in closing price. Here is an example:


S&P 500 Closing Price

Change from Previous Day
C(i) = P(i)-P(i-1)

Percentage Change from Previous Day
R(i) = C(i)/P(i-1)



















The variations in the percentage change in closing price, calculated by finding the standard deviation, will provide the measure of market volatility in accordance with the assumptions above.

Using the S&P 500 closing prices for the last 10 years, performing the above calculations, segregating the data into 12 separate monthly bins, and calculating the standard deviations for each monthly bin yields the following:

 Month Standard Deviation Rank
Jan 0.0114 7
Feb 0.0109 8
Mar 0.0128 5
Apr 0.0096 12
May 0.0105 10
Jun 0.0109 9
Jul 0.0100 11
Aug 0.0136 4
Sep 0.0141 3
Oct 0.0191 1
Nov 0.0168 2
Dec 0.0122 6

Based on the daily variations in the S&P 500 closing prices over the last 10 years, it is true that August is one of the more volatile months. However, the variations in August are exceeded by the Fall months – September (#3), November (#2), and October (#1). Therefore, if the “junior varsity” traders being in charge cause volatility in August, what is the explanation for the even higher volatility in the Fall months?

Perhaps the guest analyst had some other measure of volatility in mind – inter-day swings in prices, daily trading volume, or something else I haven’t considered. Based on the volatility in daily closing prices, however, August is in the top half of volatile months, but isn’t as volatile as the Fall months. Therefore, I question the association of August volatility with junior traders. Based on data over the last 10 years, it doesn’t seem to be a viable explanation based on the assumptions above.


Is The Stock Market Volatility A Correction Or A Full-Blown Crisis? August 25, 2015

S&P 500 Historical Data, last updated 2015-08-26 6:51 PM CDT

Image via

August Volatility in the US Stock Market

2, 4, 8


A few weeks ago I ran across a very simple puzzle. It is a rule based on a sequence of three numbers. Some sequences obey the rule – and some do not. The challenge is to guess what the rule is. According to the opening paragraph of the article accompanying the test, the test sheds light on government policy, corporate America and why no one likes to be wrong.

The puzzle starts with the following:

2, 4, 8 – obey the rule.

Then it is up to you to provide other sequences and guess the rule.

Here is the link:

Go ahead.

Give it a try.

I won’t spoil it for you.

Once you’ve given it a try, return here.

I’ll wait.

(Jeopardy music.)

What did you think? Did you guess correctly?

The test explores confirmation bias. Were you willing to search for a “No” answer, or did your couch your guesses to give “Yes” answers? In my case, I started with a specific sequence that gave “Yes’s”: A x B = C, and tried a few others that all led to “Yes” as well.

I wondered: are there any sequences that give “No?”  So, I took a stab until I got a “No.”

The first “No” answer taught me more than all the “Yes’s” I got before. I kept trying to get “No’s.” In the end, I got 5 “Yes’s” and 7 “No’s”, at which time I decided upon an answer: each number in the sequence is greater than the number before it.

The first lesson I took away is that this test applies to more problems than those dealing with numbers.   The basic principle is applicable to many situations we face every day. In the weeks following the test, when I faced a situation and thought I knew the answer, I said to myself, “2, 4, 8.” It’s my self-cue to ask another question.

Another key takeaway: the best questions are those in which I get the opposite of what I was expecting. Such an answer shakes up confirmation bias and tells me something new.

2, 4, 8 – a simple yet powerful test to challenge confirmation bias.

2, 4, 8