Skip to main content

An efficient package to read fortran-record files in Python.

Project description

Cython fortran-file

Build and Test PyPI Conda-forge

This package is a fast and easy reader for record-based binary format, as written by Fortran.

Installation

This packages requires a compiler to be installed on you system. If you're using Linux or MacOSX you should be fine. If you're using Windows, please get in touch with me or open an issue.

pip install cython_fortran_file

That's all!

Using it

Here is a simple demonstration:

from cython_fortran_file import FortranFile as FF

f = FF("/path/to/my/fortran/file.dat", mode="r")

# Skip 5 records
f.skip(5)

# Read one record (an array of `double`)
data = f.read_vector("d")
assert data.dtype == np.float64

# Read one record (an array of signed `int`)
data = f.read_vector("i")
assert data.dtype == np.int32

# Read one *single* int. This will fail if there is more to read!
v = f.read_int()

# f _looks_ like a regular file descriptor
f.tell()
f.seek(0)
f.close()

It also supports with statement so that you can't forget to close the file handler

with FF("/path/to/my/fortran/file.dat") as f:
    f.skip(5)

    data = f.read_vector("d")  # Read a vector of doubles (as usual)

Data types

The argument of read_vector follows the convention of the python struct package (C convention). See https://docs.python.org/3.5/library/struct.html#format-characters for the full list. Here is a shorter version:

Argument Fortran type C type Numpy dtype
d real(8) double np.float64
f real(4) float np.float32
i integer int np.int32
l integer(8) long np.int64

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cython_fortran_file-0.2.7.tar.gz (104.9 kB view details)

Uploaded Source

Built Distributions

