Class: NumRu::GPhys::Grib::GribIS

Inherits:
Object
  • Object
show all
Includes:
NumRu::GPhys::GribUtils
Defined in:
lib/numru/gphys/grib.rb

Overview

end definition of class GribSegment

Instance Method Summary collapse

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

#getObject


385
386
387
# File 'lib/numru/gphys/grib.rb', line 385

def get
  @is
end

#grib?Boolean

Returns:

  • (Boolean)

366
367
368
# File 'lib/numru/gphys/grib.rb', line 366

def grib?
  return @is[0..3]=="GRIB"
end

#lengthObject


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_lengthObject


369
370
371
# File 'lib/numru/gphys/grib.rb', line 369

def total_length
  return @is.to_uint3(4)
end

#update_total_lengthObject


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

#versionObject


377
378
379
# File 'lib/numru/gphys/grib.rb', line 377

def version
  return @is.to_uint1(7)
end