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}]]
  • $\begingroup$ What do you want to happen if WeatherData[{y, x}, "WindDirection", {{2013, 5, 28}, {2013, 5, 29}}] returns Missing["NotApplicable"]? $\endgroup$ – J. M. will be back soon Jun 5 '13 at 18:46
  • $\begingroup$ Do you want to make a movie or all data in one plot? $\endgroup$ – Sjoerd C. de Vries Jun 5 '13 at 18:48
  • $\begingroup$ @0x4A4D I am filtering that .am I? $\endgroup$ – Alex Jun 5 '13 at 18:49
  • $\begingroup$ @SjoerdC.deVries no just taking the mean of wind direction and plot it in stream $\endgroup$ – Alex Jun 5 '13 at 18:49
  • $\begingroup$ 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. $\endgroup$ – J. M. will be back soon Jun 5 '13 at 18:56

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

  • $\begingroup$ About that moving issue in a period of time do you think it is very difficult to do that? $\endgroup$ – Alex Jun 5 '13 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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