Can we specify to use the closest weather station?

  • 2
  • Question
  • Updated 3 years ago
Here is a lookup for a location in Modi'in, Israel.

http://api.wunderground.com/api/a75da...

You have a very accurate PWS for this location that is 3km away. But you identify the location as Abu Ghaush and provide the forecast for a much further away and less accurate weather station.

Can you provide a way to get the forecast for the closest weather station?
Photo of DylanG

DylanG

  • 6 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 2
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
Its because of the lat/lon search. Lat/lon resolves to an area, and then gives you the weather for the center of that area. Like throwing a dart at a dart board, you'll always get the bullseye. You can try a city, country search which will make it exact, or you can also find out the PWS ID of the station you like and specifically request it, like this: http://api.wunderground.com/api/a75da...
Photo of DylanG

DylanG

  • 6 Posts
  • 0 Reply Likes
Thank you for the reply.

It's odd that you'd go through a process that loses fidelity instead of simply using the closest station when you know that information. In the case of the above query in Israel, my customer is telling me that the climate is very different in the location returned. It's a shame because you have a more accurate station you could be using.

I realize I could parse out the stations, pick the closest one myself, and resubmit the query. But this requires two queries which means the user waits twice as long and we use twice as many of our monthly API calls.

You already have this data. It seems like it would be easy (and beneficial) for you to provide a way to use the closest station with one call to the API.
Photo of DylanG

DylanG

  • 6 Posts
  • 0 Reply Likes
To clarify, it's not just the customer in Israel who is complaining. We have a number of customers outside the US who are reporting unexpected locations. It's causing us a lot of grief and some poor reviews. It's a major problem for us with no good solution while it seems like it should be an easy thing for you to offer given that you already know the distances of your weather stations from the lat/lon provided.
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
I know what you mean. I thought you had added a "nearby" feature to your app to help narrow down the correct location? If it was actually an easy thing for us to fix we would have long ago. Using the shape file search with lat/lon is the best way for us to match a coordinate to a location serving weather, though not exactly the most accurate as you point out. We're looking into ways to make this better. To aid you in this, you could do a geolookup on the lat/lon and then give the user the best option, but as you say, that is 2 api hits. You might also try our autocomplete for searches because that will point to the right location, and does not count as an API hit to your key.
Photo of solarhavenfarm

solarhavenfarm

  • 2 Posts
  • 0 Reply Likes
How do I create a query for data using the PWS ID instead of the city name? Is there documentation available which describes the various options that I have for a query?
Photo of Brendan Hayes

Brendan Hayes, Official Rep

  • 962 Posts
  • 122 Reply Likes
PWS searches are the last example here: http://www.wunderground.com/weather/a...
Photo of hcorp

hcorp

  • 1 Post
  • 0 Reply Likes
Can you please provide further clarification on querying data by weather station? This is the weather station I need: http://www.wunderground.com/weatherst... and I'm assuming the pws id = MSWUIMNRDUB, however when I attempt to query using that ID the response always says "query not found".

I'm trying to load the forecast, what am I doing wrong?

http://api.wunderground.com/api/_myke...

Thanks!
Photo of ocpaul20

ocpaul20

  • 2 Posts
  • 0 Reply Likes
you can get the lat/long of each city through the free geonames database which would then require only one lookup on the wunderground api perhaps? It is not all that difficult to resolve which city is nearest to the closest weather station and select the ID of that station.
Photo of aqualogy

aqualogy

  • 4 Posts
  • 0 Reply Likes
This thread is two years old and today I have experienced the same problem: querying "condition" with lat/lon from the center of Barcelona (where there is plenty of PWS), I get the observation from Sabadell's airport (20 km away from Barcelona).

Have you implemented any solution to this issue (or are you going to) any time soon? If not, the alternative suggested above (calling geolookup first and then conditions for the closest PWS) is the only possibility to solve the problem?

Thank you very much!
(Edited)
Photo of Tim Roche

Tim Roche, Official Rep

  • 268 Posts
  • 19 Reply Likes
what do you consider to be the lat/lon of the center of barcelona?  Please give an example of your API call with the key removed so I can help you debug.  
When I search conditions for barcelona, i get the PWS ICATALUN65 which is close to the location we consider to be the center of barcelona
Photo of aqualogy

aqualogy

  • 4 Posts
  • 0 Reply Likes
I've found that the answer is different depending on the extension. Given the same coordinates, the query for xml returns Sabadell and the one for json returns the PWS ICATALOG2, which makes more sense.
http://api.wunderground.com/api/MyKey/conditions/q/41.394840,2.175369.xml
http://api.wunderground.com/api/MyKey/conditions/q/41.394840,2.175369.json
Photo of Tim Roche

Tim Roche, Official Rep

  • 268 Posts
  • 19 Reply Likes
If you are looking to get consistent results, you should use the geolookup and select a station.  PWSs go in and out of reporting and new ones are added frequently.  If an airport is close, sometimes quality control will decide that the quality of the ob at an airport is much better than the ob at a PWS site, and will chose that observation.
Photo of aqualogy

aqualogy

  • 4 Posts
  • 0 Reply Likes
Thanks Tim, I understand. Nevertheless, since geolookup does not provide info about the quality of a PWS, can I be sure that all the PWSs returned in geolookup are working properly?

Here is an example illustrating the problem:

These two lat/lon conditions calls are more or less 1.5 km away from each other:
http://api.wunderground.com/api/MyKey/conditions/forecast/lang:SP/q/41.395867,2.174073.js...
http://api.wunderground.com/api/MyKey/conditions/forecast/lang:SP/q/41.403605,2.190393.js...

I am worried about quality control returning airport's observation for the second call (20km away) when for the first one it is returning PWS ICATALOG2 (3 km away). Maybe that is because ICATALOG2 does not appear when you call geolookup for the second location:
http://api.wunderground.com/api/MyKey/geolookup/q/41.403605,2.190393.json
Photo of aqualogy

aqualogy

  • 4 Posts
  • 0 Reply Likes
I'm not sure you noticed the question in my last post but I really need an answer: 

Since geolookup does not provide info about the quality of a PWS, can I be sure that all the PWSs returned in geolookup are working properly?

There is a lot of variability between PWS quite close to each other.
Photo of Clark Endrizzi

Clark Endrizzi

  • 3 Posts
  • 0 Reply Likes
Agreed, this is not at all ideal and creates a lot of issues. What is the point of having all these personal weather stations if you can't even properly query to them?