Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

1 Answer 1

up vote 3 down vote accepted

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

Remarks:

  • 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.

.

ListStreamPlot[
 Table[{{x, y}, 
   Mean@Transpose@
     Through[{Cos, Sin}[
       N@DeleteCases[
          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

 
discard

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.