|
OpenZGY/Python API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Efficient iterator for reading an entire ZGY file. More...
Functions | |
| def | readall (r, *blocksize=None, chunksize=None, maxbytes=128 *1024 *1024, dtype=None, cropsize=None, cropoffset=None, lod=0, sizeonly=False, progress=None) |
Efficient iterator for reading an entire ZGY file.
Efficient iterator for reading an entire ZGY file. Naming conventions used in this file for parameters: surveysize: (i,j,k)-- Size of entire survey without padding. bricksize: (i,j,k) -- How data is stored. Usually (64, 64, 64). blocksize: (i,j,k) -- How much to read (at most) in one call. chunksize: (i,j,k) -- How much to return (at most) at once. maxbytes: int64 -- Max bytes to read at once, defaults to 1 GB dtype: np.dtype -- Sample data type to return (float or storage). readfn: callable -- To be called when reading a block. progress: callable -- Invoked after each read from disk.
| def openzgy.iterator.readall | ( | r, | |
| * | blocksize = None, |
||
chunksize = None, |
|||
maxbytes = 128*1024*1024, |
|||
dtype = None, |
|||
cropsize = None, |
|||
cropoffset = None, |
|||
lod = 0, |
|||
sizeonly = False, |
|||
progress = None |
|||
| ) |
Convenience function to iterate over an entire cube, trying to use
an efficient block size on read and optionally returning a smaller
chunk size to the caller. The returned data buffer belongs to this
iterator and may be overwritten on the next call. Two different
iterators do not share their buffers.
Note: If blocksize is a multiple of chunksize and chunksize is a
multiple of bricksize then the following holds: if a chunk smaller
than the requested chunksize is received then this can only be due
to reading at the end or bottom of the survey. The caller might rely
on this. E.g. when computing low resolution bricks and writing them
out in a way that avoids a read/modify/write.
CAVEAT: This function mingh be overkill in some cases.
parameters:
r: ZgyReader -- The open ZGY file
blocksize: (i,j,k) -- How much to read (at most) in one call.
If omitted, use a reasonable default.
Dims set to 0 mean "as much as possible".
chunksize: (i,j,k) -- How much to return (at most) at once.
Defaults to blocksize, i.e. return the
same blocks that are read. Will never
return more than blocksize, so if set to
more than 64 you probably want to set an
explicit blocksize as well.
maxbytes: int64 -- Max bytes to read at once, defaults to 128 MB
Ignored if an explicit blocksize is specified.
dtype: np.dtype -- Data type of returned buffer. Defaults to
what is in the file. Use np.float32 to
convert and scale (if needed) to float.
cropsize: (i,j,k) -- Only read this amount of data.
Note, no sanity check of this parameter.
cropoffset: (i,j,k) Start reading at this point.
Note, no sanity check of this parameter.
lod: int Pass >0 for decimated data.
sizeonly: bool -- If false, return sizes but not data.
progress: callable -- Invoked after each read from disk.
1.8.17