From be91cb67cbcacda4b6d7d6b5383d0838fc1d304d Mon Sep 17 00:00:00 2001 From: Yang Wang Date: Fri, 26 Jan 2024 12:40:51 +1100 Subject: [PATCH] An 1-bit increment of one should indicate missing compressed data Fix a bug where an 1-bit increment of one is treated as normal increment. According to WMO spec 94.1.6 The convention for representing missing data for compressed data within the binary Data section shall be to set the corresponding increments to fields of all ones. There it should be processed as missing data. Resolves: #33 --- pybufrkit/__init__.py | 2 +- pybufrkit/decoder.py | 6 + tests/data/ISMD01_OKPR.values.cmp | 36 +- tests/data/amv2_87.values.cmp | 656 +++++++++++++++--------------- tests/data/asr3_190.values.cmp | 16 +- tests/test_Decoder.py | 6 +- tests/test_dataquery.py | 24 +- 7 files changed, 376 insertions(+), 370 deletions(-) diff --git a/pybufrkit/__init__.py b/pybufrkit/__init__.py index 5ac1fff..5b21257 100644 --- a/pybufrkit/__init__.py +++ b/pybufrkit/__init__.py @@ -33,7 +33,7 @@ UnknownDescriptor, PyBufrKitError) -__version__ = '0.2.21' +__version__ = '0.2.22' __author__ = 'ywangd@gmail.com' LOGGER = logging.getLogger('PyBufrKit') diff --git a/pybufrkit/decoder.py b/pybufrkit/decoder.py index 044e9ef..a8dea18 100644 --- a/pybufrkit/decoder.py +++ b/pybufrkit/decoder.py @@ -273,6 +273,9 @@ def process_numeric_compressed(self, state, bit_reader, descriptor, nbits_min_va else: for decoded_values in state.decoded_values_all_subsets: diff = bit_reader.read_uint_or_none(nbits_diff) + # A one-bit increment of value one is considered as missing + if diff == 1 and nbits_diff == 1: + diff = None if diff is None: value = None else: @@ -332,6 +335,9 @@ def process_codeflag_compressed(self, state, bit_reader, descriptor, nbits_min_v else: for decoded_values in state.decoded_values_all_subsets: diff = bit_reader.read_uint_or_none(nbits_diff) + # A one-bit increment of value one is considered as missing + if diff == 1 and nbits_diff == 1: + diff = None if diff is None: value = None else: diff --git a/tests/data/ISMD01_OKPR.values.cmp b/tests/data/ISMD01_OKPR.values.cmp index f9f0108..3f5f950 100644 --- a/tests/data/ISMD01_OKPR.values.cmp +++ b/tests/data/ISMD01_OKPR.values.cmp @@ -132,8 +132,8 @@ 16 -80.0 17 8 18 None -19 92510.0 -20 750 +19 None +20 None 21 2.0 22 271.85 23 271.75 @@ -156,7 +156,7 @@ 40 7 41 120.0 42 1 -43 12 +43 None 44 None 45 None 46 None @@ -248,8 +248,8 @@ 16 -110.0 17 8 18 None -19 92510.0 -20 750 +19 None +20 None 21 2.0 22 273.05 23 271.15 @@ -272,7 +272,7 @@ 40 7 41 240.0 42 1 -43 12 +43 None 44 None 45 None 46 None @@ -364,8 +364,8 @@ 16 -70.0 17 5 18 None -19 92510.0 -20 750 +19 None +20 None 21 1.98 22 273.65 23 271.95 @@ -388,7 +388,7 @@ 40 7 41 240.0 42 1 -43 12 +43 None 44 None 45 None 46 None @@ -480,8 +480,8 @@ 16 -130.0 17 7 18 None -19 92510.0 -20 750 +19 None +20 None 21 2.01 22 271.85 23 270.85 @@ -504,7 +504,7 @@ 40 7 41 120.0 42 1 -43 12 +43 None 44 None 45 None 46 None @@ -596,8 +596,8 @@ 16 -120.0 17 8 18 None -19 92510.0 -20 750 +19 None +20 None 21 2.0 22 275.05 23 272.45 @@ -620,7 +620,7 @@ 40 7 41 450.0 42 1 -43 12 +43 None 44 None 45 None 46 None @@ -712,8 +712,8 @@ 16 -170.0 17 7 18 None -19 92510.0 -20 750 +19 None +20 None 21 2.0 22 278.65 23 273.05 @@ -736,7 +736,7 @@ 40 0 41 6900.0 42 1 -43 12 +43 None 44 None 45 None 46 None diff --git a/tests/data/amv2_87.values.cmp b/tests/data/amv2_87.values.cmp index 5da4b0b..f053193 100644 --- a/tests/data/amv2_87.values.cmp +++ b/tests/data/amv2_87.values.cmp @@ -89,16 +89,16 @@ 89 12 90 32090.0 91 244.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -367,16 +367,16 @@ 89 12 90 34560.0 91 248.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -645,16 +645,16 @@ 89 12 90 44310.0 91 257.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -1201,16 +1201,16 @@ 89 12 90 46440.0 91 259.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -1479,16 +1479,16 @@ 89 12 90 34190.0 91 246.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -1757,16 +1757,16 @@ 89 12 90 31280.0 91 241.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -2035,16 +2035,16 @@ 89 12 90 32310.0 91 244.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -2313,16 +2313,16 @@ 89 12 90 34080.0 91 245.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -2869,16 +2869,16 @@ 89 12 90 45120.0 91 260.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -3147,16 +3147,16 @@ 89 12 90 44960.0 91 260.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -3425,16 +3425,16 @@ 89 12 90 45080.0 91 260.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -3703,16 +3703,16 @@ 89 12 90 45140.0 91 260.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -3981,16 +3981,16 @@ 89 12 90 45330.0 91 260.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -4259,16 +4259,16 @@ 89 12 90 45120.0 91 260.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -5927,16 +5927,16 @@ 89 12 90 47520.0 91 260.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -6205,16 +6205,16 @@ 89 12 90 45600.0 91 258.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -6483,16 +6483,16 @@ 89 12 90 44710.0 91 257.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -6761,16 +6761,16 @@ 89 12 90 44840.0 91 257.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -7039,16 +7039,16 @@ 89 12 90 44990.0 91 257.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -8151,16 +8151,16 @@ 89 12 90 46270.0 91 259.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -8429,16 +8429,16 @@ 89 12 90 46680.0 91 260.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -8707,16 +8707,16 @@ 89 12 90 33980.0 91 244.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -8985,16 +8985,16 @@ 89 12 90 33700.0 91 244.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -9263,16 +9263,16 @@ 89 12 90 33960.0 91 245.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -9541,16 +9541,16 @@ 89 12 90 32700.0 91 244.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -9819,16 +9819,16 @@ 89 12 90 30890.0 91 241.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -10097,16 +10097,16 @@ 89 12 90 30550.0 91 240.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -10375,16 +10375,16 @@ 89 12 90 30330.0 91 240.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -11209,16 +11209,16 @@ 89 12 90 46510.0 91 260.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -13155,16 +13155,16 @@ 89 12 90 45260.0 91 261.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -13433,16 +13433,16 @@ 89 12 90 44950.0 91 261.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -13711,16 +13711,16 @@ 89 12 90 44550.0 91 260.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -13989,16 +13989,16 @@ 89 12 90 44130.0 91 259.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -14267,16 +14267,16 @@ 89 12 90 43930.0 91 259.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -14545,16 +14545,16 @@ 89 12 90 44100.0 91 259.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -14823,16 +14823,16 @@ 89 12 90 43930.0 91 259.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -15101,16 +15101,16 @@ 89 12 90 43880.0 91 259.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -15379,16 +15379,16 @@ 89 12 90 43180.0 91 258.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -15657,16 +15657,16 @@ 89 12 90 42430.0 91 257.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -15935,16 +15935,16 @@ 89 12 90 41690.0 91 256.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -16213,16 +16213,16 @@ 89 12 90 41760.0 91 256.1 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -16491,16 +16491,16 @@ 89 12 90 42120.0 91 256.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -16769,16 +16769,16 @@ 89 12 90 42640.0 91 257.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -17047,16 +17047,16 @@ 89 12 90 42990.0 91 258.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -19549,16 +19549,16 @@ 89 12 90 50340.0 91 261.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -19827,16 +19827,16 @@ 89 12 90 45660.0 91 258.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -20105,16 +20105,16 @@ 89 12 90 45160.0 91 257.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -20383,16 +20383,16 @@ 89 12 90 45360.0 91 257.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -20939,16 +20939,16 @@ 89 12 90 45390.0 91 258.1 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -21495,16 +21495,16 @@ 89 12 90 45560.0 91 258.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -21773,16 +21773,16 @@ 89 12 90 33830.0 91 244.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -22051,16 +22051,16 @@ 89 12 90 33630.0 91 244.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -22329,16 +22329,16 @@ 89 12 90 33850.0 91 245.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -22607,16 +22607,16 @@ 89 12 90 32430.0 91 243.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -22885,16 +22885,16 @@ 89 12 90 31270.0 91 241.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -23163,16 +23163,16 @@ 89 12 90 44510.0 91 257.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -24553,16 +24553,16 @@ 89 12 90 44090.0 91 260.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -24831,16 +24831,16 @@ 89 12 90 43850.0 91 260.1 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -25109,16 +25109,16 @@ 89 12 90 43400.0 91 259.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -25387,16 +25387,16 @@ 89 12 90 42850.0 91 258.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -25665,16 +25665,16 @@ 89 12 90 42870.0 91 258.5 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -25943,16 +25943,16 @@ 89 12 90 41700.0 91 256.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -26221,16 +26221,16 @@ 89 12 90 41940.0 91 256.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -26499,16 +26499,16 @@ 89 12 90 42220.0 91 257.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -26777,16 +26777,16 @@ 89 12 90 42270.0 91 257.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -27055,16 +27055,16 @@ 89 12 90 42070.0 91 256.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -27333,16 +27333,16 @@ 89 12 90 40320.0 91 254.1 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -27611,16 +27611,16 @@ 89 12 90 40280.0 91 253.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -27889,16 +27889,16 @@ 89 12 90 40400.0 91 254.4 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -30947,16 +30947,16 @@ 89 12 90 49820.0 91 262.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -31503,16 +31503,16 @@ 89 12 90 46060.0 91 257.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -31781,16 +31781,16 @@ 89 12 90 46450.0 91 258.9 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -32059,16 +32059,16 @@ 89 12 90 46480.0 91 259.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -32337,16 +32337,16 @@ 89 12 90 46580.0 91 260.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -32615,16 +32615,16 @@ 89 12 90 33870.0 91 244.2 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -32893,16 +32893,16 @@ 89 12 90 33440.0 91 243.8 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -33171,16 +33171,16 @@ 89 12 90 33840.0 91 245.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -33449,16 +33449,16 @@ 89 12 90 32700.0 91 243.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -33727,16 +33727,16 @@ 89 12 90 31360.0 91 241.3 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -34005,16 +34005,16 @@ 89 12 90 30470.0 91 239.7 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -34283,16 +34283,16 @@ 89 12 90 44710.0 91 257.6 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 @@ -34561,16 +34561,16 @@ 89 12 90 40120.0 91 254.0 -92 3 +92 None 93 None 94 None -95 5 +95 None 96 None 97 None -98 3 +98 None 99 None 100 None -101 5 +101 None 102 None 103 None 104 0 diff --git a/tests/data/asr3_190.values.cmp b/tests/data/asr3_190.values.cmp index 21be56d..900b595 100644 --- a/tests/data/asr3_190.values.cmp +++ b/tests/data/asr3_190.values.cmp @@ -17406,7 +17406,7 @@ 414 0 415 0 416 16 -417 1 +417 None 418 0 419 0 420 0 @@ -20061,7 +20061,7 @@ 414 0 415 0 416 0 -417 1 +417 None 418 0 419 0 420 0 @@ -30681,7 +30681,7 @@ 414 87 415 0 416 0 -417 1 +417 None 418 None 419 2 420 4 @@ -30700,7 +30700,7 @@ 433 0 434 0 435 None -436 1 +436 None 437 1 438 74 439 1 @@ -30712,13 +30712,13 @@ 445 0 446 0 447 None -448 1 +448 None 449 0 450 51 451 0 452 0 453 None -454 1 +454 None 455 2 456 83 457 2 @@ -32805,7 +32805,7 @@ 414 93 415 0 416 0 -417 1 +417 None 418 0 419 14 420 82 @@ -65196,7 +65196,7 @@ 414 39 415 1 416 3 -417 1 +417 None 418 0 419 1 420 1 diff --git a/tests/test_Decoder.py b/tests/test_Decoder.py index 515fc76..5f7826e 100644 --- a/tests/test_Decoder.py +++ b/tests/test_Decoder.py @@ -54,7 +54,7 @@ def _compare(self, bufr_message, cmp_file_name): if value is None: line = '{} {}'.format(idx + 1, repr(value)) assert line == cmp_line, \ - 'At line {}: {} != {}'.format(idx + 1, line, cmp_line) + 'At file {} line {}: {} != {}'.format(cmp_file_name, idx + 1, line, cmp_line) elif isinstance(value, (binary_type, text_type)): # TODO: better to decode all ascii bytes to unicode string if isinstance(value, binary_type) and PY3: @@ -62,14 +62,14 @@ def _compare(self, bufr_message, cmp_file_name): else: line = '{} {}'.format(idx + 1, repr(value)) assert line == cmp_line, \ - 'At line {}: {} != {}'.format(idx + 1, line, cmp_line) + 'At file {} line {}: {} != {}'.format(cmp_file_name, idx + 1, line, cmp_line) else: field = cmp_line.split()[1] if field.endswith('L'): field = field[:-1] cmp_value = eval(field) assert abs(value - cmp_value) < 1.0e6, \ - 'At line {}: {} != {}'.format(idx + 1, value, cmp_value) + 'At file {} line {}: {} != {}'.format(cmp_file_name, idx + 1, value, cmp_value) def _print_values(self, bufr_message): for idx_subset in range(len(bufr_message.template_data.value.decoded_values_all_subsets)): diff --git a/tests/test_dataquery.py b/tests/test_dataquery.py index e1cb54d..f494cbd 100644 --- a/tests/test_dataquery.py +++ b/tests/test_dataquery.py @@ -414,21 +414,21 @@ def test_descendant_ISMD01_OKPR(self): r5 = self.querent.query(bufr_message, '008002') assert r5.all_values(flat=True) == [ [5, 5, 11, 7, 8, 9, None], - [7, 1, 12, 7, 8, 9, None], - [7, 1, 12, 7, 8, 9, None], - [7, 1, 12, 7, 8, 9, None], - [7, 1, 12, 7, 8, 9, None], - [7, 1, 12, 7, 8, 9, None], - [0, 1, 12, 7, 8, 9, None], + [7, 1, None, 7, 8, 9, None], + [7, 1, None, 7, 8, 9, None], + [7, 1, None, 7, 8, 9, None], + [7, 1, None, 7, 8, 9, None], + [7, 1, None, 7, 8, 9, None], + [0, 1, None, 7, 8, 9, None], ] assert r5.all_values() == [ [5, [[5]], [[11]], [[7], [8], [9]], None], - [7, [[1]], [[12]], [[7], [8], [9]], None], - [7, [[1]], [[12]], [[7], [8], [9]], None], - [7, [[1]], [[12]], [[7], [8], [9]], None], - [7, [[1]], [[12]], [[7], [8], [9]], None], - [7, [[1]], [[12]], [[7], [8], [9]], None], - [0, [[1]], [[12]], [[7], [8], [9]], None], + [7, [[1]], [[None]], [[7], [8], [9]], None], + [7, [[1]], [[None]], [[7], [8], [9]], None], + [7, [[1]], [[None]], [[7], [8], [9]], None], + [7, [[1]], [[None]], [[7], [8], [9]], None], + [7, [[1]], [[None]], [[7], [8], [9]], None], + [0, [[1]], [[None]], [[7], [8], [9]], None], ] r6 = self.querent.query(bufr_message, '@[4] > 302047 > 008002')