We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 26bedb3 + 686a7a7 commit 06e4668Copy full SHA for 06e4668
strip_header.py
@@ -49,10 +49,14 @@ def setup_arg_parser():
49
50
# Find WMO header and remove
51
def remove_header(block):
52
- data = block[:64].decode('utf-8', 'ignore')
53
- match = re.search('\x01\r\r\n[\w\d\s]{4}\r\r\n\w{4}\d{2} \w{4} \d{6}[\s\w\d]*\r\r\n', data)
+ data = block[:64]
+ match = re.search(r'\x01\r\r\n[\w\d\s]{4}\r\r\n\w{4}\d{2} \w{4} \d{6}[\s\w\d\r]*\r\r\n',
54
+ data.decode('utf-8', 'ignore'))
55
if match:
56
return block[match.end():]
57
+ # WMO block regex didn't match, see if we can see magic bytes for HDF5/netCDF
58
+ elif ind := data.find(b'\x89HDF'):
59
+ return block[ind:]
60
else:
61
return block
62
0 commit comments