Group Abstract Group Abstract

Message Boards Message Boards

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

The nearest weather stations to the Equator?

Posted 5 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 5 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
POSTED BY: M.A. Ghorbani
Posted 5 years ago
POSTED BY: Hans Milton
Posted 5 years ago
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