Message Boards Message Boards

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

The nearest weather stations to the Equator?

Posted 3 years ago

Hi,

I tried to find the two nearest weather stations to the NorthPole, Antarctica, and also the Equator.

I used the below command. How can I fix this problem? Thank you for your help

In[20]:= WeatherData[{"Equator", 2}]

During evaluation of In[20]:= WeatherData::notent: {"Equator", 2} is not a known entity, class, or tag for WeatherData. Use WeatherData[] for a list of entities.

Out[20]= WeatherData[{"Equator", 2}]

In[21]:= WeatherData[{"Arctic", 2}]

During evaluation of In[21]:= WeatherData::notent: {"Arctic", 2} is not a known entity, class, or tag for WeatherData. Use WeatherData[] for a list of entities.

Out[21]= WeatherData[{"Arctic", 2}]
POSTED BY: Alex Teymouri
4 Replies
Posted 3 years ago

Hi Mohammad,

data = WeatherData["KDRA", "Temperature", {{1911, 1, 1}, {2020, 12, 25}, "Day"}];

data["Dates"] // MinMax
(* {DateObject[{1978, 5, 15, 0, 0, 0.}, "Instant", "Gregorian", -6.], 
    DateObject[{2020, 12, 25, 0, 0, 0.}, "Instant", "Gregorian", -6.]} *)

WeatherData only has temperature data for that date range. You may be able to find a source with a larger date range and Import it. Even for the range that is available, there are several gaps ranging in length from 2 days to 42 days.

data["Dates"] // Differences // Counts // KeySort

To identify the missing date intervals write a predicate function to identify non-consecutive dates

consecutiveDatesQ[dates_] := DateDifference[First@dates, Last@dates, "Day"] != Quantity[1, "Day"]

The date ranges for which there is no data

missingDateIntervals = data["Dates"] //
  BlockMap[If[consecutiveDatesQ@#, 
             DateInterval[{DatePlus[First@#, 1], DatePlus[Last@#, -1]}], 
             Nothing] &, #, 2, 1] &;

missingDateIntervals // TimelinePlot[#, PlotLayout -> "Overlapped"] &

enter image description here

Gaps of over a week

missingDateIntervals // Select[#["Duration"] > Quantity[7, "Day"] &] //
  TimelinePlot[#, PlotLayout -> "Overlapped"] &

enter image description here

POSTED BY: Rohit Namjoshi

Rohit and Hans,

Thank you so much for the excellent solutions.

I tried to find air temperature data for the hottest and coldest place in the world based on Wikipedia. enter image description here

(*World Highest Temperature*)

In[50]:= GeoPosition["36d 27m N, 116\[Degree] 51'W"] // N

Out[50]= GeoPosition[{36.45, -116.85}]

In[51]:= WeatherData[{36.45`, -116.85`}]

In[52]:= GeoListPlot[WeatherData[{36.45`, -116.85`}], 
 GeoBackground -> GeoStyling["Satellite"]]

data = WeatherData["KDRA", 
  "Temperature", {{1911, 1, 1}, {2020, 12, 25}, "Day"}]
ListLinePlot[data["Values"]] 

(*World Lowest Temperature*)

In[57]:= GeoPosition["77d 32m S, 106\[Degree] 40'E"] // N

Out[57]= GeoPosition[{-77.5333, 106.667}]

WeatherData[{-77.53, 106.66}]

In[61]:= GeoListPlot[WeatherData[{-77.53, 106.66}], 
 GeoBackground -> Automatic]

In[64]:= data = 
 WeatherData["WMO89606", 
  "Temperature", {{1911, 1, 1}, {2020, 12, 25}, "Day"}]
ListLinePlot[data["Values"]] 

I couldn't get data from 1911 ?! Also, How do I find out if this data has missing data or not?

POSTED BY: M.A. Ghorbani
Posted 3 years ago

Alex,

To get the weather stations closest to the poles the syntax is quite simple. Using {latitude, longitude} specifications for the pole:

North pole

In[1]:= northPoleStations = WeatherData[{{90, 0}, 2}]
Out[1]= {Entity["WeatherStation", "CYLT"], Entity["WeatherStation", "CZLT"]}

In[2]:= #["Coordinates"] & /@ northPoleStations
Out[2]= {{82.518, -62.281}, {82.5, -62.333}}

South pole

In[3]:= southPoleStations = WeatherData[{{-90, 0}, 2}]
Out[3]= {Entity["WeatherStation", "NZSP"], Entity["WeatherStation", "WMO89314"]}

In[4]:= #["Coordinates"] & /@ southPoleStations
Out[4]= {{-90., 0.}, {-84.599, -115.811}}
POSTED BY: Hans Milton
Posted 3 years ago

Hi Alex,

Equator and Arctic are not locations. If you intend to use WeatherData then what matters is the closest station that WeatherData has data for.

stations = WeatherData[];
positions = EntityValue[stations, "Position"];
stationPositions = AssociationThread[stations -> positions] // DeleteMissing;

minLatitude = MinimalBy[stationPositions, Abs@#["Latitude"] &, 2]
(* <|Entity["WeatherStation", "FCOM"] -> GeoPosition[{-0.017, 15.65}], 
     Entity["WeatherStation", "SBMQ"] -> GeoPosition[{0.033, -51.05}]|> *)

(* Closest to the north pole *)
maxLatitude = MaximalBy[stationPositions, #["Latitude"] &, 2]
(* <|Entity["WeatherStation", "CYLT"] -> GeoPosition[{82.518, -62.281}], 
     Entity["WeatherStation", "CZLT"] -> GeoPosition[{82.5, -62.333}]|> *)

GeoListPlot[Values@{minLatitude, maxLatitude},
 GeoGridLines -> Automatic]

enter image description here

POSTED BY: Rohit Namjoshi
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