OpenZGY/Python API and Internals (ALPHA)
Access seismic data stored in ZGY format.
Public Member Functions | List of all members
openzgy.impl.file.FileADT Class Reference
Inheritance diagram for openzgy.impl.file.FileADT:
openzgy.impl.file.LocalFile openzgy.impl.file.SeismicStoreFile openzgy.impl.file.SeismicStoreFileDelayedWrite openzgy.impl.file.LocalFileLinux openzgy.impl.file.LocalFileOther

Public Member Functions

def __init__ (self, filename, mode, iocontext)
 
def __enter__ (self)
 
def __exit__ (self, type, value, traceback)
 
def xx_close (self)
 
def xx_read (self, offset, size, *usagehint=UsageHint.Unknown)
 
def xx_write (self, data, offset, *usagehint=UsageHint.Unknown)
 
def xx_readv (self, requests, *parallel_ok=False, immutable_ok=False, transient_ok=False, usagehint=UsageHint.Unknown)
 
def threadsafe (self)
 
def xx_iscloud (self)
 

Constructor & Destructor Documentation

◆ __init__()

def openzgy.impl.file.FileADT.__init__ (   self,
  filename,
  mode,
  iocontext 
)
Open a file in the specified mode, which must be "rb" or "w+b".
Caller should use a "with" block to ensure the file gets closed.
The iocontext is an optional data structure that the user may
specify when a reader is created. It might be used to hold
user credentials etc. needed to access the low level file.
TODO-Low: support "r+b" (update) at some point in the future.

Reimplemented in openzgy.impl.file.SeismicStoreFileDelayedWrite, openzgy.impl.file.SeismicStoreFile, and openzgy.impl.file.LocalFile.

Member Function Documentation

◆ xx_close()

def openzgy.impl.file.FileADT.xx_close (   self)
Close a previously opened file.
No action if the file is already closed.

Reimplemented in openzgy.impl.file.SeismicStoreFileDelayedWrite, openzgy.impl.file.SeismicStoreFile, and openzgy.impl.file.LocalFile.

◆ xx_read()

def openzgy.impl.file.FileADT.xx_read (   self,
  offset,
  size,
usagehint = UsageHint.Unknown 
)
Read binary data from the file. Both size and offset are mandatory.
I.e. caller is not allowed to read "the entire file", and not
allowed to "read from where I left off the last time".
The actual reading will be done in a derived class.
The base class only validates the arguments.

Reimplemented in openzgy.impl.file.SeismicStoreFileDelayedWrite, openzgy.impl.file.LocalFileLinux, openzgy.impl.file.LocalFileOther, and openzgy.impl.file.SeismicStoreFile.

◆ xx_readv()

def openzgy.impl.file.FileADT.xx_readv (   self,
  requests,
parallel_ok = False,
  immutable_ok = False,
  transient_ok = False,
  usagehint = UsageHint.Unknown 
)
Read binary data from multiple regions in the file. Each part
of the request specifies offset, size, and a delivery functor
which will be invoked to pass back the returned bulk.

Arguments:
    parallel_ok:  If true then the delivery functor might be called
          simultaneously from multiple worker threads.
          The function itself will block until all the data
          has been read or an error occurs.
    immutable_ok: If true the caller promises that the delivery
          functor will not try to modify the data buffer.
          Pass False e.g. if the functor may need to byteswap
          the data it has read from file.
    transient_ok: If true the caller promises that the delivery
          functor will not keep a reference to the data buffer
          after the functor returns.

The delivery functor is called as
    fn(data)

FUTURE: a new argument partial_ok may be set to True if it is ok to
call the delivery functor with less data than requested, and to keep
calling it until all data has been delivered. The signature of the
delivery functor gets changed to fn(data, offset, size). Offset is the
absolute file offset. I.e. not relative to the requested offset.
Passing partial_ok=True might elide some buffer copies if the
caller is doing something simple (such as reading an uncompressed
brick) where partial copies are possible, and the backend is in the
cloud, and a longer lived cache is being maintained, and the cache
block size is smaller than the requested size. That is a lot of ifs.
There was some code to handle partial_ok but it has been removed.
Get it from the git history if you really want it.

Reimplemented in openzgy.impl.file.SeismicStoreFile, openzgy.impl.file.LocalFileLinux, and openzgy.impl.file.LocalFileOther.

◆ xx_write()

def openzgy.impl.file.FileADT.xx_write (   self,
  data,
  offset,
usagehint = UsageHint.Unknown 
)
Write binary data to the file. Offset is mandatory. I.e. caller
is not allowed to "write to where I left off the last time".
The actual writing will be done in a derived class.
The base class only validates the arguments.

Reimplemented in openzgy.impl.file.SeismicStoreFileDelayedWrite, openzgy.impl.file.SeismicStoreFile, openzgy.impl.file.LocalFileLinux, and openzgy.impl.file.LocalFileOther.


The documentation for this class was generated from the following file: