aliteimor
(Alex Teymouri)
June 10, 2021, 5:10pm
1
Hi friends,
Air temperature data can be easily obtained for one station:
WeatherData[{37, 35.33}]
Entity["WeatherStation", "LTAF"]
data =
WeatherData["LTAF",
"Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}]
If I have more than one station (about 20 stations), How I do that? As an example, I have shown this here.
lat = {37.`, 37.75`, 38.75`}
lon = {35.33`, 38.28`, 30.53`}
Any help would be much appreciated.
Hi Alex,
Have you tried mapping it over the station list.
data = WeatherData[#,
"Temperature", {{1990, 1, 1}, {2021, 3, 31},
"Day"}] & /@ {"Chicago", "LTAF"}
Cheers,
Andy
mohammadb
(Mohammad Bahrami)
June 10, 2021, 9:50pm
3
Faster way:
loc=GeoPosition[list of locations as entities or their {lat,long}];
WeatherData[loc,...]
aliteimor
(Alex Teymouri)
June 11, 2021, 3:46am
4
Thank you, Andrew. I got an error when I want to see the output as a list of data.
t = Transpose[{lat, lon}]
data0 = WeatherData[#,
"Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}] & /@ t;
data = data0["Values"]
aliteimor
(Alex Teymouri)
June 11, 2021, 3:50am
5
Dear Mads,
Thank you so much for the faster way. Unfortunately, I didn’t get the expected results.
t = Transpose[{lat, lon}]
loc = GeoPosition[t]
WeatherData[{loc}, "Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}]
WeatherData::notent: {GeoPosition[{{37., 35.33}, {37.75, 38.28}, {38.75, 30.53}}]} is not a known entity, class, or tag for WeatherData. Use WeatherData[] for a list of entities.
Locations should be a list, not a list of lists
WeatherData[loc, "Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}]
aliteimor
(Alex Teymouri)
June 11, 2021, 7:26pm
7
Hi Rohit,
Unfortunately, I got some errors.
Well, that is odd. Works fine for me on 12.3.0 for Mac OS X x86 (64-bit) (May 10, 2021). Try the slower way
data0 = WeatherData[#, "Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}] & /@ loc;
data = #["Values"] & /@ data0