It looks like you're new here. If you want to get involved, click one of these buttons!

- All Categories 2.2K
- Applied Category Theory Course 352
- Applied Category Theory Seminar 4
- Exercises 149
- Discussion Groups 49
- How to Use MathJax 15
- Chat 479
- Azimuth Code Project 108
- News and Information 145
- Azimuth Blog 148
- Azimuth Forum 29
- Azimuth Project 189
- - Strategy 108
- - Conventions and Policies 21
- - Questions 43
- Azimuth Wiki 710
- - Latest Changes 701
- - - Action 14
- - - Biodiversity 8
- - - Books 2
- - - Carbon 9
- - - Computational methods 38
- - - Climate 53
- - - Earth science 23
- - - Ecology 43
- - - Energy 29
- - - Experiments 30
- - - Geoengineering 0
- - - Mathematical methods 69
- - - Meta 9
- - - Methodology 16
- - - Natural resources 7
- - - Oceans 4
- - - Organizations 34
- - - People 6
- - - Publishing 4
- - - Reports 3
- - - Software 21
- - - Statistical methods 2
- - - Sustainability 4
- - - Things to do 2
- - - Visualisation 1
- General 39

Options

Hi, I'm going to be writing some code to generate 2-D vector fields, at some sampling resolution. These will be fields of derivative vectors. In some of the graphs, I just want to show the vectors as arrows. In other graphs, I'd like to show a field of flow lines, perhaps with some extra indications for the points of attraction and repulsion. Of course it will also need the standard items: captions for the graph and axes, and tick marks and numbers for the axes. Plus some basic color control. The output should look nice, for inclusion in blog articles.

The vector fields will from the rate equation, applied to various two-species Petri nets.

I'm looking for any and all suggestions for how to go about this. On the one hand, I like the idea of using a text-file interface between the output of the computational component, and the input of the rendering component. Generate data, store it in a declarative file, and then display it. This has the advantage of decoupling the choice of computation and display languages.

Some kind of standalone plotting system, like gnuplot. Or use R. R must have nice packages (right?) that will take a functional description of the vector field, and apply nice numerical methods, to compute and display the flow lines, etc. Maybe this outweighs the software engineering wish to decouple the computation language from the rendering system.

Thanks in advance for your thoughts.

## Comments

Hi Dave,

You don't say which platform you're on: is it a Linux-y one (incl. OS X) or Windows?

It's not a nice integrated system, but on Linux-y ones you can get gnuplot to plot an explicit set of vectors, as described here. Gnuplot is very much old-style display software (tell it exactly what to do and you do some quite impressive graphics, but it won't do much automatically) but it might be a start.

`Hi Dave, You don't say which platform you're on: is it a Linux-y one (incl. OS X) or Windows? It's not a nice integrated system, but on Linux-y ones you can get gnuplot to plot an explicit set of vectors, [as described here](http://stackoverflow.com/questions/5442401/vector-field-using-gnuplot). Gnuplot is very much old-style display software (tell it exactly what to do and you do some quite impressive graphics, but it won't do much automatically) but it might be a start.`

Hi David. All are possible, I have Windows, OS X and Linux -- so that doesn't narrow it down very much :) I'm curious as to how people would approach it if doing it for themselves.

I like the idea of a "plotting module" e.g. gnuplot. But I'd also be interested in code to make a plot of the streamlines, given a description of the vector field. One could run an integration over a bunch of starting points (which ones?), but it sounds like a challenge to make the plot look good.

`Hi David. All are possible, I have Windows, OS X and Linux -- so that doesn't narrow it down very much :) I'm curious as to how people would approach it if doing it for themselves. I like the idea of a "plotting module" e.g. gnuplot. But I'd also be interested in code to make a plot of the streamlines, given a description of the vector field. One could run an integration over a bunch of starting points (which ones?), but it sounds like a challenge to make the plot look good.`

I've never done this myself in R, but there's some examples at http://stackoverflow.com/questions/14936504/vector-field-visualisation-r

I tend to write out text files from the computation language program, read in and display in R.

