|
OpenZGY/Python API and Internals (ALPHA)
Access seismic data stored in ZGY format.
|
Public Member Functions | |
| def | __init__ (self, filename, mode, iocontext) |
| def | xx_eof (self) |
| def | xx_close (self) |
| def | xx_read (self, in_offset, in_size, *usagehint=UsageHint.Unknown) |
| def | xx_readv (self, requests, *parallel_ok=False, immutable_ok=False, transient_ok=False, usagehint=UsageHint.Unknown) |
| def | xx_write (self, data, offset, *usagehint=UsageHint.Unknown) |
| def | threadsafe (self) |
| def | xx_iscloud (self) |
Public Member Functions inherited from openzgy.impl.file.FileADT | |
| def | __enter__ (self) |
| def | __exit__ (self, type, value, traceback) |
Access data in seismic store as a linear file even when the dataset
has multiple segments. There are some limitations on write.
* Writes starting at EOF are allowed, and will cause a new segment
to be written.
* Writes starting past EOF, signifying a hole in the data, are not
allowed.
* Writes starting before EOF are only allowed if offset,size exactly
matches a previous write. This will cause that segment to be rewritten.
* Possible future extension: For the last segment only offset
needs to match. This means the last segment may be resized.
For read the class provides a readv() method to do scatter/gather reads.
The code will then consolidate adjacent bricks to get larger brick size
sent to SDAPI. Optionally parallelize requests that cannot be consolidated.
| def openzgy.impl.file.SeismicStoreFile.__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 from openzgy.impl.file.FileADT.
| def openzgy.impl.file.SeismicStoreFile.xx_close | ( | self | ) |
Close a previously opened file. No action if the file is already closed.
Reimplemented from openzgy.impl.file.FileADT.
| def openzgy.impl.file.SeismicStoreFile.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 from openzgy.impl.file.FileADT.
| def openzgy.impl.file.SeismicStoreFile.xx_readv | ( | self, | |
| requests, | |||
| * | parallel_ok = False, |
||
immutable_ok = False, |
|||
transient_ok = False, |
|||
usagehint = UsageHint.Unknown |
|||
| ) |
Handle both brick consolidation and multi threading. This implementation will issue a single readv() request to the seismic store wrapper, wait for all threads to complete, and then deliver all the results. For this reason it needs to allocate a buffer to hold the entire data to be read. In the future it might be possible to have the seismic store wrapper support delivery callbacks and for it to allocate the result buffers itself. This saves some memory and also allows data to be decompressed if needed and copied out to user space as the bricks become available. Caveat: requests may need to be split if they cross a segment boundary. This means that we need support for partial delivery. Which would complicate things a lot.
Reimplemented from openzgy.impl.file.FileADT.
| def openzgy.impl.file.SeismicStoreFile.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 from openzgy.impl.file.FileADT.
1.8.17