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"?
Asked
Active
Viewed 292 times
6
Igor Rivin
- 5,094
- 20
- 19
2 Answers
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

J. M.'s missing motivation
- 124,525
- 11
- 401
- 574
-
-
1Mathematica makes it really easy now to use an API whenever the curated data functions are found lacking. It's really awesome. – J. M.'s missing motivation Apr 02 '18 at 14:13
GeoGraphics[GeoMarker[GeoPosition[WeatherData["KNDZ", "Coordinates"]]]]– J. M.'s missing motivation Mar 30 '18 at 03:11