CDF
application/x-netcdf
Magic Bytes
Offset: 0
43 44 46 01
The Network Common Data Form (NetCDF) is a set of machine-independent data formats and software libraries maintained by Unidata at the University Corporation for Atmospheric Research. It is primarily utilized in scientific communities such as climatology and meteorology to store and share multidimensional array-oriented data like temperature, humidity, and pressure. Although this classic format remains a standard, modern implementations often utilize the HDF5 structure to enhance performance and accommodate larger, more complex hierarchical datasets.
Validation Code
How to validate .cdf files in Python
Python
def is_cdf(file_path: str) -> bool:
"""Check if file is a valid CDF by magic bytes."""
signature = bytes([0x43, 0x44, 0x46, 0x01])
with open(file_path, "rb") as f:
return f.read(4) == signature
How to validate .cdf files in Node.js
Node.js
function isCDF(buffer: Buffer): boolean {
const signature = Buffer.from([0x43, 0x44, 0x46, 0x01]);
return buffer.subarray(0, 4).equals(signature);
}
Go
func IsCDF(data []byte) bool {
signature := []byte{0x43, 0x44, 0x46, 0x01}
if len(data) < 4 {
return false
}
return bytes.Equal(data[:4], signature)
}
API Endpoint
GET
/api/v1/cdf
curl https://filesignature.org/api/v1/cdf