GeekTool Weather Information from Yahoo! for 2016

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 weather.py:

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 weather-new.py, partnered with a custom Bash script called weather-condition.sh 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:

http://xml.weather.yahoo.com/forecastrss?p=77001

changed into more complex queries that looked like this:

https://query.yahooapis.com/v1/public/yql?q=select+%2A+from+weather.forecast+where+woeid%3D12791322&format=xml

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:

Window-Weather

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:

Geektool-Weather

  • ~/Applications/weather-condition.sh is a Bash script that calls Yahoo! weather via the weather-new.py 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/weather-condition.sh Bash script
  • ~/Applications/weather-new.py –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/weather-new.py –-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 weather-new.py Python script, weather-condition.sh 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 weather-condition.sh script.

Enjoy!

GeekTool Weather Information from Yahoo! for 2016

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

Culberson-300x223

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: http://www.nasa.gov/externalflash/DOR2016/index.html

New York Times: The Challenger Space Shuttle Disaster, 30 Years Later http://www.nytimes.com/interactive/2016/01/29/science/space/challenger-explosion-30-year-anniversary.html

NPR: 30 Years After Explosion, Challenger Engineer Still Blames Himself http://www.npr.org/sections/thetwo-way/2016/01/28/464744781/30-years-after-disaster-challenger-engineer-still-blames-himself

NASASpaceFlight.com: The Challenger seven remembered 30 years after STS-51L http://www.nasaspaceflight.com/2016/01/the-challenger-seven-remembered-51l/

Quartz: 30 years ago, NASA lost 7 astronauts in the Challenger explosion. Here’s how it moved forward. http://qz.com/604712/30-years-ago-nasa-lost-7-astronauts-in-the-challenger-explosion-heres-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 WordPress.com 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

asteroid-mining

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

Enceladus

Enceladus

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:

Enceladus