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.



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

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

Instance Method Details

#existObject



988
989
990
991
# File 'lib/numru/gphys/grib.rb', line 988

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

#getObject



1028
1029
1030
# File 'lib/numru/gphys/grib.rb', line 1028

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

#has_map?Boolean

Returns:

  • (Boolean)


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

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

#lengthObject



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

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

#mapObject



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

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

#map_numberObject



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

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

#not_existObject



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

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

#set_map(mask) ⇒ Object



1021
1022
1023
1024
1025
1026
1027
# File 'lib/numru/gphys/grib.rb', line 1021

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=



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

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