Skip to content

Instantly share code, notes, and snippets.

@DSCF-1224
Created December 27, 2020 11:14
Show Gist options
  • Save DSCF-1224/90a5e8621ddea6cc565824cbb231e85e to your computer and use it in GitHub Desktop.
Save DSCF-1224/90a5e8621ddea6cc565824cbb231e85e to your computer and use it in GitHub Desktop.
python で fortran の unformatted で出力した INT32 と REAL64 型のデータを読み出す
# -*- coding: utf-8 -*-
import numpy
def read_int32(file_stream):
return numpy.fromfile(file= file_stream, dtype= numpy.int32, count=1)[0]
def read_real64(file_stream):
return numpy.fromfile(file= file_stream, dtype= numpy.float64, count=1)[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment