6

I am curious whether there is some place where one can look up the mapping between actual location and weather station (I assume) acronyms. E.g., what the heck is "KNDZ"?

Igor Rivin
  • 5,094
  • 20
  • 19

2 Answers2

8

You can get a latitude and longitude for the weather station and plot a GeoMarker at that location like this

latlon = WeatherData["KNDZ", #] & /@ {"Latitude", "Longitude"};
gp = GeoPosition[latlon];
plot = GeoGraphics[GeoMarker[gp]]

For a full list of properties of the weather station, use WeatherData["KNDZ", "Properties"]

LouisB
  • 12,528
  • 1
  • 21
  • 31
8

You can use the Weather Underground API to look up information that is not present in WeatherData[] (tho you need to register to get an API key):

$WUAPIKey = (* insert API key here *);
SetAttributes[WULookup, Listable];

WULookup[station_] := Module[{s = station, chk, loc, pos, raw},
  If[Head[s] === Entity, s = CommonName[s]];
  raw = Import["http://api.wunderground.com/api/" <> $WUAPIKey <> "/geolookup/q/" <>
               s <> ".json", "RawJSON"];
  chk = Lookup[raw["response"], "error", True];
  If[TrueQ[chk],
     {pos, loc} = TakeDrop[Lookup[raw["location"],
                                  {"city", "state", "country_name", "lat", "lon"}], -2];
     GeoGraphics[GeoMarker[GeoPosition[Internal`StringToDouble /@ pos]], 
                 PlotLabel -> Row[DeleteCases[loc, ""], ", "]],
     Failure[chk["type"], chk["description"]]]]

For example:

WULookup[{"AYWK", "BGBW", "CWSS", "KNDZ", "YMES"}] // GraphicsRow

lookup result

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574