You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use aronnax for some eddy simulations and wanted to use fortran binary files similar to how you do it in mitgcm.
However, I can't get it to work.
I am generating the fields in python and then save them as binary files.
When I try to save the files with the numpy .astype('>f8').tofile('fname') the aronnax driver returns with the error:
FortranFormattingError: End of file in the middle of a record
I also tried to write my own write function that adheres to the fortran binary format.
def write_binary(fname,array):
''' writes an unformatted binary fortran file one row at a time'''
with open(fname,'wb') as f:
for j in range(array.shape[1]):
row_data = array[:,j].tobytes()
record_size = len(row_data)
f.write(struct.pack("i", record_size))
f.write(row_data) # Write the actual data
f.write(struct.pack("i", record_size))
With this aronnax.driver doesn't complain anymore. But now the fortran routines crash.
At line 226 of file src/io.f90 (unit = 10, file = 'input/init_h_file.bin')
Fortran runtime error: I/O past end of record on unformatted file
Error termination. Backtrace:
#0 0x7f10eafabe59 in ???
[aronnax_minimal.zip](https://github.com/user-attachments/files/18942139/aronnax_minimal.zip)
#1 0x7f10eafaca71 in ???
#2 0x7f10eafad6dc in ???
#3 0x7f10eb248149 in ???
#4 0x7f10eb24308b in ???
#5 0x55abc304f6ec in __io_MOD_read_input_fileh
at src/io.f90:226
#6 0x55abc3062169 in aronnax
at src/aronnax.f90:241
#7 0x55abc303b29e in main
at src/aronnax.f90:35
I am assuming something about how I write the fortran files is wrong. But then again this method .astype('>f8').tofile('fname') has worked for me in mitgcm.
I have attached a python script to generate the data (gendata_minimal.py), my aronnax.conf and the script to run the model (run_minimal.py). aronnax_minimal.zip
Best regards,
Ingo
PS: I am running the latest aronnax master on ubuntu 24.04 with an intel i7-1365U CPU. Drivers and libraries should all be up to date.
The text was updated successfully, but these errors were encountered:
Hi,
I was trying to use aronnax for some eddy simulations and wanted to use fortran binary files similar to how you do it in mitgcm.
However, I can't get it to work.
I am generating the fields in python and then save them as binary files.
When I try to save the files with the numpy
.astype('>f8').tofile('fname')
the aronnax driver returns with the error:FortranFormattingError: End of file in the middle of a record
I also tried to write my own write function that adheres to the fortran binary format.
With this aronnax.driver doesn't complain anymore. But now the fortran routines crash.
I am assuming something about how I write the fortran files is wrong. But then again this method
.astype('>f8').tofile('fname')
has worked for me in mitgcm.I have attached a python script to generate the data (gendata_minimal.py), my aronnax.conf and the script to run the model (run_minimal.py).
aronnax_minimal.zip
Best regards,
Ingo
PS: I am running the latest aronnax master on ubuntu 24.04 with an intel i7-1365U CPU. Drivers and libraries should all be up to date.
The text was updated successfully, but these errors were encountered: