Class: NumRu::GPhys::GribDim
- Inherits:
-
Object
- Object
- NumRu::GPhys::GribDim
- Defined in:
- lib/numru/gphys/grib.rb
Overview
NumRu::GribDim
Class Methods
—new( vat, name, length )
Methods
—var —length —name —typecode —get —[](indices) —put_att(key,val) —set_att(key,val) —att(key) —att_names —inspect
Instance Method Summary collapse
- #[](*ind) ⇒ Object
- #att(key) ⇒ Object
- #att_names ⇒ Object
- #get ⇒ Object
-
#initialize(var, name) ⇒ GribDim
constructor
A new instance of GribDim.
- #inspect ⇒ Object
- #length ⇒ Object (also: #total)
- #name ⇒ Object
- #put(ary) ⇒ Object
- #put_att(key, val) ⇒ Object (also: #set_att)
- #typecode ⇒ Object
- #val ⇒ Object
- #var ⇒ Object
Constructor Details
#initialize(var, name) ⇒ GribDim
Returns a new instance of GribDim.
1578 1579 1580 1581 1582 |
# File 'lib/numru/gphys/grib.rb', line 1578 def initialize(var,name) @var = var @name = name @attr = Hash.new end |
Instance Method Details
#[](*ind) ⇒ Object
1614 1615 1616 |
# File 'lib/numru/gphys/grib.rb', line 1614 def [](*ind) return val[*ind] end |
#att(key) ⇒ Object
1626 1627 1628 |
# File 'lib/numru/gphys/grib.rb', line 1626 def att(key) @attr[key] end |
#att_names ⇒ Object
1629 1630 1631 |
# File 'lib/numru/gphys/grib.rb', line 1629 def att_names @attr.keys end |
#get ⇒ Object
1593 1594 1595 |
# File 'lib/numru/gphys/grib.rb', line 1593 def get @ary end |
#inspect ⇒ Object
1632 1633 1634 |
# File 'lib/numru/gphys/grib.rb', line 1632 def inspect "GribDim: #{name}" end |
#length ⇒ Object Also known as: total
1586 1587 1588 |
# File 'lib/numru/gphys/grib.rb', line 1586 def length @length end |
#name ⇒ Object
1590 1591 1592 |
# File 'lib/numru/gphys/grib.rb', line 1590 def name @name end |
#put(ary) ⇒ Object
1617 1618 1619 1620 1621 |
# File 'lib/numru/gphys/grib.rb', line 1617 def put(ary) @ary = ary @length = val.length return @ary end |
#put_att(key, val) ⇒ Object Also known as: set_att
1622 1623 1624 |
# File 'lib/numru/gphys/grib.rb', line 1622 def put_att(key,val) @attr[key]=val end |
#typecode ⇒ Object
1596 1597 1598 1599 1600 1601 1602 |
# File 'lib/numru/gphys/grib.rb', line 1596 def typecode if NArray===@ary @ary.typecode elsif Array===@ary @ary[0]["value"].typecode end end |
#val ⇒ Object
1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 |
# File 'lib/numru/gphys/grib.rb', line 1603 def val if Array===@ary if att("long_name")=="Hybrid level" return @ary[0]["value"] else return @ary[1]["value"] end else return @ary end end |
#var ⇒ Object
1583 1584 1585 |
# File 'lib/numru/gphys/grib.rb', line 1583 def var @var end |