Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to show the wind streams in a geographic area as following code for a range of time.Even if it works for realtime data but it doesn't work for range of time.I am filtering and also taking mean and it has no problem there.Could somebody help me please?

 ListStreamPlot[Table[{{x, y},Through[{Cos, Sin}[Mean[DeleteCases[WeatherData[{y, x},
 "WindDirection", {{2013, 5, 28}, {2013, 5, 29}}][[All, 2]], 
    Missing["NotAvailable"]]] \[Degree]]]}, {x, 20, 56, 4}, {y, 32,57, 4}]]
share|improve this question
What do you want to happen if WeatherData[{y, x}, "WindDirection", {{2013, 5, 28}, {2013, 5, 29}}] returns Missing["NotApplicable"]? – J. M. Jun 5 '13 at 18:46
Do you want to make a movie or all data in one plot? – Sjoerd C. de Vries Jun 5 '13 at 18:48
@0x4A4D I am filtering that .am I? – Alex Jun 5 '13 at 18:49
@SjoerdC.deVries no just taking the mean of wind direction and plot it in stream – Alex Jun 5 '13 at 18:49
Nope, you're removing Missing[] items from a list. You forgot to handle the case where the result is not a list, but a Missing[] object. – J. M. Jun 5 '13 at 18:56
up vote 3 down vote accepted

This works, but you have to take care of situations where the only result is a single Missing[].


  • It's better not to average angles, but to take the mean of the resulting vectors
  • you needed a Transpose
  • Don't forget that the weather for a coordinate you specify is taken from the nearest weather station, which may be some distance from that location. Better to use the coordinates of that station.


 Table[{{x, y}, 
     Through[{Cos, Sin}[
          WeatherData[{y, x}, 
            "WindDirection", {{2013, 5, 28}, {2013, 5, 29}}][[All, 
            2]], Missing["NotAvailable"]] \[Degree]]]}, {x, 20, 56, 
   4}, {y, 32, 57, 4}]]

enter image description here

share|improve this answer
About that moving issue in a period of time do you think it is very difficult to do that? – Alex Jun 5 '13 at 19:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.