By "longest" I guess you mean with "maximum number of data points". There are a lot of weather stations data in the WL database (~ 35K).
In[1]:= EntityList[EntityClass["WeatherStation", All]] // Length
Out[1]= 35172
However, they are categorized into several EntityClass
.
In[2]:= EntityValue["WeatherStation","EntityClasses"]
Out[2]= {EntityClass["WeatherStation", "WMO"], EntityClass["WeatherStation", "CWOP"], EntityClass["WeatherStation", "NCDC"], EntityClass["WeatherStation", "WBAN"], EntityClass["WeatherStation", All]}
Let's take one of that classes with a minimum (seven) number of stations:
In[3]:= EntityList[EntityClass["WeatherStation", "WBAN"]]
Out[3]= {Entity["WeatherStation", "CYUB"],Entity["WeatherStation", "K1H2"],Entity["WeatherStation", "KDTA"], Entity["WeatherStation", "KNAK"], Entity["WeatherStation", "KNFE"],Entity["WeatherStation", "KVKS"], Entity["WeatherStation", "MYEM"]}
We can identify the geographic location of the above stations as follows:
In[4]:= GeoIdentify["Country", #] & /@ GeoPosition /@ EntityList[EntityClass["WeatherStation", "WBAN"]]
Out[4]= {{Entity["Country", "Canada"]}, {Entity["Country", "UnitedStates"]}, {Entity["Country", "UnitedStates"]}, {}, {Entity["Country", "UnitedStates"]}, {Entity["Country", "UnitedStates"]}, {Entity["Country", "Bahamas"]}}
Next, for the temperature data between 1 Aug 2022 and 2 Aug 2022, we use the function AirTemperatureData
:
In[5]:= airTemp = Join @@ (<|# -> AirTemperatureData[#, {DateObject[{2022, 8, 1}],DateObject[{2022, 8, 2}]}]|> &/ @ EntityList[EntityClass["WeatherStation", "WBAN"]]) // DeleteMissing
The output of the above In[5]
is a list of TimeSeries
with the corresponding number of data points.
By creating Association
between stations and their data and using DeleteMissing
to remove missing data entries, we can visualize the data (available for three) using DateListPlot
function:
DateListPlot[airTemp, PlotMarkers -> Automatic, PlotRange -> Automatic, PlotLegends -> Automatic, FrameLabel -> {"Time", "Temperature (°C)"}]

Hence, the weather station (within the specific EntityClass
of "WBAN") having the maximum number of data points is K1H2.