#!/usr/bin/env ruby require 'process_log.rb' data = ProcessLog::log2hash($stdin) #data = {} x = plot_data_sat = [] # X y = plot_data_freq = [] # Y d = plot_data_power = [] # d data.sort.each{|sat| sid, sat_val = sat if plot_data_sat.empty? then sat_val.sort.each{|freq_data| plot_data_freq << (freq_data[0] / 1E6) } end plot_data_power << [] sat_val.sort.each{|freq_data| plot_data_power.last << freq_data[1][ProcessLog::MAX][0] } plot_data_sat << sid } data_string = "" x.each_with_index{|xv, i| y.each_with_index{|yv, j| data_string << "#{xv} #{yv} #{d[i][j]}\n" } } p data_string grd_file = 'test.grd' region = '1/36/1.395/1.405' =begin command_param = { '-R' => region, # grid region '-I' => '0.5/0.0005', # grid interval '-S' => '1', # search radirus '-G' => grd_file, # grid file '-V' => '', '-N1' => '' } xyz2grd_command = "nearneighbor" =end command_param = { '-R' => region, # grid region '-I' => '1/0.001', # grid interval '-G' => grd_file, # grid file '-V' => '' } xyz2grd_command = "xyz2grd" command_param.each{|key, value| xyz2grd_command += " #{key}#{value}" } IO::popen(xyz2grd_command, 'w+'){|io| io << data_string } cptfile = 'test.cpt' COMMANDS =<<__STRING__ makecpt -Cpolar -T200/1200/25 -Z -V > #{cptfile} grdimage #{grd_file} -R#{region} -JX1/1 -C#{cptfile} -P -V > test.ps __STRING__ COMMANDS.each{|line| puts line puts `#{line}` } =begin COMMANDS =<<`__STRING__` grdmath -R-15/15/-15/15 -I0.3 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH NEG 10 DIV EXP MUL = sombrero.grd echo '-5 128 5 128' > gray.cpt grdgradient sombrero.grd -A225 -Gintensity.grd -Nt0.75 grdview sombrero.grd -JX6i -JZ2i -B5/5/0.5SEwnZ -N-1/white -Qs -Iintensity.grd -X1.5i -K -Cgray.cpt -R-15/15/-15/15/-1/1 -E120/30 -U/-1.25i/-0.75i/"Example 5 in Cookbook" > example_05.eps echo "4.1 5.5 50 0 33 BC z(r) = cos (2@~p@~r/8) * e@+-r/10@+" | pstext -R0/11/0/8.5 -Jx1i -O >> example_05.eps __STRING__ COMMANDS.each{|line| puts `line` } =end __END__ grd2xyz test.grd | psxyz -R1/36/1.395/1.405/200/1200 -JX1/0.5 -So0.02587/0.05 -JZ4 -V -E200/75 -Glightgray > test.eps