Examples: Python script to check BUFR Table B (only consider first 8 columns)

This commit is contained in:
Shahram Najm 2021-10-10 20:30:18 +01:00
parent 2b6e5af279
commit 3200d6f4bc
1 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,9 @@ def verify_table(table, filename):
if table == "D":
raise NotImplementedError("Table D verification: Not yet implemented.")
data = np.genfromtxt(filename, comments="#", dtype=str, delimiter="|")
data = np.genfromtxt(
filename, comments="#", dtype=str, delimiter="|", usecols=np.arange(0, 8)
)
# If there is only 1 row, then we get a plain list and not list of lists
if len(data.shape) == 1:
@ -48,9 +50,7 @@ def verify_table(table, filename):
numcols = len(a_row)
if numcols < MIN_NUM_COLUMNS:
print(f"{a_row}")
print(
f"Error in line {linenum}: Number of columns (={numcols}) < required miniumum (={MIN_NUM_COLUMNS})"
)
print(f"Error in line {linenum}: Column count (={numcols}) < required miniumum (={MIN_NUM_COLUMNS})")
return 1
a_code = a_row[0]
a_key = a_row[1]