Sha256: dadd5a4fd1148460fbe0be905aa6422c7bd9be0c50be69bc907643999b0b046a

Contents?: true

Size: 607 Bytes

Versions: 7

Compression:

Stored size: 607 Bytes

Contents

require 'nyaplot'
require 'mapnya'

path = File.expand_path("../../notebook/data/wind.csv", __FILE__)
abs = []
df = Nyaplot::DataFrame.from_csv(path)
df.filter!{|row| !(row[:lon] < 200 && row[:lon] > 175)}
df.each_row{|row| row[:uwnd] = row[:uwnd]/3; row[:vwnd] = row[:vwnd]/3}
df.each_row{|row| abs.push(Math.sqrt(row[:uwnd]*row[:uwnd]+row[:vwnd]*row[:vwnd]))}
df.abs = abs

plot = Nyaplot::MapPlot.new
vectors = plot.add_with_df(df, :vectors, :lon, :lat)
vectors.dx(:uwnd)
vectors.dy(:vwnd)
vectors.fill_by(:abs)

color = Nyaplot::Colors.OrRd(3)
vectors.color(color)
plot.export_html("wind_vectors.html")

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
nyaplot-0.1.6 examples/rb/wind.rb
nyaplot-0.1.5 examples/rb/wind.rb
nyaplot-0.1.4 examples/rb/wind.rb
nyaplot-0.2.0.rc1 examples/rb/wind.rb
nyaplot-0.1.3 examples/rb/wind.rb
nyaplot-0.1.2 examples/rb/wind.rb
nyaplot-0.1.1 examples/rb/wind.rb