Error in running FourCastNet GitHub code, pre-processing stage

Hi! I am going through the FourCastNet code inside GitHub (GitHub - NVlabs/FourCastNet: Initial public release of code, data, and model weights for FourCastNet) and at the pre-processing stage I have got an error which is: KeyError: “Unable to open object (object ‘fields’ doesn’t exist)”
I have hdf5 parallel enabled and using the exact dataset which means the dates and the format inside the example code inside the rep, and still, get this error.
How can I solve this issue? thank you very much.

Hi @afshin.shafei

Unfortunately we can’t provide direct support for the GitHub code since the team is not familiar with the pre-processing implemented here. I would say your best bet would be to open an issue on the Github repo page or reach out to the lead author.

From what you described seems your H5 file is missing some data… perhaps use h5ls to see if the correct fields are in fact inside the file? (Just a guess)

Thank you very much for the reply. I checked the files and they seem to be correct, they have all the parts required for running. but I can’t understand where is the problem

Hi @afshin.shafei @ngeneva

Did you find a cause and a solution to this problem as I have encountered the same issue?

Thank you for your help.

hello @john.taylor1 ! :)
yeah I found the solution, you can check in this link: Pre-processing stage key error · Issue #6 · NVlabs/FourCastNet (

They suggested me to pre-populating a h5 file:

" I would recommend pre-populating the empty hdf5 files. Before running the file. I will push a script to do that. It should just do the following:"

time_steps = 52
with h5py.File(‘filename.h5’, ‘w’) as f:
f.create_dataset(‘fields’, shape = (time_steps, 20, 720, 1440), dtype=‘f’)

Thank you - I created the h5 files and can now get the code running.