This is the first time I am asking a question so please forgive me if it is not in its best format. I am producing huge binary data related to the turbulent channel flow in Fortran and would like to post-proc it in python. As I cannot manage it, I decided to take a 0-step, i.e., I am producing a binary data if fortran:
real(kind=8), DIMENSION(10) :: x, y, z
integer :: i, counter
counter = 10
x=0
y=0
z=0
open(unit=2, file='result', status='replace',form='unformatted')
do i = 1, counter
x = i
y = i**2
z = 2*i
write(2) x, y, z
end do
close(2)
and then try to print it with:
import numpy as np
from scipy.io import FortranFile
f = FortranFile( 'result', 'r' )
print( f.read_reals( dtype='float64' ) )
but it only gives me the last row of the expectec result: [ 10. 100. 20.]
How can I print x, y, and z?
Kokab Goharian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.