`> R must have nice packages (right?) I've never done this myself in R, but there's some examples at [http://stackoverflow.com/questions/14936504/vector-field-visualisation-r](http://stackoverflow.com/questions/14936504/vector-field-visualisation-r) > Maybe this outweighs the software engineering wish to decouple the computation language from the rendering system. I tend to write out text files from the computation language program, read in and display in R.`

The 'rasterVis' package in R will integrate a vector field to generate continuous streamlines (example). Like the StackOverflow examples, the input is a vector field, not a set of equations. It shouldn't be too hard to generate the vector field from equations, though, nor to write a function that will accept a set of equations and plot the streamlines.

`The 'rasterVis' package in R will integrate a vector field to generate continuous streamlines ([example](http://procomun.wordpress.com/2013/01/10/vector-fields-with-streamlines/)). Like the StackOverflow examples, the input is a vector field, not a set of equations. It shouldn't be too hard to generate the vector field from equations, though, nor to write a function that will accept a set of equations and plot the streamlines.`

There's this online vector field equation editor done in html5 using the cavas element. html5 is my preferred future solution for graphics. I say future cos Firefox

stilldoesn't support the html5 slider element even after years of complaints. If it's any use I downloaded rasterVist to the proto model server at ~/usr/jim/bin for anyone with a login.`There's this [online vector field equation editor](http://kevinmehall.net/p/equationexplorer/vectorfield.html) done in html5 using the cavas element. html5 is my preferred future solution for graphics. I say future cos Firefox *still* doesn't support the html5 slider element even after years of complaints. If it's any use I downloaded rasterVist to the proto [model server](stuttard.org) at ~/usr/jim/bin for anyone with a login.`

Irrelevant - deleted.

`Irrelevant - deleted.`

Did you mean something like this?

That is wind vectors. The green ones are from airport measured data and the red ones are interpolated. It is done in simple php-script, that generates a png-file from database.

`Did you mean something like [this](http://www.palapeli.net/twind.png)? That is wind vectors. The green ones are from airport measured data and the red ones are interpolated. It is done in simple php-script, that generates a png-file from database.`

That's a vector field, which is the starting point. But then we want to show the "trajectory streamlines" of this field. These are presumably a family of continuous curves. Here is a wishlist of features:

Indicate the direction of the streamlines

Indicate the velocity at points along the lines

Indicator for zero points

One could use a special color for the zeros. Small arrows along the streamlines could show the direction. Showing the magnitude of the velocity vector may not be feasible. One could show the vector field at points, say in another color, but that could make the picture messy, with field vectors crossing the streamlines.

I haven't looked into this, but off the top of my head, it looks like a tricky computer graphics problem, if you want to make the picture look nice. In theory you just do a bunch of numerical integrations at lots of starting points, and then show all the resulting streamlines.

But if you choose too many points, then as the streamlines narrow together when they approach a point of attraction, in a raster display all the pixels will be set in a block around the attractor. You see a more sophisticated approach in the traditional pictures of the flux lines of a magnet, where some of the streamlines are terminated when they bunch together too much. So there are some points to consider for the algorithm design.

`That's a vector field, which is the starting point. But then we want to show the "trajectory streamlines" of this field. These are presumably a family of continuous curves. Here is a wishlist of features: * Indicate the direction of the streamlines * Indicate the velocity at points along the lines * Indicator for zero points One could use a special color for the zeros. Small arrows along the streamlines could show the direction. Showing the magnitude of the velocity vector may not be feasible. One could show the vector field at points, say in another color, but that could make the picture messy, with field vectors crossing the streamlines. I haven't looked into this, but off the top of my head, it looks like a tricky computer graphics problem, if you want to make the picture look nice. In theory you just do a bunch of numerical integrations at lots of starting points, and then show all the resulting streamlines. But if you choose too many points, then as the streamlines narrow together when they approach a point of attraction, in a raster display all the pixels will be set in a block around the attractor. You see a more sophisticated approach in the traditional pictures of the flux lines of a magnet, where some of the streamlines are terminated when they bunch together too much. So there are some points to consider for the algorithm design.`

