Indicating the probability that a weather datum is above/below some given value on a geographic map

With help of the previous questions here, I am analyzing weather data as daily MeanWindSpeed of some cities with the following code:

{date, year, month, day, wind} = {1, 1, 2, 3, 2}

cityWind1 = WeatherData[“Bodo”, “MeanWindSpeed”, {{1973, 1, 1}, {2013, 5, 1},”Day”}];
cityWind1[[All, date, year]] = 0

slowWinddays1 = Select[cityWind1, #[[wind]] < 21 &]; DateListPlot[{cityWind1, slowWinddays1}, ImageSize -> 600]

I have two problems.

I want to calculate the probability of the days that mean wind speeds higher than 21 km/hr and show it in the plot. It could be monthly or weekly outlet. I know the algorithm is too easy, but sorry guys I am new in town!
Most important, how can I show this probability in different geographic regions based on data from the available stations of that region. For example, assign a color to Norway and vary intensity to indicate the probability on the geographic map. That is to say, the more intense the color, the higher the probability.




I some some problems with your post: 1) you mentiona a previous question, but don’t provide a link to it. 2) you talk about the probability the wind speed exceeds a certain value, but your code selects cases where the wind speed is below that value 3) I have no idea what “It could be monthly or weekly outlet” or “probability of the days that mean wind speeds higher than 21 km/hr” mean.
– m_goldberg
May 28 ’13 at 18:52



Hi,1-The link is provided 2-no problem!! you can calculate either lower than or higher than probability.3- Look at the link you will find what I mean.
– Alex
May 28 ’13 at 19:02


2 Answers


A hint for the mapping thing:

d = {2013, 5, 1};
cords = Select[Reverse[CityData[#, “Coordinates”]] & /@ CityData[{All, “Norway”}], Head@# == List &];
Show[ListContourPlot[Join@@ {#,List@WeatherData[#,”MeanWindSpeed”,d,d,”Day”}][[1, 2]]} & /@ cords],
Graphics[{Gray, Opacity[.5], CountryData[“Norway”, “Polygon”]}]]



belisarius thanks for the hint.Could you please show at least one day on the map?I think hint needs some hints!Please check
– Alex
May 29 ’13 at 5:58



MANY THANKS!!!It was all!!
– Alex
May 29 ’13 at 19:48



how can I show ContourLabels and PlotLegends on the map .it doesnt show that
– Alex
May 29 ’13 at 20:37

Here’s a quick answer for your first question (I’ll let someone else handle the mapping (that’s a lot of data to sort through).

Let’s look at the wonderful (cough) city of Houston.

winddata = WeatherData[{“Houston”, “Texas”}, “MeanWindSpeed”,
{{1973, 1, 1}, {2013, 5, 1}, “Day”}];

Gather those values by day:

daysorted = GatherBy[winddata, #[[1, {2, 3}]] &];

Calculate the probability of each of those days exceeding a certain wind speed:

windspeed = 10;
probs = Most[Probability[x >= windspeed, x \[Distributed] #[[All, 2]]]& /@ daysorted];
dates = Most@daysorted[[All, 1, 1]];
plotprobs = Transpose[{dates, probs}]; (*prepare for plotting*)

Plot away:

winddata[[All, 1, 1]] = 0;
slowWinddays1 = Select[winddata, #[[2]] < windspeed &]; plot1 = DateListPlot[plotprobs, Joined -> True, ImageSize -> 600];
plot2 = DateListPlot[{winddata, slowWinddays1}, ImageSize -> 600];

Aside: Yes, you don’t have to use Probability, but why not?



Hi.Many thanks!But I think we have not some data in some places and thats the reason in some area we might have missing Probability .Am I right?BTW how can I add all months abbreviations to the plot?
– Alex
May 28 ’13 at 19:27



As I read the plots, you have posted them in the order plot2 above by plot1, while your code displays them in the order plot2 above plot1. Suggest you edit to change the order.
– m_goldberg
May 29 ’13 at 0:20



@m_goldberg, Aye, good call, I’ll swap them in code…
– kale
May 29 ’13 at 2:23