LoginSignup
1
0

More than 3 years have passed since last update.

Scipy > FortranFile() > big endianでのFortran用データファイルの作成

Last updated at Posted at 2020-01-16
動作環境
Xeon E5-2620 v4 (8コア) x 2 
32GB RAM 
CentOS Linux release 7.7.1908 (Core)
Python 3.6.8 (default, Aug  7 2019, 17:28:10) 
IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.
Scipy v1.4.1

概要

実装

np.arrayを使ってendianを指定する方法で成功した。
versionという変数がbig endianのintegerとして書出しできた。

import numpy
from scipy.io import FortranFile

frt = FortranFile('SST_met', 'w')
version = 5
frt.write_record(np.array([version], dtype='>i4'))
frt.close()
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0