Maybe it's not so tricky after all.

Here is an idea for an algorithm:

So the first streamline will get fully plotted. Then the next streamline will get plotted wherever it is not too close to the first one. The third streamline will get plotted where it is not too close to the first two, ...

Optimization: Do the numerical integration in a lazy way, so that when a streamline gets stopped because it gets to close to the ones already laid down, then no calculation gets performed for hidden part of the streamline. That implies a variant on the loop above, obtained by returning whenever the TooClose condition is satisfied. But this should also give a valid plot, since every point in the Epsilon-mesh will be tried as a starting point.

`Maybe it's not so tricky after all. Here is an idea for an algorithm: def PlotStreamlines(Rectangle, Epsilon, VectorField: Rectangle -> R2): for each point (x,y) in the Epsilon-mesh over Rectangle: PlotTrajectory(x,y,VectorField) def PlotTrajectory(x0, y0, VectorField): imageBefore = {(x,y) in the current raster image} List<Pair<x,y>> trajectory = NumericalIntegration(x0, y0, VectorField) foreach (x,y) in trajectory: if VerySmall(VectorField(x,y)): Plot(x,y, color = ZerosColor) lineSegment = the line segment from the previous point in the trajectory to (x,y) if TooClose(lineSegment, imageBefore): # then the image is too bunched up here, so don't plot this segment else: Plot(lineSegment) So the first streamline will get fully plotted. Then the next streamline will get plotted wherever it is not too close to the first one. The third streamline will get plotted where it is not too close to the first two, ... Optimization: Do the numerical integration in a lazy way, so that when a streamline gets stopped because it gets to close to the ones already laid down, then no calculation gets performed for hidden part of the streamline. That implies a variant on the loop above, obtained by returning whenever the TooClose condition is satisfied. But this should also give a valid plot, since every point in the Epsilon-mesh will be tried as a starting point.`

Seems I made a typo in the link. The vector field equation editor is here.

`Seems I made a typo in the link. The vector field equation editor is [here](http://kevinmehall.net/p/equationexplorer/vectorfield.html).`

In the vector field that i showed, the density of the vectors is too high. I tried to show them with an arrowhead, but on higher winds (=longer vectors), the picture was too garbled. Somewhere there is a version, with a small yellow circle in the beginning of each vector, but there are still too many vectors. My intention was to show that on a map. When I tried to show the vectors on a map, it became even more garbled.

In Finland the meteorological office is opening its data (Finnish Open Data initiative). I am just for fun making different tests, how to illustrate large scale turbulence for estimating in real time the trajectories of eg gas releases. So I need a dense vector field. The better the field, the harder to illustrate.

Combined with climate models: It could be used to approximate how heat is tranferred.

`In the vector field that i showed, the density of the vectors is too high. I tried to show them with an arrowhead, but on higher winds (=longer vectors), the picture was too garbled. Somewhere there is a version, with a small yellow circle in the beginning of each vector, but there are still too many vectors. My intention was to show that on a map. When I tried to show the vectors on a map, it became even more garbled. In Finland the meteorological office is opening its data (Finnish Open Data initiative). I am just for fun making different tests, how to illustrate large scale turbulence for estimating in real time the trajectories of eg gas releases. So I need a dense vector field. The better the field, the harder to illustrate. Combined with climate models: It could be used to approximate how heat is tranferred.`

It might be worth poking into the source code of this wind map, which seems to have pretty good results.

`It might be worth poking into the source code of [this wind map](http://hint.fm/wind/), which seems to have pretty good results.`

@Nathan I'd forgotten about that link. Thanks.

I downloaded the js files to play with. It reminded me of NASA's Perpetual Ocean video.

Would it be easy to find out what animation software this was made with?

The ocean wind vector team for example has animations but the site only refers to datasets.

Does NASA not open source all its climate-related software?

