gphys 1.4.3.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.ChangeLog.until201303 +2156 -0
- data/.gitignore +7 -1
- data/Rakefile +36 -1
- data/bin/gpview +75 -58
- data/{dim_op.c → ext/numru/gphys/dim_op.c} +4 -1
- data/{ext_coord.c → ext/numru/gphys/ext_coord.c} +35 -17
- data/{ext_init.c → ext/numru/gphys/ext_init.c} +0 -0
- data/ext/numru/gphys/extconf.rb +43 -0
- data/{interpo.c → ext/numru/gphys/interpo.c} +35 -30
- data/{multibitIO.c → ext/numru/gphys/multibitIO.c} +19 -15
- data/gphys-bigmem.gemspec +44 -0
- data/gphys.gemspec +4 -4
- data/lib/numru/dclext.rb +55 -0
- data/lib/numru/derivative.rb +6 -5
- data/lib/numru/ganalysis/met.rb +27 -10
- data/lib/numru/ganalysis/qg.rb +4 -3
- data/lib/numru/ganalysis/sph_harmonic_iso_g.rb +290 -0
- data/lib/numru/ggraph.rb +81 -2
- data/lib/numru/gphys/derivative.rb +3 -2
- data/lib/numru/gphys/gpcommon.rb +7 -1
- data/lib/numru/gphys/gphys_fft.rb +3 -3
- data/lib/numru/gphys/gphys_hdfeos5_io.rb +14 -13
- data/lib/numru/gphys/grib.rb +18 -7
- data/lib/numru/gphys/gtool3.rb +53 -52
- data/lib/numru/gphys/interpolate.rb +3 -2
- data/lib/numru/gphys/varraycomposite.rb +1 -1
- data/lib/numru/gphys/varraynetcdf.rb +38 -0
- data/lib/numru/gphys/version.rb +2 -1
- data/test/test_axis.rb +1 -5
- data/test/test_fitting.rb +0 -1
- data/test/test_gphys.rb +9 -5
- data/test/test_met_z.rb +1 -2
- data/test/test_sigma_coord.rb +0 -1
- metadata +36 -19
- checksums.yaml +0 -15
- data/.rspec +0 -2
- data/.travis.yml +0 -3
- data/ChangeLog +0 -7007
- data/extconf.rb +0 -51
- data/spec/gphys_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -2
    
        data/lib/numru/ggraph.rb
    CHANGED
    
    | @@ -115,6 +115,40 @@ library if you like. | |
| 115 115 |  | 
| 116 116 | 
             
            ==Module Functions
         | 
| 117 117 |  | 
| 118 | 
            +
            ---startup(options)
         | 
| 119 | 
            +
             | 
| 120 | 
            +
                If called, it calls some DCL methods for easy start-up.
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                By default, it does a typical setting. You can change it by
         | 
| 123 | 
            +
                giving options. This methods covers only a few DCL parameters.
         | 
| 124 | 
            +
                For neat graphics, you will need to call DCL methods directly.
         | 
| 125 | 
            +
             | 
| 126 | 
            +
                ARGUMENTS
         | 
| 127 | 
            +
                * options (Hash) : options to change the default behavior if specified.
         | 
| 128 | 
            +
                   option name	default value	# description:
         | 
| 129 | 
            +
                   "iws"     1    # DCL sgpack param: Workstation ID (1:display, 2:file
         | 
| 130 | 
            +
                                  # if DCL ver>=6)
         | 
| 131 | 
            +
                   "ifl"     4    # DCL swpack param (for DCL ver.>=6): file format num
         | 
| 132 | 
            +
                                  # for iws==2 (1:png,2:eps,3:svg,4:pdf)
         | 
| 133 | 
            +
                   "colormap"  1  # DCL color map number (Integer)
         | 
| 134 | 
            +
                   "iwidth"  nil  # DCL swpack param (Integer): display width
         | 
| 135 | 
            +
                                  # (pixcels)
         | 
| 136 | 
            +
                   "iheight" nil  # DCL swpack param (Integer): display height
         | 
| 137 | 
            +
                                  # (pixcels)
         | 
| 138 | 
            +
                   "lwait"   true # DCL swpack param (true/false): wait mouse click
         | 
| 139 | 
            +
                                  # to show next page
         | 
| 140 | 
            +
                   "isub"    96   # DCL sgpack param (Integer): control character of
         | 
| 141 | 
            +
                                  # subscription 96=>"`"; 95=>"_". Note that DCL's
         | 
| 142 | 
            +
                                  # default is 95.
         | 
| 143 | 
            +
                   "lmiss"   true # DCL glpack param (true/false): whether to do
         | 
| 144 | 
            +
                                  # missing value processing. Note that DCL's default
         | 
| 145 | 
            +
                                  # is false.
         | 
| 146 | 
            +
                   "help"   false # show help message if true
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            ---close
         | 
| 149 | 
            +
             | 
| 150 | 
            +
                Close. (it just calls DCL.grcls).
         | 
| 151 | 
            +
             | 
| 118 152 | 
             
            ---margin_info(program=nil, data_source=nil, char_height=nil, date=nil, xl=0.0, xr=0.0, yb=nil, yt=0.0)
         | 
| 119 153 |  | 
| 120 154 | 
             
                Sets the strings to appear in the bottom margin.
         | 
| @@ -1105,6 +1139,34 @@ module NumRu | |
| 1105 1139 |  | 
| 1106 1140 | 
             
                module_function
         | 
| 1107 1141 |  | 
| 1142 | 
            +
                @@startup_options = Misc::KeywordOptAutoHelp.new(
         | 
| 1143 | 
            +
                  ['iws', 1, 'DCL sgpack param: Workstation ID (1:display, 2:file if DCL ver>=6)'],
         | 
| 1144 | 
            +
                  ['ifl', 4, 'DCL swpack param (for DCL ver.>=6): file format num for iws==2 (1:png,2:eps,3:svg,4:pdf)'],
         | 
| 1145 | 
            +
                  ['colormap', 1, 'DCL color map number (Integer)'],
         | 
| 1146 | 
            +
                  ['iwidth', nil, 'DCL swpack param (Integer): display width (pixcels)'],
         | 
| 1147 | 
            +
                  ['iheight', nil, 'DCL swpack param (Integer): display height (pixcels)'],
         | 
| 1148 | 
            +
                  ['lwait', true, 'DCL swpack param (true/false): wait mouse click to show next page'],
         | 
| 1149 | 
            +
                  ['isub', 96, 'DCL sgpack param (Integer): control character of subscription 96=>"`"; 95=>"_". Note that DCL\'s default is 95.'],
         | 
| 1150 | 
            +
                  ['lmiss', true, 'DCL glpack param (true/false): whether to do missing value processing. Note that DCL\'s default is false.']
         | 
| 1151 | 
            +
                )
         | 
| 1152 | 
            +
             | 
| 1153 | 
            +
                def startup(options=nil)
         | 
| 1154 | 
            +
                  opts = @@startup_options.interpret(options)
         | 
| 1155 | 
            +
                  DCL.swpset('iwidth',opts['iwidth'])  if opts['iwidth']
         | 
| 1156 | 
            +
                  DCL.swpset('iheight',opts['iheight'])  if opts['iheight']
         | 
| 1157 | 
            +
                  DCL.swpset('ifl',opts['ifl']) if DCL::DCLVERSION >= "6"
         | 
| 1158 | 
            +
                  DCL.sgscmn(opts['colormap'])
         | 
| 1159 | 
            +
             | 
| 1160 | 
            +
                  DCL.gropn(opts['iws'])
         | 
| 1161 | 
            +
             | 
| 1162 | 
            +
                  DCL.sgpset('isub', opts['isub'])
         | 
| 1163 | 
            +
                  DCL.glpset('lmiss', opts['lmiss'])
         | 
| 1164 | 
            +
                end
         | 
| 1165 | 
            +
             | 
| 1166 | 
            +
                def close
         | 
| 1167 | 
            +
                  DCL.grcls
         | 
| 1168 | 
            +
                end
         | 
| 1169 | 
            +
             | 
| 1108 1170 | 
             
                def gropn_1_if_not_yet
         | 
| 1109 1171 | 
             
                  if DCL.sgpget("iws") == 0
         | 
| 1110 1172 | 
             
                    DCL.gropn(1)
         | 
| @@ -2738,7 +2800,7 @@ module NumRu | |
| 2738 2800 |  | 
| 2739 2801 | 
             
                  val = gp.data.val
         | 
| 2740 2802 | 
             
                  if ( opts['ltone'] && 
         | 
| 2741 | 
            -
                      ( opts['tonf'] || opts['auto'] && 
         | 
| 2803 | 
            +
                      ( opts['tonf'] || opts['auto'] && !opts['tonb'] && !opts['tonc'] &&
         | 
| 2742 2804 | 
             
                        ( val.length >= TONE_TONF_THRES_SIZE || val.shape.min >= TONE_TONF_THRES_LEN ) ) )
         | 
| 2743 2805 | 
             
                    DCL.uetonf(val)
         | 
| 2744 2806 | 
             
                  elsif opts['tonb'] && opts['ltone']
         | 
| @@ -3051,11 +3113,28 @@ module NumRu | |
| 3051 3113 | 
             
                   @@data_prep_options
         | 
| 3052 3114 | 
             
                )
         | 
| 3053 3115 |  | 
| 3116 | 
            +
                def set_vector(options)
         | 
| 3117 | 
            +
                  @@vector_options.set(options)
         | 
| 3118 | 
            +
                end
         | 
| 3119 | 
            +
                @@next_vector = nil
         | 
| 3120 | 
            +
                def next_vector(options)
         | 
| 3121 | 
            +
                  if options.is_a?(Hash)
         | 
| 3122 | 
            +
                    @@next_vector = options
         | 
| 3123 | 
            +
                  else
         | 
| 3124 | 
            +
                    raise TypeError,"Hash expected"
         | 
| 3125 | 
            +
                  end
         | 
| 3126 | 
            +
                  nil
         | 
| 3127 | 
            +
                end
         | 
| 3128 | 
            +
             | 
| 3054 3129 | 
             
                def vector(fx, fy, newframe=true, options=nil)
         | 
| 3055 3130 | 
             
                  gropn_1_if_not_yet
         | 
| 3056 3131 | 
             
                  if newframe!=true && newframe!=false
         | 
| 3057 3132 | 
             
                    raise ArgumentError, "2nd arg (newframe) must be true or false"
         | 
| 3058 3133 | 
             
                  end
         | 
| 3134 | 
            +
                  if @@next_vector
         | 
| 3135 | 
            +
                    options = ( options ? @@next_vector.update(options) : @@next_vector )
         | 
| 3136 | 
            +
                    @@next_vector = nil
         | 
| 3137 | 
            +
                  end
         | 
| 3059 3138 | 
             
                  opts = @@vector_options.interpret(options)
         | 
| 3060 3139 | 
             
                  xax, yax, closer, fx, fy = data_prep_2D([fx,fy], newframe, opts)
         | 
| 3061 3140 | 
             
                  if newframe
         | 
| @@ -3670,7 +3749,7 @@ if $0 == __FILE__ | |
| 3670 3749 |  | 
| 3671 3750 | 
             
              #/ graph 45 /
         | 
| 3672 3751 | 
             
              GGraph.set_fig('viewport'=>[0.2,0.8,0.2,0.8])
         | 
| 3673 | 
            -
              GGraph.tone(gphys, true, "auto"=>true | 
| 3752 | 
            +
              GGraph.tone(gphys, true, "auto"=>true)
         | 
| 3674 3753 | 
             
              GGraph.contour(gphys, false)
         | 
| 3675 3754 | 
             
              GGraph.color_bar
         | 
| 3676 3755 |  | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 1 2 | 
             
            require 'narray'
         | 
| 2 3 | 
             
            require 'numru/gphys'
         | 
| 3 4 | 
             
            require 'numru/derivative'
         | 
| @@ -36,7 +37,7 @@ Module functions of Derivative Operater for GPhys. | |
| 36 37 | 
             
                  to. z.rank must be 1.
         | 
| 37 38 | 
             
                * dim (Numeric): a Numeric represents the dimention which derivative 
         | 
| 38 39 | 
             
                  respect to. you can give number count backward (((<dim>))<0), but 
         | 
| 39 | 
            -
                  ((<z.rank  | 
| 40 | 
            +
                  ((<z.rank +dim>)) must be > 0. 
         | 
| 40 41 | 
             
                * bc (Numeric) : a Numeric which represent boundary condition.
         | 
| 41 42 | 
             
                  Supported conditions are:
         | 
| 42 43 | 
             
                   * LINEAR_EXT(=1) : default value
         | 
| @@ -59,7 +60,7 @@ Module functions of Derivative Operater for GPhys. | |
| 59 60 | 
             
                * gp (GPhys): a GPhys which you want to derivative.
         | 
| 60 61 | 
             
                * dim_or_dimname (Numeric or String): a Numeric or String represents
         | 
| 61 62 | 
             
                  the dimension which derivate respect to. you can give number count 
         | 
| 62 | 
            -
                  backward (((<dim>))<0), but ((<z.rank  | 
| 63 | 
            +
                  backward (((<dim>))<0), but ((<z.rank +dim>)) must be > 0. 
         | 
| 63 64 | 
             
                * bc (Numeric) : a Numeric which represent boundary condition.
         | 
| 64 65 | 
             
                  Supported conditions are:
         | 
| 65 66 | 
             
                   * LINEAR_EXT(=1) : default value
         | 
    
        data/lib/numru/gphys/gpcommon.rb
    CHANGED
    
    | @@ -16,12 +16,18 @@ | |
| 16 16 | 
             
              2005/08/23  S Takehiro (created)
         | 
| 17 17 | 
             
              2008/02/14  S Takehiro (copy_global_att can deal with GPhys 
         | 
| 18 18 | 
             
                                      which consists of multiple files)
         | 
| 19 | 
            +
              2015/09/06  H Kashimura && S Takehiro (fixed for installation by gem)
         | 
| 19 20 |  | 
| 20 21 | 
             
            =end
         | 
| 21 22 |  | 
| 22 23 | 
             
            #------------------------ print help message ------------------------
         | 
| 23 24 | 
             
            def help
         | 
| 24 | 
            -
               | 
| 25 | 
            +
              begin 
         | 
| 26 | 
            +
                file = File.open(Gem.bin_path("gphys",File.basename($0)))
         | 
| 27 | 
            +
              rescue
         | 
| 28 | 
            +
                file = File.open($0)
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            #  file = File.open($0)
         | 
| 25 31 | 
             
              after_begin = false
         | 
| 26 32 | 
             
              after_end = false
         | 
| 27 33 | 
             
              while (line = file.gets)
         | 
| @@ -463,7 +463,7 @@ module NumRu | |
| 463 463 | 
             
                  end
         | 
| 464 464 | 
             
                  if dir == @@fft_forward
         | 
| 465 465 | 
             
            	if dims.length == 0
         | 
| 466 | 
            -
            	  fcoef = fcoef / fcoef.length | 
| 466 | 
            +
            	  fcoef = fcoef / fcoef.length.to_f   # normalized if forward FT
         | 
| 467 467 | 
             
            	else
         | 
| 468 468 | 
             
            	  sh = fcoef.shape
         | 
| 469 469 | 
             
            	  len = 1
         | 
| @@ -483,7 +483,7 @@ module NumRu | |
| 483 483 | 
             
            	  cv = gfc.coord(i).val
         | 
| 484 484 | 
             
            	  n = cv.length
         | 
| 485 485 | 
             
            	  clen = (cv.max - cv.min) * n / (n-1)
         | 
| 486 | 
            -
            	  wn = (2*Math::PI/clen) * NArray.new(cv.typecode,cv.length).indgen | 
| 486 | 
            +
            	  wn = (2*Math::PI/clen) * NArray.new(cv.typecode,cv.length).indgen!.to_f
         | 
| 487 487 | 
             
            	  if (!backward)
         | 
| 488 488 | 
             
            	    gfc.coord(i).set_att('origin_in_real_space',cv[0..0])
         | 
| 489 489 | 
             
            	  else 
         | 
| @@ -619,7 +619,7 @@ module NumRu | |
| 619 619 | 
             
                    if !factor
         | 
| 620 620 | 
             
            	  factor = dwn**(-1)
         | 
| 621 621 | 
             
            	else
         | 
| 622 | 
            -
            	  factor = factor / dwn
         | 
| 622 | 
            +
            	  factor = factor / dwn.to_f
         | 
| 623 623 | 
             
            	end
         | 
| 624 624 | 
             
                  }
         | 
| 625 625 | 
             
                  self * factor
         | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 1 2 | 
             
            require "numru/gphys/gphys"
         | 
| 2 3 | 
             
            require "numru/gphys/varrayhdfeos5"
         | 
| 3 4 |  | 
| @@ -337,8 +338,8 @@ module NumRu | |
| 337 338 | 
             
                  end
         | 
| 338 339 |  | 
| 339 340 | 
             
                  def __make_gd_axes(var0, grid, data)
         | 
| 340 | 
            -
                    dim_names = var0.dim_names #  | 
| 341 | 
            -
                    unlocated_dim_names = var0.dim_names #  | 
| 341 | 
            +
                    dim_names = var0.dim_names # 次元の名前
         | 
| 342 | 
            +
                    unlocated_dim_names = var0.dim_names # まだ軸の決まっていない次元の名前
         | 
| 342 343 | 
             
                    unused_var_names = grid.var_names
         | 
| 343 344 | 
             
                    axes = Array.new
         | 
| 344 345 |  | 
| @@ -358,7 +359,7 @@ module NumRu | |
| 358 359 | 
             
                    end
         | 
| 359 360 |  | 
| 360 361 | 
             
                    # (#2) Empirical rule (from EOS-AURA, MLS, etc)
         | 
| 361 | 
            -
                    # (#2-1)  | 
| 362 | 
            +
                    # (#2-1) 軸が未確定の次元に対し、次元名と一致する名前を持つ1次元変数を座標変数として採用する
         | 
| 362 363 | 
             
                    unlocated_dim_names.each do |dim_nm|
         | 
| 363 364 | 
             
                      if unused_var_names.include?(dim_nm)
         | 
| 364 365 | 
             
                        vary = __files2varray( grid, dim_nm)
         | 
| @@ -370,7 +371,7 @@ module NumRu | |
| 370 371 | 
             
                      end
         | 
| 371 372 | 
             
                    end
         | 
| 372 373 |  | 
| 373 | 
            -
                    # (#2-2)  | 
| 374 | 
            +
                    # (#2-2) 軸が未確定の次元に対し、その次元を使って定義されている1次元変数を座標変数として採用する
         | 
| 374 375 | 
             
                    # (a) select variables match to Regexp. 
         | 
| 375 376 | 
             
                    @@predef_gdcoords.each do |reg_exp|
         | 
| 376 377 | 
             
                      unlocated_dim_names.each do |dim_nm|
         | 
| @@ -397,8 +398,8 @@ module NumRu | |
| 397 398 | 
             
                      end
         | 
| 398 399 | 
             
                    end
         | 
| 399 400 |  | 
| 400 | 
            -
                    # (#2-3)  | 
| 401 | 
            -
                    #  | 
| 401 | 
            +
                    # (#2-3) 座標変数はファイル中にないものとみなし,
         | 
| 402 | 
            +
                    # ダミーとして 0,1,2,... が割り当てられるようにする.
         | 
| 402 403 | 
             
                    unlocated_dim_names.each do |dim_nm|
         | 
| 403 404 | 
             
                      nary_length = data.shape_current[dim_names.index(dim_nm)]
         | 
| 404 405 | 
             
                      nary = NArray[0...nary_length]
         | 
| @@ -413,14 +414,14 @@ module NumRu | |
| 413 414 | 
             
                  private :__make_gd_axes
         | 
| 414 415 |  | 
| 415 416 | 
             
                  def __make_za_axes(var0, za, data)
         | 
| 416 | 
            -
                    dim_names = var0.dim_names #  | 
| 417 | 
            -
                    unlocated_dim_names = var0.dim_names #  | 
| 417 | 
            +
                    dim_names = var0.dim_names # 次元の名前
         | 
| 418 | 
            +
                    unlocated_dim_names = var0.dim_names # まだ軸の決まっていない次元の名前
         | 
| 418 419 | 
             
                    unused_var_names = za.var_names
         | 
| 419 420 | 
             
                    axes = Array.new
         | 
| 420 421 |  | 
| 421 422 | 
             
                    # (#1) HDF-EOS5 standard rule is none.
         | 
| 422 423 | 
             
                    # (#2) Empirical rule (from EOS-AURA, MLS, etc)
         | 
| 423 | 
            -
                    # (#2-1)  | 
| 424 | 
            +
                    # (#2-1) 次元名と一致する名前を持つ1次元変数を座標変数として採用する
         | 
| 424 425 | 
             
                    unlocated_dim_names.each do |dim_nm|
         | 
| 425 426 | 
             
                      if unused_var_names.include?(dim_nm)
         | 
| 426 427 | 
             
                        vary = __files2varray( za, dim_nm)
         | 
| @@ -432,7 +433,7 @@ module NumRu | |
| 432 433 | 
             
                      end
         | 
| 433 434 | 
             
                    end
         | 
| 434 435 |  | 
| 435 | 
            -
                    # (#2-2)  | 
| 436 | 
            +
                    # (#2-2) 軸が未確定の次元に対し、その次元を使って定義されている1次元変数を座標変数として採用する
         | 
| 436 437 | 
             
                    # (a) select variables match to Regexp. 
         | 
| 437 438 | 
             
                    @@predef_zacoords.each do |reg_exp|
         | 
| 438 439 | 
             
                      unlocated_dim_names.each do |dim_nm|
         | 
| @@ -459,8 +460,8 @@ module NumRu | |
| 459 460 | 
             
                      end
         | 
| 460 461 | 
             
                    end
         | 
| 461 462 |  | 
| 462 | 
            -
                    # (#2-3)  | 
| 463 | 
            -
                    #  | 
| 463 | 
            +
                    # (#2-3) 座標変数はファイル中にないものとみなし,
         | 
| 464 | 
            +
                    # ダミーとして 0,1,2,... が割り当てられるようにする.
         | 
| 464 465 | 
             
                    unlocated_dim_names.each do |dim_nm|
         | 
| 465 466 | 
             
                      nary_length = data.shape_current[dim_names.index(dim_nm)]
         | 
| 466 467 | 
             
                      nary = NArray[0...nary_length]
         | 
| @@ -474,7 +475,7 @@ module NumRu | |
| 474 475 | 
             
                  end
         | 
| 475 476 | 
             
                  private :__make_za_axes
         | 
| 476 477 |  | 
| 477 | 
            -
                  # dim_index  | 
| 478 | 
            +
                  # dim_index に関して実質1次元の変数ならば VArray を返す。そうでなければ nil を返す。
         | 
| 478 479 | 
             
                  def __make_field_one_dimension(aHE5GdField, dim_index)
         | 
| 479 480 | 
             
                    rank = aHE5GdField.rank
         | 
| 480 481 | 
             
                    indexes = Array.new
         | 
    
        data/lib/numru/gphys/grib.rb
    CHANGED
    
    | @@ -611,12 +611,19 @@ class GPhys | |
| 611 611 | 
             
                  end
         | 
| 612 612 | 
             
                  alias :initial= :set_initial
         | 
| 613 613 | 
             
                  def date
         | 
| 614 | 
            -
                     | 
| 615 | 
            -
             | 
| 616 | 
            -
             | 
| 617 | 
            -
                     | 
| 614 | 
            +
                    dt = DateTime.new((@pds.to_uint1(21)-1)*100 + @pds.to_uint1(9),
         | 
| 615 | 
            +
                                       @pds.to_uint1(10), @pds.to_uint1(11),
         | 
| 616 | 
            +
                                       @pds.to_uint1(12), @pds.to_uint1(13) )
         | 
| 617 | 
            +
                    dt += Units[time_unit].convert(p1,"day")  
         | 
| 618 | 
            +
                      # REMARK (horinouchi):
         | 
| 619 | 
            +
                      # Just to add p1 should be OK in the crudest sense,
         | 
| 620 | 
            +
                      # though one can further consider time_range
         | 
| 621 | 
            +
                      # (ref: http://rda.ucar.edu/docs/formats/grib/gribdoc/timer.html)
         | 
| 622 | 
            +
                    d = dt.to_date
         | 
| 623 | 
            +
                    h = [dt.hour, dt.min]
         | 
| 618 624 | 
             
                    return [d,h]
         | 
| 619 625 | 
             
                  end
         | 
| 626 | 
            +
             | 
| 620 627 | 
             
                  def time_unit
         | 
| 621 628 | 
             
                    return TIME_UNITS[ @pds.to_uint1(14) ]
         | 
| 622 629 | 
             
                  end
         | 
| @@ -1238,11 +1245,15 @@ class GPhys | |
| 1238 1245 | 
             
                        #j = nil
         | 
| 1239 1246 | 
             
                        #i = nil
         | 
| 1240 1247 | 
             
                        if map
         | 
| 1241 | 
            -
                          var = NArrayMiss.sfloat( | 
| 1248 | 
            +
                          var = NArrayMiss.sfloat(nlon,nlat)
         | 
| 1242 1249 | 
             
                          map.reshape!(nlon,nlat)
         | 
| 1243 | 
            -
                          mask = map | 
| 1250 | 
            +
                          mask = map
         | 
| 1244 1251 | 
             
                          nd = mask.count_true
         | 
| 1245 | 
            -
                           | 
| 1252 | 
            +
                          wh = mask.where
         | 
| 1253 | 
            +
                          if wh.length>0
         | 
| 1254 | 
            +
                            var[wh] = @sgm.mbio.read2D(@pos+8, nbits_pack, nd, 1, 0, nd-1, 1, 0, 0, 1, nil, nil, e, r).reshape!(nd)
         | 
| 1255 | 
            +
                          end
         | 
| 1256 | 
            +
                          var = var[*index]
         | 
| 1246 1257 | 
             
            =begin
         | 
| 1247 1258 | 
             
                          index[1].each{|j|
         | 
| 1248 1259 | 
             
                            jj = j-index[1].first
         | 
    
        data/lib/numru/gphys/gtool3.rb
    CHANGED
    
    | @@ -1,19 +1,20 @@ | |
| 1 | 
            +
            # -*- coding: utf-8 -*-
         | 
| 1 2 | 
             
            =begin
         | 
| 2 | 
            -
            = Gtool3  | 
| 3 | 
            +
            = Gtool3 形式 IO ライブラリー(といっても O (書き) はなし)
         | 
| 3 4 |  | 
| 4 | 
            -
            ==  | 
| 5 | 
            +
            == 軸ファイル(格子情報ファイル)について
         | 
| 5 6 |  | 
| 6 | 
            -
             | 
| 7 | 
            -
            Gtool3.gtaxdir=  | 
| 7 | 
            +
            環境変数 GTAXDIR で,軸ファイルのありかを指定するか,
         | 
| 8 | 
            +
            Gtool3.gtaxdir= メソッドを使って指定する.
         | 
| 8 9 |  | 
| 9 | 
            -
            == Development Memo /  | 
| 10 | 
            +
            == Development Memo / 開発メモ
         | 
| 10 11 |  | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 12 | 
            +
            複数(一個以上)の変数の組の繰り返しを仮定する.よって,ヘッダを読んで
         | 
| 13 | 
            +
            いって,変数名が,T,U,PS,T,..などと同じのに戻ったら,その時点で T,U,PS
         | 
| 14 | 
            +
            の3変数の繰り返しであるとみなす.こうすることで,GrADS とほぼ同じように
         | 
| 15 | 
            +
            扱えるようになる.なお,実際の Gtool3 ファイルはすべてこれでいけるはず.
         | 
| 15 16 |  | 
| 16 | 
            -
             | 
| 17 | 
            +
            エンディアンはブロック区切りから自動判別する.
         | 
| 17 18 |  | 
| 18 19 |  | 
| 19 20 |  | 
| @@ -414,7 +415,7 @@ module NumRu | |
| 414 415 | 
             
                      #p "*****",varinfo[:rlen]
         | 
| 415 416 | 
             
                      varinfo[:natyp] = NATYP[varinfo["DFMT"]]
         | 
| 416 417 | 
             
                      @varh[ varinfo["ITEM"] ] = varinfo
         | 
| 417 | 
            -
                      start_byte += skip_a_data_block(varinfo, @file)  # shape | 
| 418 | 
            +
                      start_byte += skip_a_data_block(varinfo, @file)  # shapeと型の利用にかえるべき
         | 
| 418 419 | 
             
                    else
         | 
| 419 420 | 
             
                      time_seq = true    # second turn --> regarded as a time sequence
         | 
| 420 421 | 
             
                      break
         | 
| @@ -724,48 +725,48 @@ if $0 == __FILE__ | |
| 724 725 | 
             
            end
         | 
| 725 726 |  | 
| 726 727 | 
             
            =begin
         | 
| 727 | 
            -
                1     & IDFM   & I10   #&  | 
| 728 | 
            -
                2     & DSET   & A16   #&  | 
| 729 | 
            -
                3     & ITEM   & A16   #&  | 
| 730 | 
            -
                4     & EDIT1  & A16   #&  | 
| 731 | 
            -
                5     & EDIT2  & A16   #&  | 
| 728 | 
            +
                1     & IDFM   & I10   #& フォーマットid  & 9009
         | 
| 729 | 
            +
                2     & DSET   & A16   #& データセット名  & AP01
         | 
| 730 | 
            +
                3     & ITEM   & A16   #& 識別名称(変数名)& TMP
         | 
| 731 | 
            +
                4     & EDIT1  & A16   #& 編集略記号(1)   & TM1D
         | 
| 732 | 
            +
                5     & EDIT2  & A16   #& 編集略記号(2)   & XFK1
         | 
| 732 733 | 
             
                ...
         | 
| 733 | 
            -
                11    & EDIT8  & A16   #&  | 
| 734 | 
            -
                12    & FNUM   & I10   #&  | 
| 735 | 
            -
                13    & DNUM   & I10   #&  | 
| 736 | 
            -
                14    & TITL1  & A16   #&  | 
| 737 | 
            -
                15    & TITL2  & A16   #& \ \  | 
| 738 | 
            -
                16    & UNIT   & A16   #&  | 
| 739 | 
            -
                17    & ETTL1  & A16   #&  | 
| 740 | 
            -
                18    & ETTL2  & A16   #&  | 
| 734 | 
            +
                11    & EDIT8  & A16   #& 編集略記号(8)   &  
         | 
| 735 | 
            +
                12    & FNUM   & I10   #& ファイル番号    & 1
         | 
| 736 | 
            +
                13    & DNUM   & I10   #& データ番号      & 100
         | 
| 737 | 
            +
                14    & TITL1  & A16   #& タイトル        & Temperature
         | 
| 738 | 
            +
                15    & TITL2  & A16   #& \ \ 〃 \ \ 続き & 
         | 
| 739 | 
            +
                16    & UNIT   & A16   #& 単位            & K
         | 
| 740 | 
            +
                17    & ETTL1  & A16   #& 編集タイトル(1) & Dayly mean
         | 
| 741 | 
            +
                18    & ETTL2  & A16   #& 編集タイトル(2) & filter (X)
         | 
| 741 742 | 
             
                ...
         | 
| 742 | 
            -
                24    & ETTL8  & A16   #&  | 
| 743 | 
            -
                25    & TIME   & I10   #&  | 
| 744 | 
            -
                27    & UTIM   & A16   #&  | 
| 745 | 
            -
                26    & DATE   & A16   #&  | 
| 746 | 
            -
                28    & TDUR   & I10   #&  | 
| 747 | 
            -
                29    & AITM1  & A16   #&  | 
| 748 | 
            -
                30    & ASTR1  & I10   #&  | 
| 749 | 
            -
                31    & AEND1  & I10   #&  | 
| 750 | 
            -
                32    & AITM2  & A16   #&  | 
| 751 | 
            -
                33    & ASTR2  & I10   #&  | 
| 752 | 
            -
                34    & AEND2  & I10   #&  | 
| 753 | 
            -
                35    & AITM3  & A16   #&  | 
| 754 | 
            -
                36    & ASTR3  & I10   #&  | 
| 755 | 
            -
                37    & AEND3  & I10   #&  | 
| 756 | 
            -
                38    & DFMT   & A16   #&  | 
| 757 | 
            -
                39    & MISS   & E15.7 #&  | 
| 758 | 
            -
                40    & DMIN   & E15.7 #&  | 
| 759 | 
            -
                41    & DMAX   & E15.7 #&  | 
| 760 | 
            -
                42    & DIVS   & E15.7 #&  | 
| 761 | 
            -
                43    & DIVL   & E15.7 #&  | 
| 762 | 
            -
                44    & STYP   & I10   #&  | 
| 763 | 
            -
                45--47& OPTNx  & A16   #&  | 
| 764 | 
            -
                48--59& MEMOxx & A16   #&  | 
| 765 | 
            -
                60    & CDATE  & A16   #&  | 
| 766 | 
            -
                61    & CSIGN  & A16   #&  | 
| 767 | 
            -
                62    & MDATE  & A16   #&  | 
| 768 | 
            -
                63    & MSIGN  & A16   #&  | 
| 769 | 
            -
                64    & SIZE   & I10   #&  | 
| 743 | 
            +
                24    & ETTL8  & A16   #& 編集タイトル(8) &          
         | 
| 744 | 
            +
                25    & TIME   & I10   #& 時刻(通し)      & 18769650900
         | 
| 745 | 
            +
                27    & UTIM   & A16   #& 時刻単位        & SEC
         | 
| 746 | 
            +
                26    & DATE   & A16   #& 時刻(yyyymmddhhmmss) & 19900813122800
         | 
| 747 | 
            +
                28    & TDUR   & I10   #& データ代表時間  & 3600
         | 
| 748 | 
            +
                29    & AITM1  & A16   #& 軸1の格子識別名称 & GLON128
         | 
| 749 | 
            +
                30    & ASTR1  & I10   #& 軸1の格子番号始め &   1
         | 
| 750 | 
            +
                31    & AEND1  & I10   #& 軸1の格子番号終り & 128
         | 
| 751 | 
            +
                32    & AITM2  & A16   #& 軸2の格子識別名称 & GGLA64
         | 
| 752 | 
            +
                33    & ASTR2  & I10   #& 軸2の格子番号始め &   1
         | 
| 753 | 
            +
                34    & AEND2  & I10   #& 軸2の格子番号終り &  64
         | 
| 754 | 
            +
                35    & AITM3  & A16   #& 軸3の格子識別名称 & SIGA12
         | 
| 755 | 
            +
                36    & ASTR3  & I10   #& 軸3の格子番号始め &   1
         | 
| 756 | 
            +
                37    & AEND3  & I10   #& 軸3の格子番号終り &  12
         | 
| 757 | 
            +
                38    & DFMT   & A16   #& データフォーマット & (32F12.5) or UR4
         | 
| 758 | 
            +
                39    & MISS   & E15.7 #& 欠損値の値      & -9999.
         | 
| 759 | 
            +
                40    & DMIN   & E15.7 #& レンジ(最小)    & 100.  
         | 
| 760 | 
            +
                41    & DMAX   & E15.7 #& レンジ(最大)    & 300.  
         | 
| 761 | 
            +
                42    & DIVS   & E15.7 #& 間隔(小)        & 10.   
         | 
| 762 | 
            +
                43    & DIVL   & E15.7 #& 間隔(大)        & 50.   
         | 
| 763 | 
            +
                44    & STYP   & I10   #& スケーリングタイプ & 1  
         | 
| 764 | 
            +
                45--47& OPTNx  & A16   #& 空き            &
         | 
| 765 | 
            +
                48--59& MEMOxx & A16   #& メモ            &
         | 
| 766 | 
            +
                60    & CDATE  & A16   #& データ作成日付  & 19900813122800
         | 
| 767 | 
            +
                61    & CSIGN  & A16   #& データ作成者    & SWAMP     
         | 
| 768 | 
            +
                62    & MDATE  & A16   #& データ変更日付  & 19900926225422
         | 
| 769 | 
            +
                63    & MSIGN  & A16   #& データ変更者    & SWAMP     
         | 
| 770 | 
            +
                64    & SIZE   & I10   #& 配列のサイズ    & 98304
         | 
| 770 771 |  | 
| 771 772 | 
             
            =end
         |