pydata / pydata/xarray

Support from reading unformatted Fortran files

Open
#2,911 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-documentation
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

I was wondering if there is interest in developing support for reading unformatted binary files into DataArrays/Datasets.

I have been using a couple of models for a while that output unformatted Fortran binary files that I have to read into DataArrays and Datasets. I have developed my own custom functions to do this and they work quite well for my purposes, but I was wondering is the community thinks this is something that would be useful for more people. I know the syntax could be a bit cumbersome, but I was thinking it could be implemented like

da = xr.DataArray.from_binary(filename, access="direct", dtype=np.float64, coords=coords, dims=dims,)

From there we could figure out the counts to read, etc. If there's interest in this feature we could discuss it and I'd be happy to implement.

Cheers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed DataArray.from_binary API and the existing DataArray/Dataset input and construction paths. Determine the supported Fortran unformatted access modes, dtype handling, dimensions, coordinates, and record counts, then define tests showing that the resulting DataArrays and Datasets contain the expected values.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran, numpy, python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.