Reputation: 45
I am currently working on making a 3D plot with Latitude on the x, Longitude on the y, and total rainfall during hurricane Harvey on the z.
The weatherdata
function in wolfram mathematica
requires you to pass in a name of a weather station as a parameter.
Is there a way to use the Entity or EntityList
function to get a list off all the names of weather stations in a given state.
Upvotes: 0
Views: 222
Reputation: 8645
This method works, although there is probably a more direct way. To find the weather stations in Illinois, for example, find the nearest 100 from Springfield, then select the ones in Illinois.
coordinates = CityData["Springfield", "Coordinates"];
weatherstations = WeatherData[{coordinates, 100}];
entityvalues = EntityValue[
weatherstations, "PropertyAssociation"];
properties = {
#[[Key[EntityProperty[
"WeatherStation", "Name"]]]],
#[[Key[EntityProperty[
"WeatherStation", "Coordinates"]]]]} & /@
entityvalues;
states = {GeoNearest["USState", Last[#]],
First[#]} & /@ properties;
Last /@ Select[states, #[[1, 1]] == Entity[
"AdministrativeDivision",
List["Illinois", "UnitedStates"]] &]
{KCPS, KSAR, KBLV, KALN, KPPQ, KUIN, KCIR, KMDH, KMWA, K3LF}
Upvotes: 1