예제 #1
0
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))
예제 #2
0
파일: hrw2json.py 프로젝트: pnuu/bufrpy
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))
예제 #3
0
파일: util.py 프로젝트: pnuu/bufrpy
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))