`@Nathan I'd forgotten about that link. Thanks. I downloaded the js files to play with. It reminded me of NASA's [Perpetual Ocean](http://www.nasa.gov/topics/earth/features/perpetual-ocean.html) video. Would it be easy to find out what animation software this was made with? The ocean wind vector team for example has animations but the site only refers to datasets. Does NASA not open source all its climate-related software?`

It looks like NASA's Perpetual Ocean video was produced with commercial 3D rendering software (Maya and RenderMan). You might have better luck with the wind map JavaScript.

`It looks like NASA's [Perpetual Ocean video was produced](http://mashable.com/2012/08/28/nasa-svs/) with commercial 3D rendering software (Maya and RenderMan). You might have better luck with the wind map JavaScript.`

The javascript looks good at first glance. At least it's a source for spec and design ideas.

I'll try and produce some toy maps with the wind.js library.

(Assuming that discussing wind flow animations isn't too OT):

From my very little experience of what can be done in Maya, most things can now be done, on linux, using Blender.

The sort of wind flow animations Blender can make can be seen via this post on the Blender forum.

I never got much beyond installing FOAM and reading some docs. It's pretty heavy duty but if it parallelises it is a defacto open source standard and will have mileage.

[3D Studio Max] is probably the main commercial competitor to Maya; a completely untrained electrician friend once made me a great monad simulation in his bootleg copy.

`The javascript looks good at first glance. At least it's a source for spec and design ideas. I'll try and produce some toy maps with the wind.js library. (Assuming that discussing wind flow animations isn't too OT): From my very little experience of what can be done in Maya, most things can now be done, on linux, using [Blender](www.blender.org). The sort of wind flow animations Blender can make can be seen via this [post](http://www.blender.org/forum/viewtopic.php?p=68787&sid..) on the Blender forum. * [Blender fluid simulation]( http://wiki.blender.org/index.php/Manual/Fluid_Simulation ) * [OpenFOAM]( http://www.opencfd.co.uk/openfoam/index.html ). I never got much beyond installing FOAM and reading some docs. It's pretty heavy duty but if it parallelises it is a defacto open source standard and will have mileage. [3D Studio Max] is probably the main commercial competitor to Maya; a completely untrained electrician friend once made me a great monad simulation in his bootleg copy.`

Nathan, that's a great link, thanks! The wind animation is beautiful.

I started looking at the main logic file.

Jim, how do you experiment with the javascript? I don't have any experience with it. One thought I had was to essentially clone the page on a local machine, including the .js files, and then tinker with the javascript, running it all through the browser.

Challenge, can we boil this code down to compact pseudocode for the essential algorithm.

`Nathan, that's a great link, thanks! The wind animation is beautiful. I started looking at the main [logic file](http://hint.fm/wind/wind-bundle.js). Jim, how do you experiment with the javascript? I don't have any experience with it. One thought I had was to essentially clone the page on a local machine, including the .js files, and then tinker with the javascript, running it all through the browser. Challenge, can we boil this code down to compact pseudocode for the essential algorithm.`

Downloading the 2 wind*.js and 3 png files worked fine on my local machine.

I bumped the jquery version from jquery-min-1.7.2 in wind.fm.html as I've just upgraded to jquery-2.0.0 which was released a couple of weeks ago.

I always use the uncompressed versions for development. It's a good idea to download jquery-migrate*.js which signals breaking changes in legacy js.

I only got as far as finding out that the logic seems to start with mkParticles.

An ocean version would be smashing wouldn't it? :)

`Downloading the 2 wind*.js and 3 png files worked fine on my local machine. I bumped the jquery version from jquery-min-1.7.2 in wind.fm.html as I've just upgraded to jquery-2.0.0 which was released a couple of weeks ago. I always use the uncompressed versions for development. It's a good idea to download jquery-migrate*.js which signals breaking changes in legacy js. I only got as far as finding out that the logic seems to start with mkParticles. An ocean version would be smashing wouldn't it? :)`

Hi, I am experimenting (and struggling) with the R rasterVis package that Nathan mentioned, which is illustrated here and documented here.

Here is the sample code from that first page:

It does plot the streamlines. There is also a function called vectorplot, which plots the vector field itself.

Here is my (R newbie) understanding of what the above code is doing.

the variable proj gets set to the arguments that specify a "PROJ.4'" cartographic projection that gets used a few lines down

the data frame df gets set to a grid on $[-2,2] x [-2,2]$ with mesh size 0.01. This is essentially a two column table, with columns x and y.

a z column gets added to df, which is computed from x and y, using the arithmetic expression supplied above.

a raster object gets created from this (x,y,z) table, which can be thought of as a raster-based function from (x,y) to z. The cartographic projection argument is supplied to the constructor.

then either vectorplot or streamplot can be called, to make a nice picture.

How does an (x,y,z) raster represent a vector field? According to the documentation, behind the scenes, a function called "terrain" gets called, which takes the gradient of the (x,y,z) raster.

I want to use vectorplot and streamplot, but in a less sophisticated manner:

I want to supply an explicit vector field, and not have it take the gradient for me

I don't want to use any cartographic projection, or equivalently, to use an identity projection

According to the documentation:

How do I construct an explicit vector field?

The (x,y,z) raster object is of type RasterLayer. There are classes called RasterStack and RasterBrick, which are supposed to be very similar to each other. I tried using RasterStack, but it didn't give the results I expected.

Here was my test: Make an (x,y,z) dataframe which has a constant value for z. Let r be a raster for this dataframe. Let s = stack(r,r). This a RasterStack. When I pass it to vectorplot, I expected to see a field of constant vectors, all pointing at a 45 degree angle up and to the right.

I removed the crs=proj argument from the call to rasterFromXYZ.

The result was a field of constant vectors, but they were not pointing in the 45 degree direction. The direction was dependent on the constant value in each of the data frames. It appears to be that the vectors which I want to be interpreted as simply (x,y) values are being interpreted in polar coordinates.

So I am close but not there. Any insights are welcome :)

