I want to map a large fortran (12G) record on the hard drive to a numpy array. (Display instead of loading to save memory.)
The data stored in a fortran record is not continuous because it is divided into record markers. The structure of the record is "marker, data, marker, data, ..., data, marker". The length of data areas and markers is known.
The data length between the tokens is not a multiple of 4 bytes, otherwise I can map each data area to an array.
The first marker can be skipped by setting the offset in memmap, is it possible to skip other markers and map data to an array?
Apology for possible ambiguous expression and gratitude for any decision or suggestion.
Edited May 15
These are fortran unformatted files. The data stored in the record is an array (1024 ^ 3) * 3 float32 (12 Gb).
The following is a list of variable length record entries that are larger than 2 gigabytes in size:

(For more details, see here → section [Record Types] → [Variable Length Records].)
In my case, with the exception of the latter, each subrecord is 2147483639 bytes long and is divided into 8 bytes (as you see in the figure above, the end marker of the previous subrector and the start marker of the next, total 8 bytes).
We can see that the first subrecord ends with the first three bytes of some floating point number, and the second subrecord starts with the remaining 1 byte as 2147483639 mod 4 = 3.
python arrays numpy fortran hdf5
Syrtis Major May 13, '13 at 5:37 a.m. 2013-05-13 05:37
source share