Code covered by the BSD License  

Highlights from
Weather.gov U.S. Current Weather Conditions

5.0

5.0 | 1 rating Rate this file 2 Downloads (last 30 days) File Size: 3.24 KB File ID: #10339

Weather.gov U.S. Current Weather Conditions

by Skynet

 

13 Mar 2006 (Updated 08 Jan 2007)

Get U.S. location specific current weather data from Weather.gov.

| Watch this File

File Information
Description

WGOVCWC(SID) queries the XML Feeds of Current Weather Conditions as
provided by NOAA's National Weather Service (http://www.weather.gov), and
returns a struct containing current weather conditions for the area
specified by the corresponding four char SID(s) (Station ID(s)).

Data is available only for a limited number (about 1,800) of locations
across the United States and U.S. Territories. To determine the four char
Station ID(s) of the relevant location(s) and for more information, visit
http://www.weather.gov/data/current_obs/.

The input argument SID can be a single Station ID, or a char or cell
array of Station IDs.

Data is acquired in XML format, after which it is converted into a struct
using the xml_parse function. This function is available in the XML
Toolbox by Marc Molinari on the MATLAB Central File Exchange (File ID
4278).

EXAMPLES:

Example 1: Using a single SID.
wgovcwc('KNYC') returns a 1x1 struct containing fields (among others):

location: 'New York City, Central Park, NY'
observation_time: 'Last Updated on Mar 13, 5:51 pm EST'
weather: 'Fair with Haze'
temp_f: 57
relative_humidity: 78

Example 2: Using a char array of three SIDS.
wgovcwc(['KNYC';'KJFK';'KHPN']) returns a 3x1 struct.

Example 3: Using a cell array of three SIDs.
wgovcwc({'KNYC';'KJFK';'KHPN'}) returns a 3x1 struct.

[Please subscribe to this file if you use it, so you can be notified of updates.]

MATLAB release MATLAB 7.3 (R2006b)
Other requirements XML Toolbox by Marc Molinari: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=4278&objectType=file
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
12 Mar 2007 Joe Lotz

I don't have a use for this in any current projects but it rates an A+ on the geek factor!
Nothing put it in a wrapper script called weather so I just type weather at the command prompt and my co-workers are shocked. They are still searching for the "weather" command in Matlab, hahaha!
I found this while looking for XML resources. Nice example.

Please login to add a comment or rating.
Updates
15 Mar 2006

Disabled unnecessary warning while using xml_parse.

16 Mar 2006

Added an example on using a char array as the input argument.

17 Mar 2006

Updated subfunction to allow nested str2double conversion.

20 Mar 2006

Increased clarity and specificity of error messages, and made minor updates to help and description.

21 Mar 2006

Added implicit support for char and cell array inputs.

08 Jan 2007

Removed extra line breaks, and added hyperlinks to relevant error messages.

Tag Activity for this File
Tag Applied By Date/Time
external interface Skynet 22 Oct 2008 08:18:22
atmosphere Skynet 22 Oct 2008 08:18:22
climate Skynet 22 Oct 2008 08:18:22
meteorology Skynet 22 Oct 2008 08:18:22
noaa Skynet 22 Oct 2008 08:18:22
nwc Skynet 22 Oct 2008 08:18:22
temperature Skynet 22 Oct 2008 08:18:22
weather Skynet 22 Oct 2008 08:18:22

Contact us at files@mathworks.com