Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Reading Fortran binary file in Python

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Sep 11, 2024 at 15:42 answer added Atharva Sunil Sathe timeline score: 0
Jan 27, 2021 at 16:37 answer added Mouse timeline score: 0
Dec 15, 2018 at 2:15 review First posts
Dec 15, 2018 at 3:53
Dec 6, 2018 at 7:35 answer added chw21 timeline score: 4
Dec 6, 2018 at 5:27 comment added ZisIsNotZis I don't know about Fortran. But for np.fromfile, it reads raw data without any header or footer. If you file has header (and hopefully you know how long is it), I believe you can skip the header by passing a open and seeked file to np.fromfile. If your file has footer, use the count parameter of np.fromfile. If you are not sure how long is header/footer. Do a experiment with 0. and observe the file using hex editor
Dec 5, 2018 at 22:39 comment added Vladimir F Героям слава No worries. I was only referring to the tag fortran vs tag fortran77, not to the clarity of your question.
Dec 5, 2018 at 22:29 comment added NoMansEyes @albert Yes I've looked at that post. It addresses having the wrong datatype for the content of the array. However, I know that the data in the array is r8, so I know that the python datatype should be float64.
Dec 5, 2018 at 22:27 comment added NoMansEyes @VladimirF I'm sorry if my question wasn't clear. Perhaps I can rephrase. Why does np.fromfile(fname) return more values than are in the array? In may case, there should be 3090903 entries, but the result has 3090904 entries. And why are the values that it returns not equal to the values in the source array?
Dec 5, 2018 at 21:11 comment added Vladimir F Героям слава Please use tag fortran for all Fortran questions. Your question is not version specific anyway.
Dec 5, 2018 at 21:11 history edited Vladimir F Героям слава
edited tags
Dec 5, 2018 at 19:05 comment added albert Did you have a look at e.g. stackoverflow.com/questions/37534220/… ( found by google; python reading Fortran binary file)
Dec 5, 2018 at 19:00 history asked NoMansEyes CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /