[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dennou-ruby:003212] gpview へのパッチ
- To: dennou-ruby@xxxxxxxxxxx
- Subject: [dennou-ruby:003212] gpview へのパッチ
- From: Takayuki Tanigawa <tanigawa@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 15 Nov 2010 20:00:54 +0900
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=gamma;        h=domainkey-signature:received:mime-version:sender:received:from:date         :x-google-sender-auth:message-id:subject:to:content-type;        bh=ehtXJTe4F7dE/W/WILlbS8fkvWivkUxLEUmihJKH3mI=;        b=lAVfSw6/P0bBj/HFl8lSKz7zZ4OaJWOw/DvtDkTmMthIMkU2Ol/XMN08HezevvNk+m         gYHRFTzlXU6BPd63XITkQLKmYGWWLF4alpfgbdlRqS7+BggKVgK9jtSIMKeoFRPSpYfW         jLS1X+P5napDTFN4MS6tAIaFT9TfbJ///8El4=
- Sender: takayuki0418@xxxxxxxxx
北大低温研の谷川と申します。
gpview に添付のパッチの様なものを取りこんでもらうことは
可能でしょうか?
具体的には、オプションに数学関数を指定すると、その演算を
施した結果を作図する、というものです。
使用例:
    % gpview --operation log10 data.nc@temp,lon=0
個人的には log10 しか使ってないのですが、数学関数のうち
引数が一つのもの(例:sqrt, sin など)は全て問題なく行えると
思います。
オプションの名前 (operation) は他の方が良いかもしれません。
ご検討頂けたら幸いです。
-- 
Takayuki Tanigawa
Center for Planetary Science / ILTS, Hokkaido University
--- gpview.org	2009-01-16 05:57:04.000000000 +0900
+++ gpview	2010-11-15 18:51:31.000000000 +0900
@@ -90,7 +90,10 @@
                            coast_world, border_world, plate_world, state_usa,
                            coast_japan, pref_japan  
 
-
+  --operation <math_func>: operation of the specified math function on
+                           the data.
+                           <math_func> should be a math function with one
+                           argument such as log10, sqrt, sin, etc.
 
 ===LINE/MARK OPTIONS
 
@@ -162,6 +165,7 @@
     % gpview --levels 0,10,20,30 --pattern 30999,40999,50999,60999,70999 data.nc@temp
     % gpview --overplot=3 --anim t data.nc@temp,lon=0
     % gpview --mark data.nc@temp,lon=0,lat=0
+    % gpview --operation log10 data.nc@temp,lon=0
 
   For multiple Gphys variables, 
     % gpview data1.nc@temp data2.nc@temp
@@ -553,6 +557,7 @@
                    ['--mean',                     GetoptLong::REQUIRED_ARGUMENT],
                    ['--map',                      GetoptLong::REQUIRED_ARGUMENT],
                    ['--m',                        GetoptLong::NO_ARGUMENT],
+                   ['--operation',                GetoptLong::REQUIRED_ARGUMENT],
                    ###     line/mark option    ###
                    ['--line',                     GetoptLong::NO_ARGUMENT],
                    ['--mark',                     GetoptLong::NO_ARGUMENT],
@@ -644,6 +649,11 @@
     }
   end
 
+## operation of a mathematical function
+  if ($OPT_operation)
+    eval "gp = gp.#{$OPT_operation}"
+  end
+  
   GGraph.margin_info($0, gturl) if $annotate  # draw margin infomation
   kind_of_fig = draw_setup(gp)                # determine figure kind