Message Boards Message Boards

1
|
6426 Views
|
7 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Getting air temperature historical data

Posted 3 years ago

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.

POSTED BY: Alex Teymouri
7 Replies

Faster way:

    loc=GeoPosition[list of locations as entities or their {lat,long}];
    WeatherData[loc,...]
POSTED BY: Mads Bahrami
Posted 3 years ago

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.
POSTED BY: Alex Teymouri
Posted 3 years ago

Locations should be a list, not a list of lists

WeatherData[loc, "Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}]
POSTED BY: Rohit Namjoshi
Posted 3 years ago

Hi Rohit,

Unfortunately, I got some errors.

enter image description here

POSTED BY: Alex Teymouri
Posted 3 years ago

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
POSTED BY: Rohit Namjoshi
Posted 3 years ago

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

POSTED BY: Andrew Burnett
Posted 3 years ago

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"]
POSTED BY: Alex Teymouri
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract