Class: NumRu::GPhys::Grib::GribBMS

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

Overview

end definition of class GribGDS

Instance Method Summary collapse

Constructor Details

#initialize(sgm, str = nil) ⇒ GribBMS

Returns a new instance of GribBMS.



977
978
979
980
# File 'lib/numru/gphys/grib.rb', line 977

def initialize(sgm,str=nil)
  @sgm = sgm
  @bms = str
end

Instance Method Details

#existObject



981
982
983
984
# File 'lib/numru/gphys/grib.rb', line 981

def exist
  @bms = "\000"*3
  @sgm.is.update_total_length
end

#getObject



1021
1022
1023
# File 'lib/numru/gphys/grib.rb', line 1021

def get
  @bms && uint2str(length,3) << @bms
end

#has_map?Boolean

Returns:

  • (Boolean)


1006
1007
1008
1009
# File 'lib/numru/gphys/grib.rb', line 1006

def has_map?
  return nil if @bms.nil?
  return !map_number
end

#lengthObject



989
990
991
992
993
994
995
# File 'lib/numru/gphys/grib.rb', line 989

def length
  if @bms
    return @bms.length+3
  else
    return 0
  end
end

#mapObject



1010
1011
1012
1013
# File 'lib/numru/gphys/grib.rb', line 1010

def map
  return nil unless has_map?
  return get_bits( @bms[3..-1], 1,1, 0,@bms.to_uint1, NArray::BYTE )
end

#map_numberObject



996
997
998
999
1000
# File 'lib/numru/gphys/grib.rb', line 996

def map_number
  nmap = @bms.to_uint2(1)
  nmap = false if nmap==0
  return nmap
end

#not_existObject



985
986
987
988
# File 'lib/numru/gphys/grib.rb', line 985

def not_exist
  @bms = nil
  @sgm.is.update_total_length
end

#set_map(mask) ⇒ Object



1014
1015
1016
1017
1018
1019
1020
# File 'lib/numru/gphys/grib.rb', line 1014

def set_map(mask)
  map,n = data2str(mask,1,1)
  @bms[0..0] = uint2str(n,1)
  @bms = @bms[0,3] << map
  @sgm.is.update_total_length
  return true
end

#set_map_number(n) ⇒ Object Also known as: map_number=



1001
1002
1003
1004
# File 'lib/numru/gphys/grib.rb', line 1001

def set_map_number(n)
  @bms[1..2] = uint2str(n,2)
  return n
end