GRIB2

application/octet-stream

Safe

Magic Bytes

Offset: 0
47 52 49 42

GRIB2 is a binary file format defined by the World Meteorological Organization (WMO) for the storage and transport of gridded meteorological data. It serves as the standard global format for exchanging numerical weather prediction output, facilitating efficient transmission of large atmospheric and oceanic datasets between agencies. This second iteration offers improved compression and flexibility over the legacy GRIB1 standard, though specialized software is required to decode its complex binary structure.

Extension

.grib2

MIME Type

application/octet-stream

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .grib2 files in Python

Python
def is_grib2(file_path: str) -> bool:
    """Check if file is a valid GRIB2 by magic bytes."""
    signature = bytes([0x47, 0x52, 0x49, 0x42])
    with open(file_path, "rb") as f:
        return f.read(4) == signature

How to validate .grib2 files in Node.js

Node.js
function isGRIB2(buffer: Buffer): boolean {
  const signature = Buffer.from([0x47, 0x52, 0x49, 0x42]);
  return buffer.subarray(0, 4).equals(signature);
}
Go
func IsGRIB2(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/grib2
curl https://filesignature.org/api/v1/grib2

Related Formats