Class: GrADS::Gridded
- Inherits:
-
Object
- Object
- GrADS::Gridded
- Defined in:
- lib/grads/binary.rb,
lib/grads/binary.rb,
lib/grads/gridded.rb,
lib/grads/gridded.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#chunksize ⇒ Object
readonly
Returns the value of attribute chunksize.
-
#ctl_file ⇒ Object
readonly
Returns the value of attribute ctl_file.
-
#dset ⇒ Object
readonly
Returns the value of attribute dset.
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#isize ⇒ Object
readonly
Returns the value of attribute isize.
-
#jsize ⇒ Object
readonly
Returns the value of attribute jsize.
-
#pdef ⇒ Object
readonly
Returns the value of attribute pdef.
-
#proj ⇒ Object
readonly
Returns the value of attribute proj.
-
#taxis ⇒ Object
readonly
Returns the value of attribute taxis.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#tsize ⇒ Object
readonly
Returns the value of attribute tsize.
-
#undef ⇒ Object
readonly
Returns the value of attribute undef.
-
#vardims ⇒ Object
readonly
Returns the value of attribute vardims.
-
#varnames ⇒ Object
readonly
Returns the value of attribute varnames.
-
#varoffsets ⇒ Object
readonly
Returns the value of attribute varoffsets.
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
-
#vectorpair ⇒ Object
readonly
Returns the value of attribute vectorpair.
-
#xaxis ⇒ Object
readonly
Returns the value of attribute xaxis.
-
#xsize ⇒ Object
readonly
Returns the value of attribute xsize.
-
#yaxis ⇒ Object
readonly
Returns the value of attribute yaxis.
-
#ysize ⇒ Object
readonly
Returns the value of attribute ysize.
-
#zaxis ⇒ Object
readonly
Returns the value of attribute zaxis.
-
#zsize ⇒ Object
readonly
Returns the value of attribute zsize.
Instance Method Summary collapse
- #forward(rlon, rlat) ⇒ Object
-
#initialize(ctl_file, radius: nil) ⇒ Gridded
constructor
A new instance of Gridded.
- #inverse(fi, fj) ⇒ Object
- #lonlat ⇒ Object
- #template(ctl_file, &block) ⇒ Object
- #var(name) ⇒ Object
- #xy ⇒ Object
Constructor Details
#initialize(ctl_file, radius: nil) ⇒ Gridded
Returns a new instance of Gridded.
131 132 133 134 135 136 |
# File 'lib/grads/binary.rb', line 131 def initialize (ctl_file, radius: nil) @ctl_file = ctl_file @entries = scan_ctl_file(ctl_file) @radius = radius parse_entries(@entries) end |
Instance Attribute Details
#chunksize ⇒ Object (readonly)
Returns the value of attribute chunksize.
146 147 148 |
# File 'lib/grads/binary.rb', line 146 def chunksize @chunksize end |
#ctl_file ⇒ Object (readonly)
Returns the value of attribute ctl_file.
138 139 140 |
# File 'lib/grads/binary.rb', line 138 def ctl_file @ctl_file end |
#dset ⇒ Object (readonly)
Returns the value of attribute dset.
139 140 141 |
# File 'lib/grads/binary.rb', line 139 def dset @dset end |
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
138 139 140 |
# File 'lib/grads/binary.rb', line 138 def entries @entries end |
#isize ⇒ Object (readonly)
Returns the value of attribute isize.
141 142 143 |
# File 'lib/grads/binary.rb', line 141 def isize @isize end |
#jsize ⇒ Object (readonly)
Returns the value of attribute jsize.
141 142 143 |
# File 'lib/grads/binary.rb', line 141 def jsize @jsize end |
#pdef ⇒ Object (readonly)
Returns the value of attribute pdef.
140 141 142 |
# File 'lib/grads/binary.rb', line 140 def pdef @pdef end |
#proj ⇒ Object (readonly)
Returns the value of attribute proj.
140 141 142 |
# File 'lib/grads/binary.rb', line 140 def proj @proj end |
#taxis ⇒ Object (readonly)
Returns the value of attribute taxis.
143 144 145 |
# File 'lib/grads/binary.rb', line 143 def taxis @taxis end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
139 140 141 |
# File 'lib/grads/binary.rb', line 139 def title @title end |
#tsize ⇒ Object (readonly)
Returns the value of attribute tsize.
142 143 144 |
# File 'lib/grads/binary.rb', line 142 def tsize @tsize end |
#undef ⇒ Object (readonly)
Returns the value of attribute undef.
139 140 141 |
# File 'lib/grads/binary.rb', line 139 def undef @undef end |
#vardims ⇒ Object (readonly)
Returns the value of attribute vardims.
145 146 147 |
# File 'lib/grads/binary.rb', line 145 def vardims @vardims end |
#varnames ⇒ Object (readonly)
Returns the value of attribute varnames.
145 146 147 |
# File 'lib/grads/binary.rb', line 145 def varnames @varnames end |
#varoffsets ⇒ Object (readonly)
Returns the value of attribute varoffsets.
145 146 147 |
# File 'lib/grads/binary.rb', line 145 def varoffsets @varoffsets end |
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
145 146 147 |
# File 'lib/grads/binary.rb', line 145 def vars @vars end |
#vectorpair ⇒ Object (readonly)
Returns the value of attribute vectorpair.
144 145 146 |
# File 'lib/grads/binary.rb', line 144 def vectorpair @vectorpair end |
#xaxis ⇒ Object (readonly)
Returns the value of attribute xaxis.
143 144 145 |
# File 'lib/grads/binary.rb', line 143 def xaxis @xaxis end |
#xsize ⇒ Object (readonly)
Returns the value of attribute xsize.
142 143 144 |
# File 'lib/grads/binary.rb', line 142 def xsize @xsize end |
#yaxis ⇒ Object (readonly)
Returns the value of attribute yaxis.
143 144 145 |
# File 'lib/grads/binary.rb', line 143 def yaxis @yaxis end |
#ysize ⇒ Object (readonly)
Returns the value of attribute ysize.
142 143 144 |
# File 'lib/grads/binary.rb', line 142 def ysize @ysize end |
#zaxis ⇒ Object (readonly)
Returns the value of attribute zaxis.
143 144 145 |
# File 'lib/grads/binary.rb', line 143 def zaxis @zaxis end |
#zsize ⇒ Object (readonly)
Returns the value of attribute zsize.
142 143 144 |
# File 'lib/grads/binary.rb', line 142 def zsize @zsize end |
Instance Method Details
#forward(rlon, rlat) ⇒ Object
509 510 511 |
# File 'lib/grads/binary.rb', line 509 def forward (rlon, rlat) return @forward[rlon, rlat] end |
#inverse(fi, fj) ⇒ Object
505 506 507 |
# File 'lib/grads/binary.rb', line 505 def inverse (fi, fj) return @inverse[fi,fj] end |
#lonlat ⇒ Object
513 514 515 516 517 518 519 |
# File 'lib/grads/binary.rb', line 513 def lonlat fi = CArray.float(xsize).seq fj = CArray.float(ysize).seq ii = fi[ysize,:%] jj = fj[:%,xsize] return @inverse[ii, jj] end |
#template(ctl_file, &block) ⇒ Object
532 533 534 535 536 |
# File 'lib/grads/binary.rb', line 532 def template (ctl_file, &block) asm = Writer.new(self) asm.define(&block) asm.write(ctl_file) end |
#var(name) ⇒ Object
525 526 527 528 529 530 |
# File 'lib/grads/binary.rb', line 525 def var (name) unless @varnames.include?(name) raise "invalid variable name '#{name}'" end return Variable.new(name, self) end |
#xy ⇒ Object
521 522 523 |
# File 'lib/grads/binary.rb', line 521 def xy return @xy[] end |