cython_fortran_file-0.2.7-cp313-cp313-macosx_11_0_arm64.whl (49.5 kB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

cython_fortran_file-0.2.7-cp312-cp312-win_amd64.whl (47.4 kB view details)

Uploaded CPython 3.12 Windows x86-64

cython_fortran_file-0.2.7-cp312-cp312-win32.whl (43.3 kB view details)

Uploaded CPython 3.12 Windows x86

cython_fortran_file-0.2.7-cp312-cp312-musllinux_1_1_x86_64.whl (302.4 kB view details)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

cython_fortran_file-0.2.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (303.1 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

cython_fortran_file-0.2.7-cp312-cp312-macosx_11_0_arm64.whl (50.4 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

cython_fortran_file-0.2.7-cp312-cp312-macosx_10_9_x86_64.whl (53.8 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

cython_fortran_file-0.2.7-cp311-cp311-win_amd64.whl (47.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

cython_fortran_file-0.2.7-cp311-cp311-win32.whl (44.2 kB view details)

Uploaded CPython 3.11 Windows x86

cython_fortran_file-0.2.7-cp311-cp311-musllinux_1_1_x86_64.whl (293.7 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

cython_fortran_file-0.2.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (292.9 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

cython_fortran_file-0.2.7-cp311-cp311-macosx_11_0_arm64.whl (50.6 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

cython_fortran_file-0.2.7-cp311-cp311-macosx_10_9_x86_64.whl (54.3 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

cython_fortran_file-0.2.7-cp310-cp310-win_amd64.whl (47.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

cython_fortran_file-0.2.7-cp310-cp310-win32.whl (44.4 kB view details)

Uploaded CPython 3.10 Windows x86

cython_fortran_file-0.2.7-cp310-cp310-musllinux_1_1_x86_64.whl (269.7 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

cython_fortran_file-0.2.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (269.3 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

cython_fortran_file-0.2.7-cp310-cp310-macosx_11_0_arm64.whl (50.5 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

cython_fortran_file-0.2.7-cp310-cp310-macosx_10_9_x86_64.whl (54.0 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

cython_fortran_file-0.2.7-cp39-cp39-win_amd64.whl (47.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

cython_fortran_file-0.2.7-cp39-cp39-win32.whl (45.1 kB view details)

Uploaded CPython 3.9 Windows x86

cython_fortran_file-0.2.7-cp39-cp39-musllinux_1_1_x86_64.whl (272.7 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

cython_fortran_file-0.2.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (272.3 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

cython_fortran_file-0.2.7-cp39-cp39-macosx_11_0_arm64.whl (51.1 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

cython_fortran_file-0.2.7-cp39-cp39-macosx_10_9_x86_64.whl (54.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file cython_fortran_file-0.2.7.tar.gz.

File metadata

  • Download URL: cython_fortran_file-0.2.7.tar.gz
  • Upload date:
  • Size: 104.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for cython_fortran_file-0.2.7.tar.gz
Algorithm Hash digest
SHA256 0f2a9f6e9556f755121a1b1dd995c0faf5b665cb2be90be68b4ef004a90e7ccf
MD5 d2a2bccb520c8a1ea2a4af2a924a3289
BLAKE2b-256 58b27b9cdb7ba7baaad8c85130e26edd895487e8ff649fb7d70f42b3bcfe8dcd

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a8b6f110dee9aaf56df15f9acfebdd57c7d02e74593fc7c64001cab91d04fb8
MD5 666078b21355caa463ae9ba26d5694ca
BLAKE2b-256 e220594042ba9bbb4ad33d7488eb96e8d3f0bac653e123230eac8cba2bd6b0d9

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 47304745cc9924985aa82930085f4722cbd9773755d7fb6ecf73e8e05db637e2
MD5 c4b60a863f6ba77bc54cdc86e2200c02
BLAKE2b-256 8ee7ec47af75583c2caf348d7fe86804498c796fe75d1693564329231b8de1c4

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 1595f89f41c2a984f172acbc0e199ebfbf023c4b629eb370a9e909e4bfeb74a6
MD5 f0c9bf6657628abf3bf11d0d0113b6e7
BLAKE2b-256 e611f3152981b3c2f32c64a9bbb305b8f78b4dc1bec57dacc96f657f807980ae

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3c42c478991d56269ae95e20da689a5bde0c1ae3118ea2fa6c48aea5c7a356f1
MD5 6ed904ea0db24d336e2d0b6a7240d202
BLAKE2b-256 747286b83e5d9e10fcee57c587e38ce26e1dbea9cdaed9a43d3b74ed229f8dec

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dce537d6d65a805cc28c38d21e93d184b5b9808fc2362f4bf78dee95e4c517a8
MD5 b83027d6fee6c7d4329634947d8416de
BLAKE2b-256 7ed29bfdcb833cdf37b238a0220d7cbea9593819dfd4e60466cb2cfc4d9107b8

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 735faa3b0b0a128eceb38d296a709ee57bffbf4989e37bd494febdc3fb1d0ece
MD5 d01ef80f96b12a47a2e0e4c3ebe5b8d6
BLAKE2b-256 f8074faa832d877a3b261f3c0aaddc27c38091a5a3729a148afc32c37a70d23f

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1e942116d458afa8eeb746599ffdf783b17e8d75c985acb0b0f6c4d79471e4c5
MD5 0546096c2f1a5ce38a1b0f624d8d8d83
BLAKE2b-256 c28f5e80642db1a62c499c879fc15ca35c6781a527affc255dca1b20500d97c6

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4fe62e8bb89dee8463c7d5744bdd63f65f27598b45fecf60dd0feb3c4ee92c26
MD5 dd231bfbade2e0b77f925a4dd5445fb7
BLAKE2b-256 e9231906589f80a00d73a5ed390570c48d8baf0dd5b3c42766c03974337d1336

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 ccca93d6216c949754722b55802f7a03a54818f2029a03987bb071a1b2945ff7
MD5 e9fa2b85b86bb916eba5d4d65cc6d7ad
BLAKE2b-256 0e1acfaee6f372e1938e5970adad3917ebed7f1092141a6559669358680aefa8

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 1bb20428abd8f2b8b6b4b6e91bcfe6bb9603457f9a0f8917e325e9c4f2e5d974
MD5 fe71d2cd1eb15f1de1a47643176b229f
BLAKE2b-256 08bebb307f77322eccf362dd63f118e4c6adc2a1ecee77b4a37de09c1c72e70b

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5db40834a4e10b03cc11983b6cf21e1d0912413fc014436c87d3f01e1315a8a3
MD5 69ee473c627b8291f0b79ad6efc06b38
BLAKE2b-256 7be27f55ad63fdd16b5f8248c217e94a6ee6f62d007243c46095527d97080b6e

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7fa95844ba3a3b26f7961692773abf7b1842b42b59ebf3d3f453e87842023ee2
MD5 3852ee321368b0fe3f866e3a06276d65
BLAKE2b-256 edfdc469a555f8c7287085765860c8e28cff2f87bf2384fb1fb95ace6831f04f

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 dca37a57f68b10b342039e2faff1e5cee36f95efb25be520c3023db27c887d0f
MD5 ca17a86fa740f29591aa8028cba6476e
BLAKE2b-256 a7da33b0fb8b5284a8bef63657474bc238109021dcfefa9d6a43e1d289cf9018

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a70c244878438b3715ebeaa26143a0a7937e20b24108e3f7be1fdc2cb786f1fc
MD5 f9cd8720f82fb2ce1eda0b80d311dc43
BLAKE2b-256 0925f590c35195be2e2f534164a6afbf40de653f539228acc93808dba3843a07

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6c1f6f2a39d53655979f21d9fddec7df4016f89a76b190d054a1d95bcaa3c052
MD5 bd01e6bfef42ec5452d80c3ecd352c19
BLAKE2b-256 33855dd8cccfa22b0ca80f39c98456b66bd73897648ad47c85f8b5df3cd03eff

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 88c964d69cb2bdc7b6524afc95ed701e1bd29643a557218b69c0b13edbebbbd6
MD5 3d8273ec9d4e29e29448f670e47db8a6
BLAKE2b-256 d4cdcad26ae73ef41d91859e5ca6ca3aa018e7548e9885615aae0146a406bf15

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06c1bfd077911ae8da57e356e42b37085dc4530a3b192d03372ff5340bccfe37
MD5 65b3cea759a7cba5f4c74c76fe460940
BLAKE2b-256 6b0bc8da38d02b14fd2d8419af08ce168f8534aae78e09c6e4f71cbb6cec0b7e

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef43e38ae5e1e53bbe6b766efb35c18f61165a6c166521918e2746022702b92f
MD5 142cc29ebcaca276be0b616a883c1563
BLAKE2b-256 c43c0369dd15493115a872b44d8e4be94fae42bcc648ff60f211077fac901c1d

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 30b5ea2f8cfb169c4e3fc3a08228603e2ef0e576ee19792bc1a6025121b5537d
MD5 99eaa59c9b57473624130fcc762c8cff
BLAKE2b-256 5fd80fb4f268427e5f969322545e3c3db05609eec61277f59411854a2b3d16e1

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 2e87b69062ed9fb02279d62a16717632f20fce4c0721e89488c71bfa788ceb79
MD5 b20b5a5b6ccc6521aa0a160d58db9698
BLAKE2b-256 c7b599679c3b9d2d9bb772b6feab0b346c3ebdeb58ee6408cc7e2cbdc1d6b256

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-win32.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 dd8328cebdf7a0f7bbfb4913708dc60c45c10334487313f89340d2fb02d8bb4c
MD5 63a76a594089f854e6c069fbb0c8f77b
BLAKE2b-256 aa15519db0837c0449279ac9fad7ab639ca33be30af9435336192e5f6238a51f

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 ee41a64d21b65c62698ae277b519821eb4c6840cc97d07b7daa9dc36cdaf573c
MD5 33820fb7d00a80479c7841684126dde2
BLAKE2b-256 5b3538cf4438389c751d0f1a5b2c1b40b30a90c5c6b445aee2e0756e846d3068

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d9467217ed935660a50aa3f6046bdbf8504ff683f89535d582425c73d2588997
MD5 acd7718402dcef1a6a9066fa67860be3
BLAKE2b-256 a209403a82742da16eb6ec3c30a3762157566243d54a852db3b984ccaea4d758

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4e02c72d9ad818e3cf00afa4c65f206721c4771280dbd5030280e4e178ac084e
MD5 12639a5254bd8467400d49e841e30ea3
BLAKE2b-256 a2a8dd7204baade9428a09ea35f506e2d50751927567fb5f9161a48aae068192

See more details on using hashes here.

File details

Details for the file cython_fortran_file-0.2.7-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for cython_fortran_file-0.2.7-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0fefa8c9eb5641685e774b07c473ce783a22f7c221e0ddc1cbe68398531e8a5f
MD5 2b8999fdc414d6c78bc0b631d5c78748
BLAKE2b-256 71afd1ffc289cecc416b22f1f1bc33c6f60ba99ee02c6e876e25961477414970

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page