Get weather forecast on Raspberry Pi

Source: Internet
Author: User

Everyone seems to be very concerned about weather forecasts. Of course, obtaining accurate weather forecasts is very useful for your travel plans and other activities. Weather forecast information can be obtained in many places, such as webpages, most smartphones or tablets. Now you can use the "wether" tool on Raspberry Pi to obtain the weather forecast information through command line.
 
"Weather" can be installed from Raspberry Pi's official sources:

Sudo apt-get install weather-util

The Weather tool retrieves Weather conditions and forecasts from METARs (Meteorological Aerodrome Reports), NOAA (the USA National Oceanic and Atmospheric Administration), and NWS (the USA National Weather Service. This allows the tool to focus primarily on the United States. However, you can also obtain weather information for areas with international airports around the world.

The simplest way to get weather conditions is to query the nearest Airport using the ICAO Code (International Civil Aviation Organization Airport Code. To get the weather at New York's Kennedy International Airport, run the following command:

Weather jfk

The complete ICAO code of Kennedy International Airport is actually "KJFK" (starting with K like all neighboring airports in the United States), but the three letters are equally valid for airports in the United States, for example, "DFW", "LAX", and "ATL. However, for international airports, the complete ICAO code must be used. So London's Heathrow Airport is "EGLL", Paris's Charles de Janeiro airport is "lp-2", Amsterdam's shikipu airport is "EHAM" and so on.

To view the weather at London Heathrow Airport, use:

Weather egll

Another way is to use zip code ." Weather "comes with a zip code list used to obtain the nearest meteorological station. Unfortunately, this only applies to the United States rather than the world, but the zip code covers the entire United States. For example, the Linux foundation is headquartered in San Francisco, California, and its zip code is 94110. You can use the following command to obtain weather information:

Weather 94110

You can also use place names to obtain weather information, but place names must be strictly matched. Try the following command:

Weather 'New york'

"Weather" will tell you that search is too ambiguous (the search term is too vague) and returns at least 10 results, including "New York township-MO ", "New York City-NY" and "New York Mills city-MN" Kuala Lumpur International Airport.

If you add more accurate information, you will get the desired result. Try this:

Weather 'New york city central park'

You can use the "-f" option to obtain the weather forecast for 7 days. Obtain weather information for use near Los Angeles International Airport:

Weather-f lax

. Weatherrc

It may take several minutes to get weather information, especially when you search by name. This is not because of the delay in obtaining information on the Internet, but because the "weather" tool requires a list of airport names, place names, and zip codes to be searched. Because the information is not included in the database but listed in text form, the search will be slow.

To speed up search, you can create an alias for all the data that the tool uses to directly access the network.

First, you need to find the name of the nearest meteorological station. Use the "-info" option to do this. It provides detailed information about the weather forecast source. The following is a search using the zip code 20560, which is the zip code of the Smith senyi society in Washington.

Weather -- info20560

The results show that the data source's weather station is actually only 2.5 miles away from the Washington National Airport. The airport code is "kdca ".

Create a weather configuration file (named. weatherrc) in your home directory ):

Nano ~ /. Weatherrc

Add the following lines:

[Smithsonian]
Description = The Smithsonian Institution
Metar = http://weather.noaa.gov/pub/data/observations/metar/decoded/KDCA.TXT

Note: "metar = http ..." Keep the same row.

Press Ctrl + X to exit and save.

To obtain the weather conditions of the Schmidt Society, you only need to enter:

Weather smithsonian

The returned result is very fast because the tool has obtained all the information it uses to obtain the data, instead of checking the entire list.

You can add multiple aliases for a data in ". weatherrc". You only need to write the information in the "metar" section correctly.

Why don't you try "weather" in person? If you have any questions, please leave a message at your original blog address.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.