-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: ability to read heterogeneous types in FortranFile #3865
Conversation
@astrofrog |
@rgommers - ok, I'll see what I can do! I won't have time this week, but will look into it at the weekend. |
Definitely use the numpy dtype!
|
@WarrenWeckesser - thanks! The reason I deleted my comment is because I realized that in fact I could maybe even use the dtype way with the existing |
@WarrenWeckesser @rgommers - ok, so |
I can also add some tests for that mode to make sure if doesn't break in future. |
…d in mixed type records
@rgommers @WarrenWeckesser - I've now attached code to this issue, but I have one question - as you can see if the tests, if one has an array with shape (2,) then read_record will return a numpy structured array with a length of 1 so that |
Presumably this doesn't need a changelog entry since there is no change in behavior? |
Changes Unknown when pulling eb17f81 on astrofrog:fortran-mixed-records into * on scipy:master*. |
DOC: io: document and test reading record inputs in FortranFile
LGTM, merged |
At the moment, the three
read_*
methods ofscipy.io.FortranFile
can only read records with homogeneous data types, but it would be nice to allow some more flexibiity, for cases where the data is written e.g. as:I was thinking that we could add a new method
read_mixed
that could take a list of dtypes, and returns a Python list with scalars inside.I could look into it if there was interest in having such a feature in scipy.