Thanks

`Hi, I am experimenting (and struggling) with the R rasterVis package that Nathan mentioned, which is illustrated [here](http://procomun.wordpress.com/2013/01/10/vector-fields-with-streamlines/) and documented [here](http://rastervis.r-forge.r-project.org). Here is the sample code from that first page: proj <- CRS('+proj=longlat +datum=WGS84') df <- expand.grid(x=seq(-2, 2, .01), y=seq(-2, 2, .01)) df$z <- with(df, (3*x^2 + y)*exp(-x^2-y^2)) r <- rasterFromXYZ(df, crs=proj) streamplot(r) It does plot the streamlines. There is also a function called vectorplot, which plots the vector field itself. Here is my (R newbie) understanding of what the above code is doing. * the variable proj gets set to the arguments that specify a "PROJ.4'" cartographic projection that gets used a few lines down * the data frame df gets set to a grid on $[-2,2] x [-2,2]$ with mesh size 0.01. This is essentially a two column table, with columns x and y. * a z column gets added to df, which is computed from x and y, using the arithmetic expression supplied above. * a raster object gets created from this (x,y,z) table, which can be thought of as a raster-based function from (x,y) to z. The cartographic projection argument is supplied to the constructor. * then either vectorplot or streamplot can be called, to make a nice picture. How does an (x,y,z) raster represent a vector field? According to the documentation, behind the scenes, a function called "terrain" gets called, which takes the gradient of the (x,y,z) raster. I want to use vectorplot and streamplot, but in a less sophisticated manner: * I want to supply an explicit vector field, and not have it take the gradient for me * I don't want to use any cartographic projection, or equivalently, to use an identity projection According to the documentation: > If the Raster* object passed to vectorplot is a vector field (isField=TRUE), the terrain calculation is skipped. How do I construct an explicit vector field? The (x,y,z) raster object is of type RasterLayer. There are classes called RasterStack and RasterBrick, which are supposed to be very similar to each other. I tried using RasterStack, but it didn't give the results I expected. Here was my test: Make an (x,y,z) dataframe which has a constant value for z. Let r be a raster for this dataframe. Let s = stack(r,r). This a RasterStack. When I pass it to vectorplot, I expected to see a field of constant vectors, all pointing at a 45 degree angle up and to the right. I removed the crs=proj argument from the call to rasterFromXYZ. The result was a field of constant vectors, but they were not pointing in the 45 degree direction. The direction was dependent on the constant value in each of the data frames. It appears to be that the vectors which I want to be interpreted as simply (x,y) values are being interpreted in polar coordinates. So I am close but not there. Any insights are welcome :) Thanks`

I've never used this package, so these are just possible clues... I looked here: http://cran.r-project.org/web/packages/raster/raster.pdf and it seems like the vector field is stored as (slope,aspect) values, both in radians, but I couldn't see how to make a Raster object from such. It might help to use the writeRaster() function to write out a small RasterLayer/Stack/whatever. Ultimately you may want to make a file (not in R) that R functions can read.

`I've never used this package, so these are just possible clues... I looked here: [http://cran.r-project.org/web/packages/raster/raster.pdf](http://cran.r-project.org/web/packages/raster/raster.pdf) and it seems like the vector field is stored as (slope,aspect) values, both in radians, but I couldn't see how to make a Raster object from such. It might help to use the writeRaster() function to write out a small RasterLayer/Stack/whatever. Ultimately you may want to make a file (not in R) that R functions can read.`

David, in which format you have the vectors? If you could send me a file containing some example vectors, I could try some software that I am familiar with.

`David, in which format you have the vectors? If you could send me a file containing some example vectors, I could try some software that I am familiar with.`

Hi Pertti, thanks for this offer. At this point I can really use any format, because I will be generating the vectors from functions.

I made some further progress, and found that matplotlib has a new function that generates some artistic looking streamlines. I am testing this out now. Using Canopy distribution from Enthought.

It has logic to avoid printing too many streamlines when they bunch up, but this leads to artifacts in a simple vector field consisting parallel vectors. The artifact is missing chunks in what would be expected to be just a bunch of parallel lines. The source code is available and clear, and hopefully this can be fixed by a tuning parameter or a code tweak.

Everybody thanks for the suggestions. When the dust settles I will transfer the information from this thread to a Wiki page.

So Pertti, I think I am in good shape, but if you find any nice software for plotting streamlines, then it would be great to add either to this thread or the future wiki page.

`Hi Pertti, thanks for this offer. At this point I can really use any format, because I will be generating the vectors from functions. I made some further progress, and found that matplotlib has a [new function](http://matplotlib.org/users/whats_new.html#streamplot) that generates some artistic looking streamlines. I am testing this out now. Using Canopy distribution from Enthought. It has logic to avoid printing too many streamlines when they bunch up, but this leads to artifacts in a simple vector field consisting parallel vectors. The artifact is missing chunks in what would be expected to be just a bunch of parallel lines. The source code is available and clear, and hopefully this can be fixed by a tuning parameter or a code tweak. Everybody thanks for the suggestions. When the dust settles I will transfer the information from this thread to a Wiki page. So Pertti, I think I am in good shape, but if you find any nice software for plotting streamlines, then it would be great to add either to this thread or the future wiki page.`

Is this better? Wind in Finland

Explanation: Noaa publishes metar-messages: http://weather.noaa.gov/pub/data/observations/metar/stations/ A php-script reads those stations, that are in my database. Repeated every 30 minutes. There is a matrix with the vector starting points. Another php-script interpolates the wind value for each matrix point using 5 nearest metar-stations. A php-script creates an image file, loads the background map, plots the vectors and saves the png-file. The file is then transferred from my home server to a hosted server (my domain palapeli.net).

Development idea: reading a wind forecast for same point. Then create a similar matrix for the forecast. Then show at 3 minute interval an interpolatian between the observed and the forecasted wind matrix. But who cares, I am LAZY. Wont do it because its no challenge.

BTW: palapeli is a finnish word for jigsaw puzzle. There are hundreds of pieces scattered around the server.

`Is this better? [Wind in Finland](http://palapeli.net/tuuli.png) Explanation: Noaa publishes metar-messages: http://weather.noaa.gov/pub/data/observations/metar/stations/ A php-script reads those stations, that are in my database. Repeated every 30 minutes. There is a matrix with the vector starting points. Another php-script interpolates the wind value for each matrix point using 5 nearest metar-stations. A php-script creates an image file, loads the background map, plots the vectors and saves the png-file. The file is then transferred from my home server to a hosted server (my domain palapeli.net). Development idea: reading a wind forecast for same point. Then create a similar matrix for the forecast. Then show at 3 minute interval an interpolatian between the observed and the forecasted wind matrix. But who cares, I am LAZY. Wont do it because its no challenge. BTW: palapeli is a finnish word for jigsaw puzzle. There are hundreds of pieces scattered around the server.`

It looks cool, though I don't fully understand what is being shown.

You start with a matrix of vectors, which are the raw observations, right? What is meant by interpolating the wind value for each of the nearest 5 metar stations? Does that mean the nearest 5 points in the matrix, or a smoothing process that involves 5 points on a path. Are you using something like an Euler method, with large steps, and placing the tail of one vector at the tip of the previous one?

Looking at the picture, I can almost see the streamlines there, though I'm not sure if what I am visually reconstructing are the actual streamlines of raw vector field -- depends upon whether you are displaying the raw vectors, or some derived field.

To be clear, the streamlines are completely smooth curves (except if they are chaotic :), which would be obtained by integrating over a path of infinitesmal steps. We can approximate these by doing a numerical integration involving

verysmall steps.But in a nice streamplot, which consists of a family of fairly closely spaced continuous curves, we can't rely on arrows to show the vector field at the points on the curve -- the arrows will cut through the streamlines, and will generally clutter the display.

The tangent vector to the streamlines naturally shows the slope of the vector field. In terms of direction, all that is needed is one little arrow to show the orientation of the streamline. What is really lost is the magnitude of the vector field, the speed. The streamplot function in matplot lib, which I linked to above, has two methods for showing the speed: via the thickness of the streamline at a point, and via a colormap. They are both useful. I am using the colormap to indicate the equilibrium points: with a color map that has just two colors, with one of the colors assigned to the range of very small speeds.

Now is your application, which looks like a possibly good way to visualize wind fields, some kind of hybrid between a vector plot and a stream plot? If you give a some more detail on your algorithm -- not a code dump, but something closer to pseudo code -- it would become more clear.

`It looks cool, though I don't fully understand what is being shown. You start with a matrix of vectors, which are the raw observations, right? What is meant by interpolating the wind value for each of the nearest 5 metar stations? Does that mean the nearest 5 points in the matrix, or a smoothing process that involves 5 points on a path. Are you using something like an Euler method, with large steps, and placing the tail of one vector at the tip of the previous one? Looking at the picture, I can almost see the streamlines there, though I'm not sure if what I am visually reconstructing are the actual streamlines of raw vector field -- depends upon whether you are displaying the raw vectors, or some derived field. * * * To be clear, the streamlines are completely smooth curves (except if they are chaotic :), which would be obtained by integrating over a path of infinitesmal steps. We can approximate these by doing a numerical integration involving _very_ small steps. But in a nice streamplot, which consists of a family of fairly closely spaced continuous curves, we can't rely on arrows to show the vector field at the points on the curve -- the arrows will cut through the streamlines, and will generally clutter the display. The tangent vector to the streamlines naturally shows the slope of the vector field. In terms of direction, all that is needed is one little arrow to show the orientation of the streamline. What is really lost is the magnitude of the vector field, the speed. The streamplot function in matplot lib, which I linked to above, has two methods for showing the speed: via the thickness of the streamline at a point, and via a colormap. They are both useful. I am using the colormap to indicate the equilibrium points: with a color map that has just two colors, with one of the colors assigned to the range of very small speeds. * * * Now is your application, which looks like a possibly good way to visualize wind fields, some kind of hybrid between a vector plot and a stream plot? If you give a some more detail on your algorithm -- not a code dump, but something closer to pseudo code -- it would become more clear.`

