Skip to content

Commit

Permalink
Fix loop-counter when decoding to json-like object.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmaul committed Jul 26, 2018
1 parent e7ff812 commit 2cb328e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions trollbufr/bufr.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,27 +448,29 @@ def add_value(value):

for report in self.next_subset(as_array and self.is_compressed):
add_empty()
rpl_i = 0
rpl_i = [0]
for descr_entry in report.next_data():
if descr_entry.mark is not None:
mark_el = descr_entry.mark.split(" ")
if mark_el[0] in ("RPL", "REP"):
if len(mark_el) == 3:
# Replication starts
add_empty()
rpl_i = 0
rpl_i.append(0)
elif mark_el[1] == "END":
# Replication ends
hook_over()
hook_over()
rpl_i.pop()
elif mark_el[1] == "NIL":
# No iterations
hook_over()
rpl_i.pop()
else:
# For each iteration:
if rpl_i:
if rpl_i[-1]:
hook_over()
rpl_i += 1
rpl_i[-1] += 1
add_empty()
elif descr_entry.mark == "BMP DEF":
for s in range(-self.subsets if as_array else -1, 0):
Expand Down

0 comments on commit 2cb328e

Please sign in to comment.