Skip to content

Commit

Permalink
Update for _grib2io.py
Browse files Browse the repository at this point in the history
Added an else to the for loop on checking for "GRIB" to continue
when "GRIB" is not found in that loop. This will allow for grib2io
to silently ignore data that are not GRIB2 message.
  • Loading branch information
EricEngle-NOAA committed Jun 11, 2024
1 parent 69837b6 commit 65557cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/grib2io/_grib2io.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ def _build_index(self):
if header.to_bytes(4, "big") == b"GRIB":
pos = pos + test_offset
break
else:
# NOTE: Coming here means that no "GRIB" message identifier
# was found in the previous 2048 bytes. So here we continue
# the while True loop.
continue

# Read the rest of Section 0 using struct.
_secpos[0] = self._filehandle.tell()-4
Expand Down

0 comments on commit 65557cc

Please sign in to comment.