I have some data from NDACC that I want to read so that I can plot a graph. I've downloaded one file and named it groundbased_ftir.hdf
. However, it just says that either the file doesn't exist, or that its unable to synchronously open (file signature not found).
import h5py
filename2='Data/ftirfrancenorthhemisphere.hdf'
with h5py.File(filename2,"r") as f:
print("Keys: %s" % f.keys())
But that gives an error:
Unable to synchronously open file (File signature not found)
I then tried:
filename=pd.read_hdf('Data/groundbased_ftir.hdf', mode='r' , key'28078=9006')
But that gives an error that the file does not exist (even though it does).
I then tried to run it in IDL which worked, but I'm not sure how to extract the data I want, and if I can get the data as a .csv
file.
I have some data from NDACC that I want to read so that I can plot a graph. I've downloaded one file and named it groundbased_ftir.hdf
. However, it just says that either the file doesn't exist, or that its unable to synchronously open (file signature not found).
import h5py
filename2='Data/ftirfrancenorthhemisphere.hdf'
with h5py.File(filename2,"r") as f:
print("Keys: %s" % f.keys())
But that gives an error:
Unable to synchronously open file (File signature not found)
I then tried:
filename=pd.read_hdf('Data/groundbased_ftir.hdf', mode='r' , key'28078=9006')
But that gives an error that the file does not exist (even though it does).
I then tried to run it in IDL which worked, but I'm not sure how to extract the data I want, and if I can get the data as a .csv
file.
NDACC files might not always be in HDF5 format, they could be in an older HDF4 format.
If it's an HDF4 file, use pyhdf
instead of h5py
.
from pyhdf.SD import SD, SDC
file = SD('Data/ftirfrancenorthhemisphere.hdf', SDC.READ)
print(file.datasets())
Check if the file actually exists in the specified directory.
import os
print(os.path.exists('Data/ftirfrancenorthhemisphere.hdf'))
If False
, the path might be incorrect, try using the absolute path instead.
filename2 = r'C:\path_to_your_project\Data\ftirfrancenorthhemisphere.hdf'