Class: NumRu::GribDim

Inherits:
Object
  • Object
show all
Defined in:
lib/numru/grib/grib.rb

Overview

class GribVar

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(var, name) ⇒ GribDim

Returns a new instance of GribDim.



404
405
406
407
408
# File 'lib/numru/grib/grib.rb', line 404

def initialize(var,name)
  @var = var
  @name = name
  @attr = Hash.new
end

Instance Attribute Details

#lengthObject (readonly) Also known as: total

Returns the value of attribute length.



403
404
405
# File 'lib/numru/grib/grib.rb', line 403

def length
  @length
end

#nameObject (readonly)

Returns the value of attribute name.



403
404
405
# File 'lib/numru/grib/grib.rb', line 403

def name
  @name
end

#varObject (readonly)

Returns the value of attribute var.



403
404
405
# File 'lib/numru/grib/grib.rb', line 403

def var
  @var
end

Instance Method Details

#[](*ind) ⇒ Object



423
424
425
# File 'lib/numru/grib/grib.rb', line 423

def [](*ind)
  return val[*ind]
end

#att(key) ⇒ Object



435
436
437
# File 'lib/numru/grib/grib.rb', line 435

def att(key)
  @attr[key]
end

#att_namesObject



438
439
440
# File 'lib/numru/grib/grib.rb', line 438

def att_names
  @attr.keys
end

#getObject



410
411
412
# File 'lib/numru/grib/grib.rb', line 410

def get
  @ary
end

#inspectObject



441
442
443
# File 'lib/numru/grib/grib.rb', line 441

def inspect
  "GribDim: #{name} length=#{length}"
end

#put(ary) ⇒ Object



426
427
428
429
430
# File 'lib/numru/grib/grib.rb', line 426

def put(ary)
  @ary = ary
  @length = val.length
  return @ary
end

#put_att(key, val) ⇒ Object Also known as: set_att



431
432
433
# File 'lib/numru/grib/grib.rb', line 431

def put_att(key,val)
  @attr[key]=val
end

#typecodeObject



413
414
415
416
417
418
419
# File 'lib/numru/grib/grib.rb', line 413

def typecode
  if NArray===@ary
    @ary.typecode
  elsif Array===@ary
    @ary[0]["value"].typecode
  end
end

#valObject



420
421
422
# File 'lib/numru/grib/grib.rb', line 420

def val
  return @ary
end