Class: NumRu::GPhys::Grib::GribIS
- Inherits:
-
Object
- Object
- NumRu::GPhys::Grib::GribIS
- Includes:
- NumRu::GPhys::GribUtils
- Defined in:
- lib/numru/gphys/grib.rb
Overview
end definition of class GribSegment
Instance Method Summary collapse
- #get ⇒ Object
- #grib? ⇒ Boolean
-
#initialize(sgm, str = nil) ⇒ GribIS
constructor
A new instance of GribIS.
- #length ⇒ Object
- #set_version(ver) ⇒ Object (also: #version=)
- #total_length ⇒ Object
- #update_total_length ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(sgm, str = nil) ⇒ GribIS
Returns a new instance of GribIS.
359 360 361 362 |
# File 'lib/numru/gphys/grib.rb', line 359 def initialize(sgm,str=nil) @sgm = sgm @is = str || "GRIB"+uint2str(8,3)+uint2str(2,1) end |
Instance Method Details
#get ⇒ Object
385 386 387 |
# File 'lib/numru/gphys/grib.rb', line 385 def get @is end |
#grib? ⇒ Boolean
366 367 368 |
# File 'lib/numru/gphys/grib.rb', line 366 def grib? return @is[0..3]=="GRIB" end |
#length ⇒ Object
363 364 365 |
# File 'lib/numru/gphys/grib.rb', line 363 def length return 8 end |
#set_version(ver) ⇒ Object Also known as: version=
380 381 382 383 |
# File 'lib/numru/gphys/grib.rb', line 380 def set_version(ver) @is[7..7] = uint2str(ver,1) return ver end |
#total_length ⇒ Object
369 370 371 |
# File 'lib/numru/gphys/grib.rb', line 369 def total_length return @is.to_uint3(4) end |
#update_total_length ⇒ Object
372 373 374 375 376 |
# File 'lib/numru/gphys/grib.rb', line 372 def update_total_length len = self.length+@sgm.pds.length+@sgm.gds.length+@sgm.bms.length+@sgm.bds.length+@sgm.es.length @is[4..6] = uint2str(len,3) return len end |
#version ⇒ Object
377 378 379 |
# File 'lib/numru/gphys/grib.rb', line 377 def version return @is.to_uint1(7) end |