[SciPy-user] partially reading a file...
Travis E. Oliphant
Wed Aug 6 09:16:56 CDT 2008
> Let's say I want to read a (binary) file which contains a nx*ny*nz array.
> Is it possible to read a "sub-array" from this file, ie each block of
> (nx/4, ny/4, nz/4) for instance, without loading the whole file ?
An easy way to do this which forces the operating system to do the work
of partial loading is to use a memory mapped file as the source of the
array (i.e. a memmap array).
Then, selecting out a block is as simple as slicing.
More information about the SciPy-user