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.



971
972
973
974
# File 'lib/numru/gphys/grib.rb', line 971

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

Instance Method Details

#existObject



975
976
977
978
# File 'lib/numru/gphys/grib.rb', line 975

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

#getObject



1015
1016
1017
# File 'lib/numru/gphys/grib.rb', line 1015

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

#has_map?Boolean

Returns:

  • (Boolean)


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

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

#lengthObject



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

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

#mapObject



1004
1005
1006
1007
# File 'lib/numru/gphys/grib.rb', line 1004

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

#map_numberObject



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

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

#not_existObject



979
980
981
982
# File 'lib/numru/gphys/grib.rb', line 979

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

#set_map(mask) ⇒ Object



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

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=



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

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