In a message of Mon, 13 Jul 2015 11:14:36 -0400, Gabriele Brambilla writes: >Hi, > >I have problems reading unformatted fortran output (binary) with python. > >I have a code in fortran where I write data on a file inside a cycle: > >write(11) x,y,z,BA01(i,j,k,1),BA01(i,j,k,2),1 >BB01(i,j,k,1),BB01(i,j,k,2),2 BE01(i,j,k,1),3 >EC01(i,j,k,1),EC01(i,j,k,2),4 ED01(i,j,k,1),ED01(i,j,k,2),5 > EF01(i,j,k,1),6 rGH01(i,j,k,1),rGH01(i,j,k,2),7 > rGI01(i,j,k,1),rGI01(i,j,k,2),8 rGJ01(i,j,k,1),1 > rGL(i,j,k,2),rGM(i,j,k,2),rGN(i,j,k,2) > >How can I read this 21 real line by line in Python? How can I decode this >unit specifier 11? All the numbers are defined as REAL. > >thanks > >Gabriele >_______________________________________________ >Tutor maillist - Tutor@python.org >To unsubscribe or change subscription options: >https://mail.python.org/mailman/listinfo/tutor
You want to use this package: https://pypi.python.org/pypi/fortranfile You need to also load numpy for this to work. Some people cannot get this to work, and like this way of doing things better: https://physics.ucf.edu/~dle/blog.php?id=1 Again, needs numpy. Write back if you need a numpy-free solution (i.e. you are on Jython). Laura _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor