HDF5, netCDF-4, HDF4 and GeoTIFF are containers, not data. Which one you have decides which software will open it.
The file extension is a label someone typed. It is not enforced by anything,
and renaming a file does not change what is inside it. So the honest first
question is: what container is this actually written in, and what will open
it?
HDF5
yours
A filesystem inside a single file.
Holds folders (groups), arrays (datasets), and labelled notes attached to either (attributes). One file can carry a dozen variables, their coordinate axes, and a paragraph describing each, with no separate header to lose.
Opened by h5py, xarray, Panoply, HDFView, MATLAB, IDL
netCDF-4
HDF5 with the rules turned on.
Every netCDF-4 file is valid HDF5. The reverse is not true. netCDF-4 forbids some HDF5 features and requires coordinate axes to be declared a particular way, which is what lets xarray open a file and immediately know which dimension is time.
Opened by xarray, netCDF4-python, NCO, CDO, Panoply, QGIS
netCDF
The classic, flat version.
No groups, no compression, no nesting. Simple and extremely portable. Common for model output and station records.
Opened by netCDF4-python, xarray, NCO, CDO
HDF4 (legacy)
The previous generation. Not compatible with HDF5.
Despite the name, HDF4 and HDF5 are different formats with different libraries. Older MODIS and AIRS products still ship this way. If h5py refuses a .hdf file, this is why.
Opened by pyhdf, GDAL, HDFView
GeoTIFF
An image that knows where it is.
A raster with a coordinate reference system baked into its tags. Excellent in GIS software, awkward for anything with a time dimension.
Opened by GDAL, rasterio, QGIS, ArcGIS