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.
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
#exist ⇒ Object
975 976 977 978 |
# File 'lib/numru/gphys/grib.rb', line 975 def exist @bms = "\000"*3 @sgm.is.update_total_length end |
#get ⇒ Object
1015 1016 1017 |
# File 'lib/numru/gphys/grib.rb', line 1015 def get @bms && uint2str(length,3)<<@bms end |
#has_map? ⇒ 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 |
#length ⇒ Object
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 |
#map ⇒ Object
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_number ⇒ Object
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_exist ⇒ Object
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 |