HACKER Q&A
📣 Eddy_Viscosity2

Nan for HDF-5 Data Format


My question is for those familiar with the HDF-5 data format. From what I can tell, it does not natively support the Not-A-Number (NaN) data type. For example if an array of data values was stored and some of them were NaN then these would be converted to nulls which can then be read in (i.e. misinterpreted) as zeros.

Does anyone know of a standardized or widely accepted way of storing NaN in HDF-5 files?


  👤 jjgreen Accepted Answer ✓
NaN is not a data-type, it is a floating point number -- I've seen NaNs (and Infs) in HDF5 files (as floating point numbers). Some of the accompanying tools do not "do the right thing" with them though (h5diff sees NaNs as equal, for example).