pytroll / trollbufr

PyTroll BUFR reader
http://trollbufr.readthedocs.io/
GNU Lesser General Public License v3.0
11 stars 7 forks source link

Test failure, table not found B0000000000000013000.TXT and not included with bufrdc_tables.zip #24

Closed gerritholl closed 5 years ago

gerritholl commented 5 years ago

Running the bufrtables unittests, the code tries to read test/bufrtables/B0000000000000013000.TXT. I have unzipped bufrdc_tables.zip, which includes B0000000000000026000.TXT but not B0000000000000013000.TXT. Apparently the mver (inferred from the file contents?) for the test file is 13 but this file is not included with the distribution.

E
======================================================================
ERROR: Test reading data and data quality on Metop-A MHS BUFR file
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/gholl/checkouts/trollbufr/test/test.py", line 42, in test_bufr_read
    bufr.decode(blob)
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/bufr.py", line 385, in decode
    self.decode_meta(bin_data, load_tables)
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/bufr.py", line 369, in decode_meta
    raise tables_fail
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/bufr.py", line 329, in decode_meta
    self._tables = self.load_tables()
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/bufr.py", line 149, in load_tables
    self._meta['lver'],
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/coder/load_tables.py", line 64, in load
    tables = load_all(master, center, subcenter, master_vers, local_vers, self._base_path, self._tabf)
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/coder/load_tables.py", line 114, in load_all
    raise e
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/coder/load_tables.py", line 106, in load_all
    tparse.load_tab_b(tables, mp)
  File "/media/nas/x21324/miniconda3/envs/py37a/lib/python3.7/site-packages/trollbufr/coder/parse_bufrdc.py", line 135, in load_tab_b
    raise BufrTableError(_text_file_not_found % fname)
trollbufr.coder.errors.BufrTableError: BufrTableError: Table not found: '/home/gholl/checkouts/trollbufr/test/bufrtables/B0000000000000013000.TXT'
-------------------- >> begin captured logging << --------------------
trollbufr: INFO: FILE /home/gholl/checkouts/trollbufr/test/metop_mhs.bufr
trollbufr: DEBUG: SEARCH AHL : 0 - 41 b'BUFR' : 1 matches > b'IEMX01 EUMP 150722'
trollbufr: DEBUG: LOADED 48598 B, 41 - 48639
trollbufr: INFO: SECT 0..5 DECODE
trollbufr: DEBUG: SECT_0         offs:8 len:8 = {'size': 48598, 'edition': 4}
trollbufr: DEBUG: SECT_1         offs:30 len:22 = {'master': 0, 'center': 254, 'subcenter': 0, 'update': 0, 'sect2': False, 'cat': 3, 'cat_int': 255, 'cat_loc': 11, 'mver': 13, 'lver': 0, 'datetime': datetime.datetime(2012, 5, 15, 7, 21)}
trollbufr: WARNING: not all arguments converted during string formatting
trollbufr: ERROR: BufrTableError: Table not found: '/home/gholl/checkouts/trollbufr/test/bufrtables/B0000000000000013000.TXT'
trollbufr: DEBUG: SECT_3         offs:39 len:9 = {'subsets': 1800, 'obs': True, 'comp': True, 'descr': [310010]}
trollbufr: DEBUG: SECT_4         offs:48594 len:48555 = {'data_start': 43, 'data_end': 48594}
trollbufr: DEBUG: SECT_5         offs:48598 len:4 = {}
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 0.081s

FAILED (errors=1)
gerritholl commented 5 years ago

When I copy the relevant file from python-bufr then the test does not fail at the same point (rather, it fails at test_bufr_read, see #25).

alexmaul commented 5 years ago

Unpacking the ZIP-archive 'bufrdc_tables.zip' -- which was packed by ECMWF -- requires running the shell-script 'links.sh' (from that archive) to create links for all table files, including 'B0000000000000013000.TXT' you missed.