GRB2
application/x-grib
Magic Bytes
Offset: 0
47 52 49 42
GRB2, formally GRIB Edition 2, is a binary file format standardized by the World Meteorological Organization (WMO) for the storage and transport of gridded meteorological data. It is the primary standard used by scientific institutions and weather agencies globally to archive numerical weather prediction models and forecast datasets. This iteration provides superior compression over the legacy Edition 1 format and presents minimal security risk, functioning strictly as a container for scientific measurements.
Validation Code
How to validate .grb2 files in Python
Python
def is_grb2(file_path: str) -> bool:
"""Check if file is a valid GRB2 by magic bytes."""
signature = bytes([0x47, 0x52, 0x49, 0x42])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .grb2 files in Node.js
Node.js
function isGRB2(buffer: Buffer): boolean {
const signature = Buffer.from([0x47, 0x52, 0x49, 0x42]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsGRB2(data []byte) bool {
signature := []byte{0x47, 0x52, 0x49, 0x42}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/grb2
curl https://filesignature.org/api/v1/grb2