Class: NumRu::GPhys::Grib::GribBMS
- Inherits:
-
Object
- Object
- NumRu::GPhys::Grib::GribBMS
- Includes:
- NumRu::GPhys::GribUtils
- Defined in:
- lib/numru/gphys/grib.rb
Overview
end definition of class GribGDS
Instance Method Summary collapse
- #exist ⇒ Object
- #get ⇒ Object
- #has_map? ⇒ Boolean
-
#initialize(sgm, str = nil) ⇒ GribBMS
constructor
A new instance of GribBMS.
- #length ⇒ Object
- #map ⇒ Object
- #map_number ⇒ Object
- #not_exist ⇒ Object
- #set_map(mask) ⇒ Object
- #set_map_number(n) ⇒ Object (also: #map_number=)
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
#exist ⇒ Object
988 989 990 991 |
# File 'lib/numru/gphys/grib.rb', line 988 def exist @bms = "\000"*3 @sgm.is.update_total_length end |
#get ⇒ Object
1028 1029 1030 |
# File 'lib/numru/gphys/grib.rb', line 1028 def get @bms && uint2str(length,3) << @bms end |
#has_map? ⇒ 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 |
#length ⇒ Object
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 |
#map ⇒ Object
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_number ⇒ Object
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_exist ⇒ Object
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 |