def read_file_all(b_table_file, d_table_file, bufr_file): return _do_read(b_table_file, d_table_file, bufr_file, lambda f, table: bufrpy.decode_all(bufrpy.util.ByteStream(f), table))
from __future__ import print_function import bufrpy from bufrpy.template import safnwc from bufrpy.table import libbufr from bufrpy.util import ByteStream import json import sys import codecs # Try reading as libbufr table b_table = libbufr.read_b_table(codecs.open(sys.argv[1], 'rb', 'utf-8')) stream = ByteStream(open(sys.argv[2], 'rb')) messages, errors = bufrpy.decode_all(stream, b_table) if errors: print(errors) sys.exit(1) print(json.dumps(messages))
def read_file_all(b_table_file, d_table_file, bufr_file): return _do_read( b_table_file, d_table_file, bufr_file, lambda f, table: bufrpy.decode_all(bufrpy.util.ByteStream(f), table))