简体   繁体   中英

Can one save Fortrana arrays in .npy format?

I am using Fortran for my numerical computations. The common standard in Fortran is to save the array as a .dat file. I want to occasionally transfer the array to Python for further manipulations. Ways to do this thing

  • Write a script in python to read the .dat file and produce a numpy array
  • Use something like HDF5, NETCDF, etc while saving the array (accessible in Python)

.dat file script reader would need to be customised t0 the way the arrays are stored. Would need to store probably one array per file for ease of use. My arrays are not that big so, I am not fond of using HDF5. But do let me know if there is no other option.

I have not used it yet, but MRedies NPY-for-Fortran seems to be what you are looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM