Message Boards Message Boards

GROUPS:

Getting air temperature historical data

Posted 8 days ago
269 Views
|
7 Replies
|
4 Total Likes
|

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.

7 Replies

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 8 days 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"]

Faster way:

    loc=GeoPosition[list of locations as entities or their {lat,long}];
    WeatherData[loc,...]
Posted 8 days 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.

Locations should be a list, not a list of lists

WeatherData[loc, "Temperature", {{1990, 1, 1}, {2021, 3, 31}, "Day"}]
Posted 7 days ago

Hi Rohit,

Unfortunately, I got some errors.

enter image description here

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
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