# Wind Map Artwork

I would like some help generating an image like the one seen below.

The image above is an art piece called Wind Map by artists Fernanda Viégas and Martin Wattenberg.

I would like to take wind data using WeatherData and generate a map like the one above. Eventually I would like to generalize this idea to taking data from the National Digital Forecast Database.

I see that it is possible to generate a coarse wind map. When I execute that code I get the following output which is similar to what I desire, but there is still much to be done.

• A couple weeks ago I was playing with a Julia script that launches a bunch of particles on a grid leaving trails behind them, and they follow a vector field defined on the grid, generating somewhat similar visual patterns as in the artwork, but it's not exactly the same method. Figuring out how the artists get their vector field and do their plotting will probably be half the work, and the rest will be figuring out how to make Mathematica give a nice-looking picture. Good luck to everyone who takes the time to answer the question! – DumpsterDoofus Nov 30 '14 at 2:49
• Oops, never mind, they describe where they get the data and technique from in their "Read More" section. – DumpsterDoofus Nov 30 '14 at 2:52
• You could also try LineIntegralConvolutionPlot. – Rahul Nov 30 '14 at 7:32
• Related Q/A: (15895). – Silvia Nov 30 '14 at 14:17

# Update

According to KennyColnago's advice, post-processing is not needed, as StreamColorFunction can handle it essentially by using VertexColors on Line-s:

ListStreamPlot[
testdata,
StreamPoints -> {samplePoints, Automatic, 10},
StreamStyle -> "Line",
Background -> Black,
StreamColorFunction -> (GrayLevel[1, #5] &)
]


# Original

With Simon Woods' neat trick and some post-processing:

testdata = Table[{{x, y}, RandomReal[{-1, 1}, 2]}, {x, -3, 3, 1}, {y, -3, 3, 1}] // Flatten[#,1]&;

samplePoints = Tuples[Range[-3, 3, 1/5], 2];

ListStreamPlot[
testdata,
StreamPoints -> {samplePoints, Automatic, 10},
StreamStyle -> "Line",
Background -> Black
] //
# /. ln : Line[idxes_] :>
MapIndexed[
{
GrayLevel[1, 1 - Rescale[#2[[1]], {1, Length[idxes] - 1}]],
Line[#1]
} &,
Partition[idxes, 2, 1]
] &


Note for a more meaningful graphics, one might want to determine the GrayLevel according to the local wind scale.

• Colouring according to the wind scale may be accomplished with, for example, StreamColorFunction->(ColorData["DarkRainbow",#5]&). Slot #5 corresponds to Norm[{vx,vy}]. – KennyColnago Nov 30 '14 at 17:30
• @KennyColnago Great! Much more efficient! (Didn't realize that Line can have VertexColors too..) – Silvia Nov 30 '14 at 17:52
• @Silvia, +1, but where' the map? – alancalvitti Dec 3 '14 at 3:39
• @alancalvitti My apologize. Don't know why, but fetching the online data always time-out here, so I only showed the basic idea. – Silvia Dec 3 '14 at 7:13

I'm sure there are lots of things one might try -- here is an attempt using some of the built in options that are available in ListStreamPlot:

Show[Graphics[{Black, CountryData["USA", "Polygon"]}],
ListStreamPlot[
Table[{{x, y},
Through[{Cos, Sin}[
WeatherData[{y, x}, "WindDirection"]]]}, {x, -140, -70, 5}, {y,
24, 50, 5}], StreamScale -> Full, StreamStyle -> "Toothpick",
StreamColorFunction -> GrayLevel,
StreamColorFunctionScaling -> False]]


• I don't know how it's done, but the original picture gives a sense of "wind direction" that is (at least for me) absent in your picture – Dr. belisarius Nov 30 '14 at 4:11
• I see wind directions in bills picture, and it also has its own qualities. – Adrian Dec 1 '14 at 6:59