2

I'm trying to use the NDFD (National Digital Forecast Database) to get current temperature and relative humidity given a Lat and Long using their REST based service.

The issue at hand:

I can't match the 'current observation data' WITH the 'results' I get back from the REST-service.

The setup:

Location:
* Apple (1-infinite loop, Cupertino, California)
* Lat = 37.33; Lon = -122.03

If I issue the following REST-call:

http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php?lat=37.33&lon=-122.03&product=time-series&begin=2009-06-21T17:12:35&end=2009-06-21T17:12:35&appt=appt&rh=rh&temp_r=temp_r&temp=temp

Note 1: I'm passing the begin and end time in UTC. They're the same because I'm looking for just a single-point-in-time: the latest observed temp and relative humidity.

AND, then compare it to what is the closet reporting stations (San Jose International Airport, CA - KSJC - 37.37N 121.93W) @ http://www.weather.gov/xml/current_obs/KSJC.xml

** I can never get them to MATCH. **

Note 2: The nearest reporting station is return back from the REST call as well, so I know I'm comparing Location apples to Location apples.

I've had two ideas:

1: I'm doing something wrong with how I'm passing in the begin/end times into the REST call...

2: You can't get 'current observed data' the way I'm trying to...

Lastly:

I've found a solution using outoftime's NOAA ruby lib , [it parses an observation stations YAML file to find the nearest one given Lat/Lng then goes directly to that station via its identifier i.e. http://www.weather.gov/xml/current_obs/KSJC.xml].... but it just feels like I may be missing something obvious here and would like to use the REST-based interface ;)

Any help or pointers would be appreciated!

Thanks!

killingmichael
  • 186
  • 2
  • 6

4 Answers4

1

It looks like the service you are calling isn't for current data. Judging by the URL and the XML results it seems to be for forecasts. You can also put in future dates to get future forecast data. It expects the dates to be in the -0700 time zone according to the response. I'm not sure which service you should be calling to get the data you want though.

laz
  • 28,320
  • 5
  • 53
  • 50
1

I know that this is an old question, but this is what I'm using to get current weather conditions: http://forecast.weather.gov/MapClick.php?lat=43.09110&lon=-79.0162&unit=0&lg=english&FcstType=dwml

Jesse
  • 915
  • 1
  • 11
  • 20
0

If you want the "current" observation, you use the XML here:

http://w1.weather.gov/xml/current_obs/seek.php?state=or&Find=Find

e.g.,:

http://w1.weather.gov/xml/current_obs/KAST.xml

If you click on the link you'll get a rendered page. However, if you pull from it using normal rest methods or just wget, it delivers an xml file.

Nathan Dunn
  • 447
  • 5
  • 16
0

Found this api/link yesterday. Its still developmental (operation-mode="developmental"):

http://forecast.weather.gov/MapClick.php?lat=37.33&lon=-122.03&FcstType=dwml