Skip to content

Commit

Permalink
bug fix for single subset.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-i-berry committed Nov 18, 2024
1 parent d6f593d commit ac8d67b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bufr2geojson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,10 +855,12 @@ def transform(data: bytes, serialize: bool = False,
LOGGER.info(f"{nsubsets} subsets")
collections = dict()
for idx in range(nsubsets):
LOGGER.debug(f"Extracting subset {idx}")
codes_set(bufr_handle, "extractSubset", idx+1)
codes_set(bufr_handle, "doExtractSubsets", 1)
LOGGER.debug("Cloning subset to new message")
if nsubsets > 1: # we need to specify which subset to extract
LOGGER.debug(f"Extracting subset {idx}")
codes_set(bufr_handle, "extractSubset", idx+1)
codes_set(bufr_handle, "doExtractSubsets", 1)
LOGGER.debug("Cloning subset to new message")

single_subset = codes_clone(bufr_handle)
LOGGER.debug("Unpacking")
codes_set(single_subset, "unpack", True)
Expand Down

0 comments on commit ac8d67b

Please sign in to comment.