On the map there are about 20-30 raw points. The actual raw data is shown with green arrows starting from airports. They are best seen on the west side, in Sweden. The names of the airports are blue, like ESNO, ESNU and ESPA. In Finland they are EFTU, EFRO etc. I calculate the red vectors from those raw observations. Only the matrix points are ready, 10*10 km grid. For each matrix point I search five nearest airports, that is raw vectors and calculate a weighted average (by distance) from tgose five nearest observations. The streamlines might be smooth, but there are two problems with my method of calculation. First, there are no raw values in the east and west side of the matrix. Then the five nearest are not always the same for neighbouring matrix points. Eg for a matrix point in the left side, you might have raw points A, B, C, D and E. When you go up to the next matrix point, the raw points are B, C, D, E and F. The wind vector difference can be huge between A and F, so there will be discontinuities when the five nearest are not the same.

The scripst are php-files. You can have them if you like (and understand php). Sometimes I use ready packages, but for me writing software is a hobby, so I often write the applications from the scratch.

I first showd you this picture. It is similar to that map, except no background image and no arrow heads. The green lines are better visible there (the raw data). I just modified this for you. I find the arrowheads cluttering. The matrix should have less points with arrows.

`On the map there are about 20-30 raw points. The actual raw data is shown with green arrows starting from airports. They are best seen on the west side, in Sweden. The names of the airports are blue, like ESNO, ESNU and ESPA. In Finland they are EFTU, EFRO etc. I calculate the red vectors from those raw observations. Only the matrix points are ready, 10*10 km grid. For each matrix point I search five nearest airports, that is raw vectors and calculate a weighted average (by distance) from tgose five nearest observations. The streamlines might be smooth, but there are two problems with my method of calculation. First, there are no raw values in the east and west side of the matrix. Then the five nearest are not always the same for neighbouring matrix points. Eg for a matrix point in the left side, you might have raw points A, B, C, D and E. When you go up to the next matrix point, the raw points are B, C, D, E and F. The wind vector difference can be huge between A and F, so there will be discontinuities when the five nearest are not the same. The scripst are php-files. You can have them if you like (and understand php). Sometimes I use ready packages, but for me writing software is a hobby, so I often write the applications from the scratch. I first showd you [this picture](http://www.palapeli.net/twind.png). It is similar to that map, except no background image and no arrow heads. The green lines are better visible there (the raw data). I just modified this for you. I find the arrowheads cluttering. The matrix should have less points with arrows.`

Finnish Meteorological Institute FMI has opened its weather data (obs+predictions). Here is an example of wind vectors made by someone: http://meteo.fi/en/hirfmi/southfinland/wind.html EXAMPLE

`Finnish Meteorological Institute FMI has opened its weather data (obs+predictions). Here is an example of wind vectors made by someone: http://meteo.fi/en/hirfmi/southfinland/wind.html [EXAMPLE](http://meteo.fi/en/hirfmi/southfinland/wind.html)`

Inspired by the hint.fm wind project, a new project called Earth displays interactive maps of various meterological data. The have an About page, a Facebook page, and a GitHub repository. It's not immediately clear from the main page that they can visualize a variety of data; click on the word "earth" for a menu. Some examples are the recent polar vortex excursion and ocean currents.

`Inspired by the [hint.fm wind project](http://hint.fm/wind/), a new project called [Earth](http://earth.nullschool.net/) displays interactive maps of various meterological data. The have an [About page](http://earth.nullschool.net/about.html), a [Facebook page](https://www.facebook.com/EarthWindMap), and a [GitHub repository](https://github.com/cambecc/earth). It's not immediately clear from the main page that they can visualize a variety of data; click on the word "earth" for a menu. Some examples are [the recent polar vortex excursion](http://earth.nullschool.net/#2014/01/30/0000Z/wind/isobaric/10hPa/orthographic=-125.86,55.29,356) and [ocean currents](http://earth.nullschool.net/#current/ocean/surface/currents/orthographic).`

Wow, that is an amazing website. Awesome!

`Wow, that is an amazing website. Awesome!`