Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote some code which retrieves temperature data from three cities every hour for five days. My problem is that the default station from which WeatherData[] gets its data is sometimes unavailable. Therefore, I want to know how I can find the list of weather stations for a city so I can retrieve data from an alternative station when the default station is unavailable.

share|improve this question
The "More Information" part of the WeatherData doc page says: "WeatherData[{spec,n}] gives a list of the n nearest weather stations for which data has ever been available. ". Could you please read the documentation before asking questions? – Sjoerd C. de Vries Nov 16 '12 at 13:32
up vote 10 down vote accepted

If you type this:

WeatherData[{"Chicago", 3}]
(* {"C3175", "KCGX", "C8163"} *)

you get the the list of the 3 nearest weather stations. And, you can also get the distance of the stations from the specified location:

WeatherData[{"Chicago", 3}, "StationDistance"]
(* {3.49298, 6.57245, 7.54408} *)

Or you can get other weather station properties, such as elevation, coordinates, date range, etc.:

WeatherData[#, "Elevation"] & /@ WeatherData[{"Chicago", 3}]
(* {198., 181., 183.} *)
share|improve this answer
Thanks! its a relief – Soum Nov 16 '12 at 12:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.