In a message of Mon, 13 Jul 2015 15:32:06 -0400, Gabriele Brambilla writes: >Hi, > >sorry for the confusion I understood that the Real(8) I'm using correspond >to dtype float64 in Python. >With the second method it seems to work but I get a wrong number of >elements. > >They should be grouped by 21 float64 but I don't find a number of data = >21*m where m is an integer number. > >I think the problem is that Fortran write 4bytes at the beginning and at >the end of each file. >I found a way to remove the first 4 bytes but not the last. > >Do you have any suggestion? > >Thanks
I always used FortranFile, which uses (or used at any rate) the Python struct module to get those parts right. I suppose you could fiddle around with struct yourself, but it is probably better if you can just get FortranFile to work for you. This entry in the Scientific Python cookbook may help. http://wiki.scipy.org/Cookbook/FortranIO If you still cannot get it to work, the place to ask for help with the FortranFile library is the scientific Python mailing list. http://mail.scipy.org/mailman/listinfo/scipy-user whatever you are misunderstanding, they will know in a second because they do this all the time, and I do this once every 3 or 5 years, and then pretty much forget everything I learned until the next time I have to relearn it. Sorry I cannot remember more of the internal details, Laura _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor