Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions pybufrkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

import argparse
import logging
from pathlib import Path
import sys

from pybufrkit.commands import (command_compile,
command_decode,
command_encode,
Expand All @@ -32,6 +32,7 @@
QueryError,
UnknownDescriptor,
PyBufrKitError)
from pybufrkit.constants import DEFAULT_TABLES_DIR

__version__ = '0.2.23'
__author__ = 'ywangd@gmail.com'
Expand All @@ -40,6 +41,10 @@
LOGGER.addHandler(logging.NullHandler()) # so testings do not complain about no handler


def get_local_table_dir(entity):
return Path(DEFAULT_TABLES_DIR).parent / entity


def main():
ap = argparse.ArgumentParser(prog=__name__,
description='Pure Python Toolkit for BUFR Messages',
Expand All @@ -59,8 +64,11 @@ def main():
ap.add_argument('-d', '--definitions-directory',
help='The directory to locate definition files')

ap.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
group = ap.add_mutually_exclusive_group()
group.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
group.add_argument('-l', '--local-entity-name',
help='The entity name for local tables')

subparsers = ap.add_subparsers(
dest='command',
Expand Down Expand Up @@ -262,6 +270,9 @@ def main():
else:
logging_level = logging.WARN

if ns.local_entity_name:
ns.tables_root_directory = get_local_table_dir(ns.local_entity_name)

logging.basicConfig(
stream=sys.stdout,
level=logging_level,
Expand Down
2 changes: 1 addition & 1 deletion pybufrkit/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
DEFAULT_DEFINITIONS_DIR = os.path.join(BASE_DIR, 'definitions')

# Default directory to load the BUFR tables
DEFAULT_TABLES_DIR = os.path.join(BASE_DIR, 'tables')
DEFAULT_TABLES_DIR = os.path.join(BASE_DIR, 'tables/wmo')

NBITS_PER_BYTE = 8

Expand Down
1 change: 1 addition & 0 deletions pybufrkit/tables/imd/0/0_0
27 changes: 27 additions & 0 deletions pybufrkit/tables/imd/0/255_255/5/TableB.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{"002181":["Supplementary present weather sensor", "FLAG TABLE", 0, 0, 21,"FLAG TABLE", 0, 7],
"007192":["Pixel size in Z-direction", "Meters", -1, 0, 16,"Numeric", -1, 5],
"021036":["Radar rainfall intensity", "mm*h-1", 2, 0, 16,"Numeric", 2, 5],
"021198":["dBZ-value offset (Alpha)", "dBZ", 0, -640, 11,"Numeric", 0, 5],
"021199":["dBZ-value increment (Beta)", "dBZ", 1, 0, 7,"Numeric", 1, 3],
"021200":["Height of CAPPI", "m", 0, -1000, 15,"Numeric", 0, 5],
"021201":["Range-bin size", "Meter", 0, 0, 14,"Numeric", 0, 4],
"021202":["Azimuthal resolution", "Degree", 1, 0, 8,"Numeric", 1, 3],
"021203":["Range-bin offset", "Meter", -1, 0, 14,"Numeric", -1, 5],
"021204":["Azimuth offset", "Degree", 1, 0, 12,"Numeric", 1, 4],
"021205":["V-value offset (av)", "m/s", 2, -16384, 15,"Numeric", 2, 5],
"021206":["V-value increment (bv)", "m/s", 2, 0, 8,"Numeric", 2, 3],
"021207":["W-value offset (aw)", "m/s", 2, 0, 14,"Numeric", 2, 6],
"021208":["W-value increment (bw)", "m/s", 2, 0, 8,"Numeric", 2, 3],
"029192":["Type of rotation ellipsoid", "CODE TABLE", 0, 0, 3,"CODE TABLE", 0, 0],
"029193":["Long Origin", "Degree", 2, -18000, 16,"Numeric", 2, 6],
"029194":["Lat Origin", "Degree", 2, -9000, 15,"Numeric", 2, 6],
"029195":["X-Offset", "Meters", 0, -33554432, 26,"Numeric", 0, 8],
"029196":["Y-Offset", "Meters", 0, -33554432, 26,"Numeric", 0, 8],
"029197":["Standard parallel 1", "Degree", 2, -9000, 15,"Numeric", 2, 15],
"029198":["Standard parallel 2", "Degree", 2, -9000, 15,"Numeric", 2, 15],
"029199":["Semi-major axis of rotation ellipsoid", "Meters", 0, 0, 26,"Numeric", 0, 9],
"029200":["Semi-minor axis of rotation ellipsoid", "Meters", 0, 0, 26,"Numeric", 0, 9],
"029201":["Projection type", "CODE TABLE", 0, 0, 5,"CODE TABLE", 0, 0],
"029202":["Azimuth of initial line", "Degree", 2, -9000, 15,"Numeric", 0, 2],
"030192":["North south view organisation", "CODE TABLE", 0, 0, 3,"CODE TABLE", 0, 0],
"030193":["East west view organisation", "CODE TABLE", 0, 0, 3,"CODE TABLE", 0, 0]}
10 changes: 10 additions & 0 deletions pybufrkit/tables/imd/0/255_255/5/TableD.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{"301192": ["General information about radar product", ["301011", "301012", "301023", "301023", "301023", "301023", "029201", "005002", "006002", "005033", "006033", "030021", "030022"]],
"313192": ["Heights of side view", ["101000", "031001", "010007"]],
"321192": ["4 bit per pixel radar images (top view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030001", "101000", "031001", "030001"]],
"321193": ["8 bit per pixel radar images (top view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030002", "101000", "031001", "030002"]],
"321194": ["4 bit per pixel radar image (north-south view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030001", "101000", "031001", "030001"]],
"321195": ["8 bit per pixel radar image (north-south view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030002", "101000", "031001", "030002"]],
"321196": ["4 bit per pixel radar image (east-west view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030001", "101000", "031001", "030001"]],
"321197": ["8 bit per pixel radar image (east-west view)", ["110000", "031002", "005031", "107000", "031001", "102000", "031001", "031012", "030002", "101000", "031001", "030002"]],
"321198": ["Rain accumulation product", ["103000", "031002", "101000", "031001", "013016"]],
"321250": ["List of radars included in a composite", ["104000", "031001", "001001", "001002", "031031", "033003"]]}
1 change: 1 addition & 0 deletions pybufrkit/tables/imd/0/98_0
1 change: 1 addition & 0 deletions pybufrkit/tables/meteofrance/0/0_0
1 change: 1 addition & 0 deletions pybufrkit/tables/meteofrance/0/198_0
Loading