banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

Tip Top Tips: pmwf (Poor Man's Weather Forecast) - Three Day Weather Forecast


Editor's Note: Tip Top Tips is a semi-monthly column in The PCLinuxOS Magazine. Periodically, we will feature -- and possibly even expand upon -- one tip from the PCLinuxOS forum. The magazine will not accept independent tip submissions specifically intended for inclusion in the Tip Top Tips column. Rather, if you have a tip, share it in the PCLinuxOS forum's "Tips & Tricks" section. Your tip just may be selected for publication in The PCLinuxOS Magazine.



This month's tip comes from hakerdefo.

pmwf displays current weather conditions with a three day weather forecast for almost any location in the world. pmwf shows information for following weather parameters:

  • Weather Condition
  • Minimum Temperature
  • Maximum Temperature
  • Atmospheric Pressure
  • Humidity
  • Wind Speed
  • Wind Direction

One extra package is needed by pmwf. It is called jq. Installing jq is pretty easy. Just download and put jq binary somewhere in your $PATH with execute permissions.

jq binary for 64-bit
jq binary for 32-bit

Next, save the pmwf script somewhere in your $PATH with execute permissions.






Open the pmwf script in your favorite text editor. Right at the beginning of the file you will find four empty variables local_latitude, local_longitude, ocal_unit & api_key. You need to assign latitude & longitude of your location to the variables local_latitude & local_longitude. Chances are that you don't know latitude-longitude values for the place you live. No worries! It's easy. Tageo has geographic coordinate information of over 2,667,417 places across 193 countries. Go to this Tageo page and search for the latitude-longitude of your location.

Next, you need to assign your preferred units system to the variable ocal_unit. There are two main units systems in use. metric and imperial. Which one should you use? If you prefer to measure temperature in Celsius (Centigrade) & distance in Kilometres (km), use metric. And if you prefer to measure temperature in Fahrenheit & distance in Miles (mi), use imperial.

The final step is to get an API key from OpenWeatherMap. Don't worry. It's simple, and their free plan is good enough for our needs. Here is the link to the sign up page of OpenWeatherMap.

After registration, you'll get your unique API key. Assign this key to the api_key variables of pmwf script.

At this point, the variable section at the top of the pmwf script will look like this for someone in London, UK:

local_latitude=51.500
local_longitude=-0.117
local_unit=metric
api_key=your_api_key_here

And for someone in New York, US it would look like

local_latitude=40.714
local_longitude=-74.006
local_unit=imperial
api_key=your_api_key_here

Save the pmwf script file after assigning the variables. Open terminal, type pmwf, hit "Enter" and you'll have current weather conditions with a 3 day weather forecast of your location.

As with just about anything, your mileage may vary. While it works for most people, it may (on occasion) not work for you.

Question? Query? Suggestion? Bug? Shoot them!



Previous Page              Top              Next Page